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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
| int a=7; int b=6; int c=5; int d=11; int e=10; int f=8; int g=9; int dp=4;
void digital_1(void) { unsigned char j; digitalWrite(c,LOW); digitalWrite(b,LOW); for(j=7;j<=11;j++) digitalWrite(j,HIGH); digitalWrite(dp,HIGH); }
void digital_2(void) { unsigned char j; digitalWrite(b,LOW); digitalWrite(a,LOW); for(j=9;j<=11;j++) digitalWrite(j,LOW); digitalWrite(dp,HIGH); digitalWrite(c,HIGH); digitalWrite(f,HIGH); }
void digital_3(void) { unsigned char j; digitalWrite(g,LOW); digitalWrite(d,LOW); for(j=5;j<=7;j++) digitalWrite(j,LOW); digitalWrite(dp,HIGH); digitalWrite(f,HIGH); digitalWrite(e,HIGH); }
void digital_4(void) { digitalWrite(c,LOW); digitalWrite(b,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); digitalWrite(dp,HIGH); digitalWrite(a,HIGH); digitalWrite(e,HIGH); digitalWrite(d,HIGH); }
void digital_5(void) { unsigned char j; for(j=7;j<=9;j++) digitalWrite(j,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(dp,HIGH); digitalWrite(b,HIGH); digitalWrite(e,HIGH); }
void digital_6(void) { unsigned char j; for(j=7;j<=11;j++) digitalWrite(j,LOW); digitalWrite(c,LOW); digitalWrite(dp,HIGH); digitalWrite(b,HIGH); }
void digital_7(void) { unsigned char j; for(j=5;j<=7;j++) digitalWrite(j,LOW); digitalWrite(dp,HIGH); for(j=8;j<=11;j++) digitalWrite(j,HIGH); }
void digital_8(void) { unsigned char j; for(j=5;j<=11;j++) digitalWrite(j,LOW); digitalWrite(dp,HIGH); } void setup() { int i; for(i=4;i<=11;i++) pinMode(i,OUTPUT); } void loop() { while(1) { digital_1(); delay(2000); digital_2(); delay(2000); digital_3(); delay(2000); digital_4(); delay(2000); digital_5(); delay(2000); digital_6(); delay(2000); digital_7(); delay(2000); digital_8(); delay(2000); } }
|