Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. void button() {
  2. volatile uint8_t button = 0, oldButton = 1;
  3. volatile uint8_t toggle = 1;
  4. while(1) {
  5. button = (PINB & 128) >> 7;
  6.  
  7. if (oldButton == 1 && button == 0) {
  8. toggle ^= 1;
  9. }
  10.  
  11. oldButton = button;
  12.  
  13. LCDDR0 &= ~(1<<6 | 1 << 1);
  14. LCDDR0 = LCDDR0 | (1 << ((toggle) ? 6:1));
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement