Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created July 12, 2020 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/1c0022579329665c0abe2f47c9aecf81 to your computer and use it in GitHub Desktop.
Save JeffersGlass/1c0022579329665c0abe2f47c9aecf81 to your computer and use it in GitHub Desktop.
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