25/06/2015
24
{1,0,0,0,1,0,0,1},//5
25
{1,0,0,0,0,0,0,1},//6
26
{0,0,1,1,1,1,0,1},//7
27
{0,0,0,0,0,0,0,1},//8
28
{0,0,0,0,1,1,0,1} //9
29
};
30
31
void
numberShow(int
32
for(int
pin = 2; pin <= 9 ; pin++){
33
digitalWrite(pin, number[i][pin ‐ 2]);
34
}
35
}
36
37
void
setup(){
38
Serial.begin(9600);
39
irrecv.enableIRIn();
40
41
for(int
pin = 2 ; pin <= 9 ; pin++){
42
pinMode(pin, OUTPUT);
43
digitalWrite(pin, HIGH);
44
}
45
}
46
47
void
loop() {
48
if
(irrecv.decode(&results)) {
49
for(int
i = 0; i <= 11; i++){
50
51
if(results.value == codes[i]&& i <= 9){
52
numberShow(i); // display number 0~9 on the digital control
53
currentNumber = i;
54
Serial.println(i);
55
break;
56
}
57
58
else
if(results.value == codes[10]&& currentNumber != 0){
59
currentNumber‐‐;
60
numberShow(currentNumber);
61
Serial.println(currentNumber);
62
break;
63
}
64
65
//
66
else
if(results.value == codes[11]&& currentNumber != 9){
67
currentNumber++;
68
numberShow(currentNumber);
http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100
DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki
i) { //this function is used to display numbers
22/23
Need help?
Do you have a question about the DFR0100 and is the answer not in the manual?