-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ino.ino
49 lines (42 loc) · 967 Bytes
/
test.ino.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
int array[] = {2,3,4,5,6,7,8,9,10,11,12,13};
int i = 0;
void setup() {
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
byte byteRead;
/* check if data has been sent from the computer: */
if (Serial.available()) {
/* read the most recent byte */
byteRead = Serial.read();
//You have to subtract '0' from the read Byte to convert from text to a number.
//byteRead=byteRead-'0';
//Turn off all LEDs if the byte Read = 0
if(byteRead=='0'){
digitalWrite(array[i], LOW);
//delay(1000);
}
//Turn LED ON depending on the byte Read.
else{
digitalWrite(array[i], HIGH);
//delay(1000);// set the LED on
}
i=i+1;
if(i==12){
delay(5000);
i=0;
}
}}