// Tom Karle Bitoperation Tastersteuerung 29.04.2022
int ledpins []={6,7,8,9,10,11,12,13};
int taster []={2,3};
byte taster1 = 0;
byte taster2 = 0;
byte zaehler = B00000000;
//---------------------------------------------------------------------
void setup() {
Serial.begin(9600);
for(int i =0; i<8; i++){
pinMode(i, OUTPUT);
}
for(int j =0; j<2; j++){
pinMode(j, INPUT);
}
}
//----------------------------------------------------------------------
void loop() {
taster1 = digitalRead(taster[0]);
if(zaehler != B11111111)
{
zaehler += 1;
for(int k =0; k<8; k++){
digitalWrite(ledpins[k],bitRead(zaehler,k));
}
Serial.print("Dezimal=");
Serial.println(zaehler);
Serial.print("Binär=");
Serial.println(zaehler,BIN);
delay(500);
}else if (zaehler == B11111111){
zaehler = B00000000;
}
//taster noch nicht implementiert
if(taster1==1){
zaehler = B00000000;
}
}