/* Secret Maze v2 - see http://www.technoblogy.com/show?20IY David Johnson-Davies - www.technoblogy.com - 14th March 2018 ATtiny85 @ 1 MHz (internal oscillator; BOD disabled) CC BY 4.0 Licensed under a Creative Commons Attribution 4.0 International license: http://creativecommons.org/licenses/by/4.0/ */ volatile int Lights, Buttons = 0; volatile int Row = 0; // The Maze ********************************************** // Maze definition const int Startx = 8, Starty = 7; const int Goalx = 2, Goaly = 7; unsigned int Maze[16] = { 0xFFFF, 0x8811, 0xAEF5, 0x8011, 0xF7C7, 0x9435, 0xA5A5, 0xA8A9, 0x8B85, 0xA83D, 0xAFE1, 0xE06F, 0x8B01, 0xAAF5, 0x8811, 0xFFFF }; // Get one bit in the maze: 0,0 is top right int Bit (int x, int y) { return Maze[y]>>x & 1; } // Returns the walls around x,y int Look (int x, int y) { return Bit(x, y+1)<<3 | Bit(x+1, y)<<2 | Bit(x-1, y)<<1 | Bit(x, y-1); } // Tiny Tone ********************************************** const int Output = 4; const int Clock = 0; // 1 MHz const uint8_t scale[] PROGMEM = {239,226,213,201,190,179,169,160,151,142,134,127}; void note (int n, int octave) { int prescaler = 8 + Clock - (octave + n/12); if (prescaler<1 || prescaler>15 || octave==0) prescaler = 0; DDRB = (DDRB & ~(1<