|
int ust = 2;//A |
|
int solust = 3; //F |
|
int sagust = 4; //B |
|
int orta = 5; //G |
|
int solalt = 6; //E |
|
int sagalt = 7; //C |
|
int alt = 8; //D |
|
int nokta = 9; //DP |
|
void setup() |
|
{ |
|
Serial.begin(9600); |
|
pinMode(ust ,OUTPUT); |
|
pinMode(solust ,OUTPUT); |
|
pinMode(sagust ,OUTPUT); |
|
pinMode(orta ,OUTPUT); |
|
pinMode(solalt ,OUTPUT); |
|
pinMode(sagalt ,OUTPUT); |
|
pinMode(alt ,OUTPUT); |
|
pinMode(nokta ,OUTPUT); |
|
} |
|
void loop() |
|
{ |
|
char alinan = 0; |
|
if (Serial.available() > 0) |
|
{ |
|
alinan = Serial.read(); |
|
gosterge(alinan); |
|
} |
|
} |
|
void gosterge(char veri) |
|
{ |
|
if (veri == '1') |
|
{ |
|
Serial.println("1"); |
|
digitalWrite(ust, HIGH); |
|
digitalWrite(solust, HIGH); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, HIGH); |
|
digitalWrite(solalt, HIGH); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, HIGH); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '2') |
|
{ |
|
Serial.println("2"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, HIGH); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, LOW); |
|
digitalWrite(solalt, LOW); |
|
digitalWrite(sagalt, HIGH); |
|
digitalWrite(alt, LOW); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '3') |
|
{ |
|
Serial.println("3"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, HIGH); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, LOW); |
|
digitalWrite(solalt, HIGH); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, LOW); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '4') |
|
{ |
|
Serial.println("4"); |
|
digitalWrite(ust, HIGH); |
|
digitalWrite(solust, LOW); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, LOW); |
|
digitalWrite(solalt, HIGH); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, HIGH); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '5') |
|
{ |
|
Serial.println("5"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, LOW); |
|
digitalWrite(sagust, HIGH); |
|
digitalWrite(orta, LOW); |
|
digitalWrite(solalt, HIGH); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, LOW); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '6') |
|
{ |
|
Serial.println("6"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, LOW); |
|
digitalWrite(sagust, HIGH); |
|
digitalWrite(orta, LOW); |
|
digitalWrite(solalt, LOW); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, LOW); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '7') |
|
{ |
|
Serial.println("7"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, HIGH); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, HIGH); |
|
digitalWrite(solalt, HIGH); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, HIGH); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '8') |
|
{ |
|
Serial.println("8"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, LOW); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, LOW); |
|
digitalWrite(solalt, LOW); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, LOW); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '9') |
|
{ |
|
Serial.println("9"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, LOW); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, LOW); |
|
digitalWrite(solalt, HIGH); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, LOW); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
else if (veri == '0') |
|
{ |
|
Serial.println("0"); |
|
digitalWrite(ust, LOW); |
|
digitalWrite(solust, LOW); |
|
digitalWrite(sagust, LOW); |
|
digitalWrite(orta, HIGH); |
|
digitalWrite(solalt, LOW); |
|
digitalWrite(sagalt, LOW); |
|
digitalWrite(alt, LOW); |
|
digitalWrite(nokta, HIGH); |
|
} |
|
} |