User manual

www.sainsmart.com
Copyright © 2013 SainSmart All Rights Reserved
{
digitalWrite(dataPin,LOW);
}
digitalWrite(clockPin,HIGH);
delay(1);
digitalWrite(clockPin,LOW);
}
digitalWrite(latchPin,HIGH);
}
int bits[] = {B00000001,B00000010,B00000100,B00001000,B00010000,B00100000,
B01000000,B10000000};
int masks[] = {B11111110,B11111101,B11111011,B11110111,B11101111,B11011111,
B10111111,B01111111};
void changeLED(int led,int state)
{
ledState = ledState & masks[led];
if(state == ON){ ledState = ledState|bits[led]; }
updateLEDs(ledState);
}
Downloaded the program into the control panel, we can see the wonderful scene of small
lights flashing.
In the connection circuit process, we should pay attention to the clear relay pin position. What’s
more, the IN4001 diodes are divided into positive and negative. Do not look at the relay circuit is
slightly complex, but the kiev program is very simple. The relay is digital signal module. By
opening and closing of the relay to the transistor digital signal to control high-power devices. We
use LED lights as a high-power devices here.
In program, we use digital port 8 to output high and delay for one second, one second output low,
like the switch off for one second and then turned on one second.
Code
int relayPin = 8 ;// define digital port 8, connected to the transistor base
void setup()
{
pinMode(relayPin,OUTPUT);// define relayPin port to be output mode
}
void loop()
{
digitalWrite(relayPin,HIGH);// drive relay closes conduction
delay(1000);//delay one second
digitalWrite(relayPin,LOW);//drive relay off
delay(1000);//delay one second
}