Skip to content

Instantly share code, notes, and snippets.

@ayhanbaris
Created March 1, 2021 10:07
Show Gist options
  • Save ayhanbaris/bb95de18db74cb44b0723ed6ab56ff19 to your computer and use it in GitHub Desktop.
Save ayhanbaris/bb95de18db74cb44b0723ed6ab56ff19 to your computer and use it in GitHub Desktop.
arduino 7 segment sayı (0-9) yazma fonksiyonu
void SayiYaz(int sayi){
switch(sayi)
{
case 0:
digitalWrite(E,LOW);
digitalWrite(D,LOW);
digitalWrite(C,LOW);
digitalWrite(B,LOW);
digitalWrite(A,LOW);
digitalWrite(F,LOW);
digitalWrite(G,HIGH);
break;
case 1:
digitalWrite(E,HIGH);
digitalWrite(D,HIGH);
digitalWrite(C,LOW);
digitalWrite(B,LOW);
digitalWrite(A,HIGH);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
break;
case 2:
digitalWrite(E,LOW);
digitalWrite(D,LOW);
digitalWrite(C,HIGH);
digitalWrite(B,LOW);
digitalWrite(A,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,LOW);
break;
case 3:
digitalWrite(E,HIGH);
digitalWrite(D,LOW);
digitalWrite(C,LOW);
digitalWrite(B,LOW);
digitalWrite(A,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,LOW);
break;
case 4:
digitalWrite(E,HIGH);
digitalWrite(D,HIGH);
digitalWrite(C,LOW);
digitalWrite(B,LOW);
digitalWrite(A,HIGH);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
break;
case 5:
digitalWrite(E,HIGH);
digitalWrite(D,LOW);
digitalWrite(C,LOW);
digitalWrite(B,HIGH);
digitalWrite(A,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
break;
case 6:
digitalWrite(E,LOW);
digitalWrite(D,LOW);
digitalWrite(C,LOW);
digitalWrite(B,HIGH);
digitalWrite(A,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
break;
case 7:
digitalWrite(E,HIGH);
digitalWrite(D,HIGH);
digitalWrite(C,LOW);
digitalWrite(B,LOW);
digitalWrite(A,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
break;
case 8:
digitalWrite(E,LOW);
digitalWrite(D,LOW);
digitalWrite(C,LOW);
digitalWrite(B,LOW);
digitalWrite(A,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
break;
case 9:
digitalWrite(E,HIGH);
digitalWrite(D,LOW);
digitalWrite(C,LOW);
digitalWrite(B,LOW);
digitalWrite(A,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment