Changes

Jump to: navigation, search

Week 4 Lab

100 bytes added, 20:59, 27 April 2009
Controlling a physical LED with the computer.
== Sending Data from the Computer to Control your Arduino ==
===Controlling a physical LED with the computer.===
* Compile the Examples->Communication->Dimmer example, and upload it to your board. This example sets up communication on the serial port (in the <code>void setup()</code> function, and then reads values from the <code>Serial</code> input, and writes them to the <code>ledPin</code> output. * Hook up a simple resistor and LED to the pin 9, to test the dimer example. [[Image:D_out_2.png]]
* Connect up the TIP120 driver circuit and motor from last week to the <code>ledPin</code> (pin 9). You should now be able to control the motor speed via the serial port on your computer... interesting...
* Click on the Serial Monitor. Try sending different values to the board. Type in numbers and press Enter (or click on the "Send" button, either will work).
** What behavior do you observe?
** Can you get the motor to speed up or slow down?  
=== modifying for rudimentary keyboard control ===
As-is, the Dimmer code is not very useful for controlling through the serial terminal like this. Now we are going to modify it to so that it works a little better. Our goal is to be able to set the speed of the motor typing the numbers 0-9 on the keyboard. 9 will go fastest (nearly full speed), and 0 will be a dead stop.

Navigation menu