|
int a=2;
int b=3;
int c=4;
int d=5;
int e=6;
int f=7;
int g=8;
int dp=9;
char number;
void dis1() {
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(a, LOW);
digitalWrite(g, LOW);
digitalWrite(d, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
}
void dis2() {
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(g, HIGH);
digitalWrite(e, HIGH);
digitalWrite(d, HIGH);
digitalWrite(f, LOW);
digitalWrite(c, LOW);
}
void dis3() {
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(g, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(f, LOW);
digitalWrite(e, LOW);
}
void dis4() {
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(c, HIGH);
digitalWrite(b, HIGH);
digitalWrite(a, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
}
void dis5() {
digitalWrite(a, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(b, LOW);
digitalWrite(e, LOW);
}
void dis6() {
digitalWrite(a, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(b, LOW);
}
void dis7() {
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(e, LOW);
digitalWrite(d, LOW);
}
void dis8() {
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
}
void dis9() {
digitalWrite(a, HIGH);
digitalWrite(d, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(g, HIGH);
digitalWrite(f, HIGH);
digitalWrite(e, LOW);
}
void dis0() {
digitalWrite(a, HIGH);
digitalWrite(d, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(f, HIGH);
digitalWrite(e, HIGH);
digitalWrite(g, LOW);
}
void AC() {
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
}
void setup() {
pinMode(a,OUTPUT);
digitalWrite(a,LOW);
pinMode(b,OUTPUT);
digitalWrite(b,LOW);
pinMode(c,OUTPUT);
digitalWrite(c,LOW);
pinMode(d,OUTPUT);
digitalWrite(d,LOW);
pinMode(e,OUTPUT);
digitalWrite(e,LOW);
pinMode(f,OUTPUT);
digitalWrite(f,LOW);
pinMode(g,OUTPUT);
digitalWrite(g,LOW);
pinMode(dp,OUTPUT);
digitalWrite(dp,LOW);
Serial.begin(9600);
}
void loop() {
if(!(Serial.available()==0)){
number=Serial.read();
switch(number){
case 0:{
dis0();
}
case 1:{
dis1();
}
case 2:{
dis2();
}
case 3:{
dis3();
}
case 4:{
dis4();
}
case 5:{
dis5();
}
case 6:{
dis6();
}
case 7:{
dis7();
}
case 8:{
dis8();
}
case 9:{
dis9();
}
}
}
} |
|