|
Reference
- pinMode( PIN# , INPUT or OUTPUT )
prepares a pin to read or write information
- digitalWrite( PIN# , HIGH or LOW )
turns the pin on or off / GND
- delay( milliseconds )
waits before continuing to the next line
- analogRead( PIN# )
returns sensor value from 0 (off) to 1024 (full-on)
- digitalRead( PIN# )
returns sensor value as HIGH or LOW
- #include <Servo.h>
Servo myservo; paste at start of code to allow motor control
- myservo.attach(9);
Prepare servo motor inside setup
- myservo.write( 0 <= val <= 179 )
Turn motor to 0-179 degrees
- Serial.begin( 9600 )
connect computer and Arduino over USB/serial port
- Serial.println( # or "" )
output a message (number or text) to the computer
- Serial.println("DONE")
start the next program
- Custom functions:
add definition such as void dot(); at the beginning of the program
|