Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const int LED = 2;
const int button = 5;
void setup() {
// put your setup code here, to run once:
//pinMode(button, INPUT_PULLUP);
//pinMode(LED, OUTPUT);
DDRD = B00000100;
PORTD = B00100000;
}
void loop() {
//int reading = digitalRead(button);
//int reading = (PIND & (B00100000)) >> 5;
int reading = (PIND & (1 << 5)) >> 5;
if (reading){
//digitalWrite(LED, LOW);
//PORTD = PORTD & B11111011
PORTD = PORTD & ~(1 << 2);
}
else {
//digitalWrite(LED, HIGH);
//PORTD = PORTD | (B00000100);
PORTD = PORTD | (1<<2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.