Arduino Tutorial "Communication"
Arduino Tutorial "Communication"
Undergraduate Program
Handout: Arduino Tutorial Communication
Introduction:
In this tutorial we will learn how to communicate with the host-machine using serialport.
You can connect the circuit as shown in the Figure 1a,1b. We will use 2 x output pins from the Arduino
to control the motion of the DC motors. A switch on or off button is used to control the direction of
the motors.
void setup()
{
pinMode(ledPin, OUTPUT); // Set pin as OUTPUT
pinMode(enablePin1, OUTPUT); // pin for enable motor
pinMode(enablePin2, OUTPUT); // pin for enable motor
pinMode(motor1P1, OUTPUT); // pin for enable motor
pinMode(motor1P2, OUTPUT); // pin for enable motor
pinMode(motor2P1, OUTPUT); // pin for enable motor
Conclusion and results: Press cntrl-R to compile the code. If there is no errors, then press cntrl-U to
upload the compiled program on your C Flash memory. As told earlier, once the program is uploaded
successfully, the board will automatically get a reset and after a few second will start running your code.
Press the push button to check if the motors move in the opposite directions when the signal at pin-2 is
high.
References
http://arduino.cc.
http://arduino.cc/en/Main/ArduinoBoardUno.
http://arduino.cc/en/Guide/Introduction.
www.atmel.com/Images/doc8161.pdf.
Arduino Programming Notebook by - by Brian W. Evans.
Beginning Android ADK with Arduino by Mario Bohmer
http://arduino.cc/en/Tutorial/Button
http://arduino.cc/en/Tutorial/Blink
http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip.
http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf.
http://arduino.cc/en/Main/ArduinoBoardUno.
http://www.aishack.in/2010/07/the-three-motors-youll-ever-use-in-robotics/
http://arduino.cc/en/Tutorial/SoftwareSerialExample