ebook img

Arduino Tutorials With LinkSprite Arduino Kit - Amazon S3 PDF

45 Pages·2012·9.23 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Arduino Tutorials With LinkSprite Arduino Kit - Amazon S3

Arduino Tutorials With LinkSprite Arduino Kit LinkSprite September, 2012 1 / 45 Table of Content Experiment 1 Blinking LED ................................................................................... 3 Experiment 2 Experiment with Buzzer ................................................................... 6 Experiment 3 Experiment with Button ................................................................... 9 Experiment 4 Serial Port Communication ............................................................ 12 Experiment 5 Control LED Breathing Light Using PWM .......................................... 14 Experiment 6 Morse Code SOS Signal Generation ................................................. 17 Experiment 7 Morse Code Translation ................................................................. 20 Experiment 8 Electronic Dice Experiment using 7 LEDs .......................................... 24 Experiment 9 Traffic Lights ................................................................................. 28 Experiment 10 5V Digital Voltage Meter with Analog Input .................................... 31 Experiment 11 Potentimeter controlling the blinking frequency of LED ..................... 34 Expriment 12 Experiment with Tilt Sensor............................................................. 36 Experiment 13 Experiment with 7-seg LED ............................................................ 39 2 / 45 EEEExxxxppppeeeerrrriiiimmmmeeeennnntttt 1111 BBBBlllliiiinnnnkkkkiiiinnnngggg LLLLEEEEDDDD In the following, we begin our first experiment—blinking LED. The components used in this experiment are shown below: This experiment will need a 470ohm resister, one LED, 2 jump wires, and one breadboard. Schematics: 3 / 45 The long pin of LED iiss ppoossiittiivvee,, aanndd tthhee sshhoorrtt ppiinn iiss nneeggaattiivvee.. Wiring Diagram: TTThhheee pppooosssiiitttiiivvveee pppiiinnn ooofff LLLEEEDDD iiisss cccooonnnnnneeecccttteeeddd tttooo AAArrrddduuuiiinnnooo dddiiigggiiitttaaalll pppiiinnn 999,,, aaannnddd ttthhheee nnneeegggaaatttiiivvveee pppiiinnn ooofff LLLEEEDDD iiisss cccooonnnnnneeecccttteeeddd tttooo ttthhheee rrreeesssiiissstttooorrr... TTThhheee ooottthhheeerrr eeennnddd ooofff ttthhheee rrreeesssiiissstttooorrr iiisss cccooonnnnnneeecccttteeeddd tttooo GGGNNNDDD ooofff AAArrrddduuuiiinnnooo... 4 / 45 Arduino Code: int ledPin=9; //Configure the control digital IO pin void setup() { //set the mode of the digital IO pinto be OUTPUT pinMode(ledPin,OUTPUT); } void loop() { //Set ledpin to be HIGH, which is equal to 5V digitalWrite(ledPin,HIGH); delay(10); //Set the delay time, 2000 is about 2 seconds //Set ledpin to be LOW, which is equal to 0V digitalWrite(ledPin,LOW); delay(350); //Set the delay time, 2000 is about 2 seconds } 5 / 45 EEEExxxxppppeeeerrrriiiimmmmeeeennnntttt 2222 EEEExxxxppppeeeerrrriiiimmmmeeeennnntttt wwwwiiiitttthhhh BBBBuuuuzzzzzzzzeeeerrrr The components used in this experiment are shown below: The components are one buzzer, two jumper wires, and one breadboard. Schematics: 6 / 45 TTThhheee lllooonnnggg pppiiinnn ooofff ttthhheee bbbuuuzzzzzzeeerrr iiisss pppooosssiiitttiiivvveee,,, aaannnddd ttthhheee ssshhhooorrrttteeerrr ooonnneee iiisss nnneeegggaaatttiiivvveee... TTThhhiiisss iiisss aaalllsssooo mmmaaarrrkkkeeeddd ooonnn the bottom of the buzzer. Wiring Diagram: 7 / 45 The positive pin of the buzzer is wired to digital IO pin 7 of Arduino, and the negative pin is connected to GND of the Arduino. Arduino Code: int buzzer=7;//Configure the control digital IO pin void setup() { pinMode(buzzer,OUTPUT);//Set the mode of the digital IO pin to be OUTPUT } void loop() { unsigned char i,j;//Defined a variable while(1) { for(i=0;i<80;i++)//output a sound with a frequency { digitalWrite(buzzer,HIGH);//make a sound delay(1);//delay 1ms digitalWrite(buzzer,LOW);//silent delay(1);//delay 1 ms } for(i=0;i<100;i++)//Output a sound with another frequency { digitalWrite(buzzer,HIGH);//make a sound delay(2);//delay 2ms digitalWrite(buzzer,LOW);//silent delay(2);//delay2ms } } } 8 / 45 EEEExxxxppppeeeerrrriiiimmmmeeeennnntttt 3333 EEEExxxxppppeeeerrrriiiimmmmeeeennnntttt wwwwiiiitttthhhh BBBBuuuuttttttttoooonnnn The components used in this experiment are shown below: The components are one LED, one button, one 10K ohm resistor, one 470 ohm resistor, 5 jumper wires, and one breadboard. Schematics: 9 / 45 Wire Diagram: Arduino Code: int key=7;//Configure the button ON/OFF indicator digital IO pin, which is wired to LED void setup() { pinMode(key,OUTPUT);//Set the mode of the ON/OFF indicator digital IO pin to be OUTPUT } void loop() { int i;//define a variable while(1) { i=analogRead(5);//Read analog input port 5 if(i>1000)//if the value is larger than 1000(i.e., 4.88V) //set the indicator pin to be HIGH to turn on the LED 10 / 45

Description:
5 / 45 & ' int ledPin=9; //Configure the control digital IO pin void setup() { //set the mode of the digital IO pinto be OUTPUT pinMode(ledPin,OUTPUT);
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.