www.sainsmart.com
Arduino Introduction
Overview
What is Arduino?
Arduino is a tool for making computers that can sense and control more of the physical world
than your desktop computer. It's an open-source physical computing platform based on a simple
microcontroller board, and a development environment for writing software for the board.
Arduino can be used to develop interactive objects, taking inputs from a variety of switches or
sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects
can be stand-alone, or they can be communicated with software running on your computer (e.g.
Flash, Processing, MaxMSP.) The boards can be assembled by hand or purchased preassembled;
the open-source IDE can be downloaded for free.
The Arduino programming language is an implementation of Wiring, a similar physical computing
platform, which is based on the Processing multimedia programming environment.
Feature
Schematic design of the open source development interface free download, and also
according to the needs of their own changes
Download the program is simple and convenient.
Simply with the sensor, a wide range of electronic components connection (such as: LED
light, buzzer, keypad, photoresistor, etc.), make all sorts of interesting things.
Using the high-speed micro-processing controller (ATMEGA328).
The development of language and development environment is very simple, easy to
understand, very suitable for beginners to learn.
Performance
Digital I/O 0~13.
Analog I/O 0~5.( R3 is 0~7 )
Suppor
Input voltage: when connected to the USB without external power supply or external 5 v
output and external power input.
Atmel Atmega328 micro-processing controller. Because of its many supporters, the
company has developed 32-
Arduino size: width of 70 mm X high 54 mm.
Special Port
1. VIN. The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
supply voltage through this pin, or, if supplying voltage via the power jack, access it through
this pin.
2. AREF. Reference voltage for the analog inputs. Used with analogReference().
SainSmart UNO R3
What’ s UNO R3?
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic
resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains
everything needed to support the microcontroller; simply connect it to a computer with a USB
cable or power it with a AC-to-DC adapter or battery to get started.
Performance
Revision 3 is the last SainSmart UNO development board version.
Parameter
3.3V/5V Supply Voltage and IO Voltage can be switched at the same time.
More 3.3V modules supported, such as Xbee module, Bluetooth module, RF module, GPRS
module, GPS module, LCD5110 Backlight and so on, but the original version can only support
5V IO.
Controller uses SMD MEGA328P-AU chip. Add A6/A7 port.
5V Electric current : 500MA
3.3V Electric current : 50MA
Input Voltage: 7-12V
Improvement of R3
Working voltage 3.3V/5V is optional.
Arduino can only work at 5V voltage. When it comes to 3.3V Level module, IO can’t be
connected to it. The Level should be changed, like the SD card, Bluetooth module and so on.
Sainsmart UNO R3 can work at 3.3V voltage by switching on the button. At this time, IO port
is 3.3V and it can work with 3.3V Level module. (R3 can directly use the electronic building
blocks on I / O port and elicit G, V, S)
SainSmart MEGA2560 R3
Description:
This is the new MEGA2560 R3. In addition to all the features of the previous board, the MEGA
now uses an ATMega16U2 instead of the ATMega8U2 chip. This allows for faster transfer rates
and more memory. No drivers needed for Linux or Mac (inf file for Windows is needed and
included in the Arduino IDE), and the ability to have the Uno show up as a keyboard, mouse,
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
joystick, etc.
The MEGA2560 R3 also adds SDA and SCL pins next to the AREF. In addition, there are two new
pins placed near the RESET pin. One is the IOREF that allow the shields to adapt to the voltage
provided from the board. The other is a not connected and is reserved for future purposes. The
MEGA2560 R3 works with all existing shields but can adapt to new shields which use these
additional pins.
Features:
*Microcontroller ATmega2560
*Operating Voltage 5V
*Input Voltage (recommended) 7-12V
*Input Voltage (limits) 6-20V
*Digital I/O Pins 54 (of which 15 provide PWM output)
*Analog Input Pins 16
*DC Current per I/O Pin 40 mA
*DC Current for 3.3V Pin 50 mA
*Flash Memory 256 KB of which 8 KB used by bootloader
*SRAM 8 KB
*EEPROM 4 KB
*Clock Speed 16 MHz
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Arduino C Grammar
Arduino grammar is built on the basis of C/C + +, in fact is also the basic C grammar, Arduino
grammar not only put some related parameters Settings are function change, we have no need to
understand his bottom, let us to know AVR micro control unit (MCU) friend can also easy to fit in.
So here I'll simple comment the Arduino grammar.
Control Structures
If
if...else
for
switch case
while
do... while
break
continue
return
goto
Further Syntax
;
{}
//
/* */
Operators
++
--
+=
-=
*=
/=
=
+
-
*
/
%
==
!=
<
>
<=
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
>=
&&
||
!
Data type
boolean
char
byte
int
unsigned int
long
unsigned long
float
double
string
array
void
Constant
HIGH | LOW Said digital IO port level, HIGH Said high level(1), LOW Said low electric
flat(0).
INPUT | OUTPUT Said digital IO port direction, INPUT Said input (high impedance state)
OUTPUT Said output (AVR can provide 5 v voltage and ma current).
TURE | FALSE true(1) , false(0) .
All above are the basic c grammar words and symbols, everybody can understand, and the
specific use can combine experimental procedure.
Structure
void setup()
The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start
using libraries, etc. The setup function will only run once, after each power up or reset of the
Arduino board.
void loop()
After creating a setup() function, which initializes and sets the initial values, the loop() function
does precisely what its name suggests, and loops consecutively, allowing your program to change
and respond. Use it to actively control the Arduino board.
Function
Digital I/O
pinMode(pin, mode) pin 0~13, mode is input or output.
digitalWrite(pin, value) pin 0~13, value is HIGH or LOW.
int digitalRead(pin) pin 0~13, value is HIGH or LOW.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Analog I/O
int analogRead(pin) pin 0~5.
analogWrite(pin, value) pin 3, 5, 6, 9, 10, 11, value is 0 to 255
Time
delay(ms)Pauses the program for the amount of time (in miliseconds) specified as parameter.
(There are 1000 milliseconds in a second.)(unit ms).
delayMicroseconds(us)
Math
min(x, y) minimum value
max(x, y) maximum value
abs(x) absolute value
constrain(x, a, b) Constraint function, lower limit a upper limit b, x must be between a & b to be
returned
map(value, fromLow, fromHigh, toLow, toHigh)
pow(base, exponent) extraction of square root
sq(x) square
sqrt(x) Square root
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
void setup()
{
Serial.begin(9600);// opens serial port, sets data rate to 9600 bps
Serial.println("Hello World!");
}
void loop()
{
}
Chapter 1 Hello World!
In this chapter, we will learn use Arduino IDE serial interface tools to show the contents that we
want to display in the computer.
Example code:
Explain:
Serial.begin(9600); The comment says 9600 bps, and just so you know bps stands for
bits-per-second (we will refer to this as the baud rate). Communicate with computer, you may
choose these rate “300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200”.
Operation:
1) Download code to arduino.
2) After download, click “tool”, pick up relevant arduino board, and relevant com. Then click
“serial Monitor”, on the new open up window’s bottom right, choose the relevant rate.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
int ledPin = 13; //define pin 13
void setup()
{
pinMode(ledPin, OUTPUT);//define interface is output
}
Chapter 2 Blink LED
Small LED lamp experiment is the basis of comparison of the experimental one, this time we use
the motherboard comes with 13 feet of LED lights to complete the experiment, the experimental
equipment we need is the Arduino which each experiment must have and USB download cable.
Next we connect small lamp in accordance with the following experimental schematic physical
map.
Accordance with the good circuit after the link above figure, you can start writing programs, and
we let the small LED lights flashing. Lighting on for one second and off for one second. This
program is very simple. This is Arduino own routines Blink.
Example code:
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
void loop()
{
digitalWrite(ledPin, HIGH); //light up led lamp
delay(1000); //delay 1s
digitalWrite(ledPin, LOW); //go out led lamp
delay(1000); // delay 1s
}
After downloading the program, you can see our 13-foot LED lights flashing, so that our small
lights flicker experiment is complete.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Chapter3 LED Blink
light emitting diode
What’ s light emitting diode?
The light emitting diode referred to as LED. By gallium (Ga) and arsenic (AS) and phosphorus (P)
made of a compound of the diode, when the electron and hole recombination can radiate visible
light, and thus can be used to prepare a light-emitting diode in the circuit and the instrument as
the indicator, or the composition of the text or digital display. Ga As P diode hair red, gallium
phosphide diode green silicon carbide diode yellow.
A flashing LED lights experiment
Experiment component
LED lamp : 1
220Ω resistor : 1
Breadboard & Jumper wires
Connect your circuit as the below diagram
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
int ledPin=8; //set IO pin of LED in control
void setup()
{
pinMode(ledPin,OUTPUT);//set digital pin IO is OUTPUT
}
void loop()
{
digitalWrite(ledPin,HIGH); //set PIN8 is HIGH , about 5V
delay(1000); //delay 1000ms, 1000ms = 1s
digitalWrite(ledPin,LOW); //set PIN8 is LOW, 0V
delay(1000); //delay 1000ms, 1000ms = 1s
}
Example code:
setup()
The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start
using libraries, etc. The setup function will only run once, after each powerup or reset of the
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Arduino board.
loop()
After creating a setup() function, which initializes and sets the initial values, the loop() function
does precisely what its name suggests, and loops consecutively, allowing your program to change
and respond. Use it to actively control the Arduino board.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Chapter4 PWM
What’ s PWM?
Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means.
Digital control is used to create a square wave, a signal switched between on and off. This on-off
pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the
portion of the time the signal spends on versus the time that the signal spends off. The duration
of "on time" is called the pulse width. To get varying analog values, you change, or modulate, that
pulse width. If you repeat this on-off pattern fast enough with an LED for example, the result is as
if the signal is a steady voltage between 0 and 5v controlling the brightness of the LED.
In the graphic below, the green lines represent a regular time period. This duration or period is
the inverse of the PWM frequency. In other words, with Arduino's PWM frequency at about
500Hz, the green lines would measure 2 milliseconds each. A call to analogWrite() is on a scale of
0 - 255, such that analogWrite(255) requests a 100% duty cycle (always on), and analogWrite(127)
is a 50% duty cycle (on half the time) for example.
For the Arduino, you write a value from 0 to 255 on a PWM pin, and the Arduino library will
cause the pin to output a PWM signal whose on time is in proportion to the value written.
When it comes time for us to actually write an output voltage, the 0-255 value lacks meaning.
What we want is many cases is a voltage. For our purposes, we will assume the Arduino is
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
running at Vcc = 5 volts. In that case, a value of 255 will also be 5 volts. We can then easily
convert the desired voltage to the digital value needed using simple division. We first divide the
voltage we want by the 5 volts maximum. That gives us the percentage of our PWM signal. We
then multiply this percentage by 255 to give us our pin value. Here is the formula:
Pin Value (0-255) = 255 * (AnalogWrite / 5);
Arduino use analogWrite()
analogWrite() : Writes an analog value (PWM wave) to a pin. Can be used to light a LED at
varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will
generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a
call to digitalRead() or digitalWrite() on the same pin). The frequency of the PWM signal is
approximately 490 Hz.
On most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins
3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 through 13. Older Arduino boards
with an ATmega8 only support analogWrite() on pins 9, 10, and 11.The Arduino Due supports
analogWrite() on pins 2 through 13, plus pins DAC0 and DAC1. Unlike the PWM pins, DAC0 and
DAC1 are Digital to Analog converters, and act as true analog outputs.You do not need to call
pinMode() to set the pin as an output before calling analogWrite().The analogWrite function has
nothing to do with the analog pins or the analogRead function.
Syntax
analogWrite(pin, value)
Parameters
pin: the pin to write to.
value: the duty cycle: between 0 (always off) and 255 (always on).
Notes and Known Issues
The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is
because of interactions with the millis() and delay() functions, which share the same internal
timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle
settings (e.g 0 - 10) and may result in a value of 0 not fully turning off the output on pins 5 and 6.
Experiment component:
1. 1 x 22oΩ resistor
2. 1 x LED
3. 1 x Breadboard
Connect your circuit as the below diagram.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
int brightness = 0; //define original value of brightness, the value is brightness of LED.
int fadeAmount = 5; //define fadeAmount, the value is the amount of brightness variations’
change.
void setup() {
pinMode(9, OUTPUT);// set pin9 is output
}
void loop() {
analogWrite(9, brightness);//write the value of brightness in pin9
brightness = brightness + fadeAmount;//change the value of brightness
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ; // roll over the brightness between the highest and
lowest
}
delay(30); //delay 30ms
}
Example code:
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Chapter5 Advertising LED
Experiment component:
LED lamp: 6
220Ω resistors: 6
Breadboard & Jumper wires
Connect your circuit as the below diagram.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
//set in Led’s digital IO pin control
int Led1 = 1;
int Led2 = 2;
int Led3 = 3;
int Led4 = 4;
int Led5 = 5;
int Led6 = 6;
//led lamp run the example 1 program
void style_1(void)
Example code
Program code is in the advertising lights program folder. Double-click to open and you will see a
led2 folder, open it, you will find out a led2.pde file. Double-click the icon to open it. Then you
will see that it is the arduino programming software window with the experimental program
code.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
{
unsigned char j;
for(j=1;j<=6;j++)//every 200ms light up one of led lamps with 1~6 pin in turn
{
digitalWrite(j,HIGH);//light up the led lamps with j pin
delay(200);//delay 200ms
}
for(j=6;j>=1;j--)//every 200ms got out one of led lamps with 6~1 pin in turn
digitalWrite(j,LOW);//go out the led lamps with j pin
delay(200);//delay 200ms
}
}
//led lamp blink example program
void flash(void)
{
unsigned char j,k;
for(k=0;k<=1;k++)//blink twice
{
for(j=1;j<=6;j++)//light up led lamps with 1~6 pin
digitalWrite(j,HIGH);//light up led lamp with j pin
delay(200);//delay 200ms
for(j=1;j<=6;j++)//go out the led lamp with 1~6 pin
digitalWrite(j,LOW);//go out the led lamp with j pin
delay(200);//delay 200ms
}
}
//led lamp run the example 2 program
void style_2(void)
{
unsigned char j,k;
k=1;//set k is 1
for(j=3;j>=1;j--)
{
digitalWrite(j,HIGH);//light up
digitalWrite(j+k,HIGH);//light up
delay(400);//delay 400ms
k +=2;//k plus 2
}
k=5;//set k is 5
for(j=1;j<=3;j++)
{
digitalWrite(j,LOW);//go out
digitalWrite(j+k,LOW);//go out
delay(400);//delay 400ms
Copyright © 2013 SainSmart All Rights Reserved
k -=2;//k sub 2
}
}
// led lamp run the example 3 program
void style_3(void)
{
unsigned char j,k;//led lamp run the example 3 program
k=5;//set k is 5
for(j=1;j<=3;j++)
{
digitalWrite(j,HIGH);//light up
digitalWrite(j+k,HIGH);//light up
delay(400);//delay 400ms
digitalWrite(j,LOW);//go out
digitalWrite(j+k,LOW);//go out
k -=2;//k sub 2
}
k=3;//set k is 3
for(j=2;j>=1;j--)
{
digitalWrite(j,HIGH);//light up
digitalWrite(j+k,HIGH);//light up
delay(400);//delay 400ms
digitalWrite(j,LOW);//go out
digitalWrite(j+k,LOW);//go out
k +=2;//k plus 2
}
}
void setup()
{
unsigned char i;
for(i=1;i<=6;i++)//set 1~6 pin output in turn
pinMode(i,OUTPUT);//set i pin output
}
void loop()
{
style_1();//example 1
flash();//blink
style_2();//example 2
flash();//blink
style_3();//example 3
flash();//blink
}
Example code used: for(i=1;i<=6;i++)//set 1~6 pin output in turn
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
www.sainsmart.com
pinMode(i,OUTPUT);//set i pin output
The “ for” statement is used to repeat a block of statements enclosed in curly braces. An
increment counter is usually used to increment and terminate the loop. The for statement is
useful for any repetitive operation, and is often used in combination with arrays to operate on
collections of data/pins.
There are three parts to the for loop header:
for (initialization; condition; increment) {
//statement(s);
}
The initialization happens first and exactly once. Each time through the loop, the condition is
tested; if it's true, the statement block, and the increment is executed, then the condition is
tested again. When the condition becomes false, the loop ends.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
int ledred=10; //define digital pin10 red
int ledyellow=7; //define digital pin7 yellow
int ledgreen=4; //define digital pin4 green
void setup()
{
pinMode(ledred,OUTPUT);//set red pin output
pinMode(ledyellow,OUTPUT);// set yellow pin output
pinMode(ledgreen,OUTPUT);// set green pin output
}
void loop()
{
digitalWrite(ledred,HIGH);//light up red lamp
delay(1000);//delay 1000 ms = 1 s
digitalWrite(ledred,LOW);//go out red lamp
Chapter6 Traffic light
Experiment component:
Red , Green , Yellow led lamp: 3
220Ω resistor: 3
Breadboard & Jumper wires
Connect your circuit as the below diagram.
Example code:
Program code is in the traffic lights program folder. Double-click to open and you will find out a
trafficLed.pde file. Double-click the icon to open it. Then you will see that it is the arduino
programming software window with the experimental program code.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
digitalWrite(ledyellow,HIGH);//light up yellow lamp
delay(200);//delay 200 ms//
digitalWrite(ledyellow,LOW);//go out
digitalWrite(ledgreen,HIGH);//light up green lamp
delay(1000);//delay 1000 ms
digitalWrite(ledgreen,LOW);//go out
}
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Chapter7 Buzzer
What’ s buzzer?
The buzzer is one integrated electronic transducers, DC voltage supply, widely used in computers,
printers, copiers, alarm, electronic toys, automotive electronic equipment, telephones, timers
and other electronic products for sound devices.
They can be divided into the: active buzzer (containing driver line) and passive buzzer (external
drive) in their drive different way, teach you to distinguish between active buzzer and passive
buzzer. A small buzzer for sale on the market now because of its small size (diameter is only
11mm), light weight, low price, solid structure, while widely used in various electrical equipment
with sound, electronic production and microcontroller circuits. Appearance of active the buzzer
and passive buzzer like a, b shown. a) active b) passive.
From the figure a, b appearance watching, the two buzzers seems to the same, but a closer look,
the height of the two slight difference active buzzer a height of 9mm, passive buzzer b, a height
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
of 8 mm. As facing up to two buzzers’ pin County it can be seen that there are a green circuit
board is passive buzzer, no circuit board using vinyl enclosed one is active buzzer. Further
determine the active and passive buzzer multimeter resistance profile Rxl file test: use a black
pen touch buzzer’s pin "+", red pen touch in the other pin back and forth, If you feel a click,
cracking sound and resistance is only 8Ω
(Or 16Ω) which is a passive buzzer; continuing sound can issue, and the resistance is more than
hundreds of Europe that is active buzzer. Active buzzer directly connected to the rated power
(indicate on the new buzzer’s label) can be continuous sound; rather passive buzzer and
electromagnetic speaker needs to be connected to the audio output circuit can vocalization.
Buzzer also can be divided into according to the constructed different,: the electromagnetic
buzzer and piezoelectric buzzer;
Connect your circuit as the below diagram.
The buzzer used in this experiment with the internal drive. Circuit the buzzer positive connect
directly into the digital port 13. GND socket connected to the negative terminal of the buzzer.
Buzzer analog ambulance siren sound experiment
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
int buzzer=7;//set buzzer’ s digital pin IO in control
void setup()
{
pinMode(buzzer,OUTPUT);//set digital pin IO OUTPUT
}
void loop()
{
unsigned char i,j;//define i j
while(1)
{
for(i=0;i<80;i++)// Output a frequency of sound
Experiment component:
Buzzer : 1
Breadboard & Jumper wires
Connect your circuit as the below diagram.
Example code
Copyright © 2013 SainSmart All Rights Reserved
{
digitalWrite(buzzer,HIGH);//sound
delay(1);//delay 1ms
digitalWrite(buzzer,LOW);//mute
delay(1);//delay 1ms
}
for(i=0;i<100;i++)// Output the other frequency of sound
{
digitalWrite(buzzer,HIGH);//sound
delay(2);//delay 2ms
digitalWrite(buzzer,LOW);//mute
delay(2);//delay 2ms
}
}
}
while loops
Description
while loops will loop continuously, and infinitely, until the expression inside the parenthesis, ()
becomes false. Something must change the tested variable, or the while loop will never exit. This
could be in your code, such as an incremented variable, or an external condition, such as testing a
sensor.
Syntax
while(expression){
// statement(s)
}
Parameters
expression - a (boolean) C statement that evaluates to true or false
Example
var = 0;
while(var < 200){
// do something repetitive 200 times
var++;
}
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
www.sainsmart.com
Chapter8 Tilt switch
What’ s Tilt Sensor?
The tilt sensor is a component that can detect the tilting of an object. However it is only the
equivalent to a pushbutton activated through a different physical mechanism. This type of sensor
is the environmental-friendly version of a mercury-switch. It contains a metallic ball inside that
will commute the two pins of the device from on to off and viceversa if the sensor reaches a
certain angle.
Tilt switch controls led lamp light & out
Experiment component:
Tilt sensor : 1
Breadboard & Jumper wires
Connect your circuit as the below diagram.
Tilt switch connect to analog pin.
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
Example code
Copyright © 2013 SainSmart All Rights Reserved
www.sainsmart.com
{
pinMode(8,OUTPUT);//set pin8 output
}
void loop()
{
int i;//define i
while(1)
{
i=analogRead(5);//read voltage values of pin5
if(i>200)//if more than 512( 2.5V)
{
digitalWrite(8,HIGH);//light up led lamp
}
else
{
digitalWrite(8,LOW);//go out led lamp
}
}
}
Copyright © 2013 SainSmart All Rights Reserved