/**
* INF1 - Arduino Lab - Bit Operationen
* @author [email protected]
* @ref https://wolles-elektronikkiste.de/binaerlogik-und-portmanipulation
*/
/*
Logische Bitoperatoren und Shiftoperatoren
& logisches UND
| logisches ODER
^ exklusives ODER (XOR)
~ Negation (NICHT)
>> Rechtsshift
<< Linksshift
PORTD maps to Arduino digital pins 0 to 7
PD1 - PD5 reads Led1 (Rx 0) - Led5 (4) digital
https://docs.arduino.cc/hacking/software/PortManipulation
*/
void setup(){
DDRD = 0xFF; // setzt PIN 0 - 7 als Output Pins
PORTD = 0b10101010; // LEDs 1, 3, 5 und 7 sind ON
// AUFGABEN: wie verändern sich die LEDs ?
// zuerst überlegen, dann bestätigen indem Du
// Zeile um Zeile auskommentierst (also immer eine Zeile dazu!)
// PORTD |= 0b00000001;
// PORTD <<= PD1; // PD1 is 1 when LED 1 is ON otherwise 0
// PORTD |= (1 << PD3); // PD3 is 1 when LED 3 is ON otherwise 0
// PORTD = (PORTD >> 3);
// PORTD &= ~((1 << PD0) | (1 << PD2));
// PORTD = ~PORTD;
}
void loop() {
// nothing to loop
}