Goal: Turn an LED on for one second, off for one second, and repeat forever
setup( ) - runs first and only once
loop( ) - runs second and loops
pinmode(#, OUTPUT), pinmode(#, INPUT) - # = 0-13 = pin number. Arduino Uno has 13 digital I/O pins. pinmode initializes the pin as an output or input. These digital signals will always be either 5 volts (HIGH) or 0 volts (LOW). ie. pinmode(13, OUTPUT) will initialize output on pin 13.
digitalWrite(#, HIGH), digitalWrite(#, LOW) - built in function that makes an OUTPUT pin HIGH or LOW ie. digitalWrite(13, HIGH) turns the LED on pin 13 on.
delay( ) - pauses in milliseconds
Sources:
Vilros Ultimate Starter Kit Tutorial Sketches 1-12
No comments:
Post a Comment