// Shamelessly copied and modified from Rob Hart's instructional code, which itself was shamelessly copied and modified from the code of Neil Gershenfeld. // // // Button PA2 (pin 11). // Red LED PA3 (pin 10). // Green LED PB2 (pin 5). Also OC0A. // Blue LED PA7 (pin 6). Also OC0B. // // See page 50 of Elliot William's Make: AVR Programming book for a rundown on PORTx, DDRx, and PINx registers. #include //this includes all definitions of registers and bits of registers, including pins and port names. #define output(directions,pin) (directions |= pin) // set port direction for output #define input(directions,pin) (directions &= (~pin)) // set port direction for input #define set(port,pin) (port |= pin) // set port pin #define clear(port,pin) (port &= (~pin)) // clear port pin #define pin_test(pins,pin) (pins & pin) // test for port pin #define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set #define input_port PORTA // The button is on port A #define input_direction DDRA // DDRA defines input/output for port A #define input_pin (1 << PA2) // The button is on pin 2 of port A (1<