/* Wave64.pde - Mama's BIG-IO-input 64 bit capacitive hand-waving sensor Arduino BigIOinput Wave64 example Copyright (c) 2011 Devon Sean McCullough Licensed under the GPL (GNU Public License) Requires the BigIOinput, Trixel and LiquidCrystal libraries, a 64-bit parallel to serial input card with sensitive inputs and a 12x2 or better LCD display with 5 or more characters of font RAM. http://csail.mit.edu/~devon/Arduino/BigIOinput http://csail.mit.edu/~devon/Arduino/Trixel BUGS the bare hardware only responds when shorted by wire to D10 POSSIBLE VARIATIONS keep instructions onscreen until some input bit changes HARDWARE Arduino <===> MotherboardShield <===> Mama's LCD Card <===> Mama's BIG-IO-input Card <===> USB Serial <===> Programmer Arduino Hard- Silk- Sketch Pin ware screen symbol ---- ------ ------ ------ D0 Serial RX D1 Serial TX D2 LCD RS D3 LCD ENABLE D4 LCD D4 D5 LCD D5 D6 LCD D6 D7 LCD D7 D8 BigI SH/~LD Shift D9 BigI ~Enable Inhibit D10 Probe - High D11 BigI P1-OUT Qh D12 BigI CLK Clock D13 GND Serial digital pins 0, 1. BigI digital pins 8, 9, 11, 12. LCD digital pins 2, 3, 4, 5, 6, 7. */ #include #include #include // RS, Enable, D4, D5, D6, D7 LiquidCrystal lcd( 2, 3, 4, 5, 6, 7); Trixel trix(&lcd); // size Shift Clock Qh BigIOinput input( 64, 8, 12, 11); const byte Inhibit = 9; // wired Inhibit to D9 although ground would be better // Probe to tickle inputs const byte High = 10; // attach logic high signal test probe to D10 void setup() { pinMode(High, OUTPUT); // Test probe source digitalWrite(High, HIGH); // ... logic high pinMode(Inhibit, OUTPUT); // BigI ~Enable digitalWrite(Inhibit, LOW); // ... normally grounded lcd.begin(12, 2); // LCD columns and rows trix.begin(12, 2); // ... trixel size lcd.print("wave hand or"); // show instructions on LCD lcd.setCursor(0, 1); lcd.print("short to D10"); delay(3000); // ... for three seconds } const int Mamas_BigIO_input_map[64] = { // Mama's BIG-IO input 64 card wiring map // indices = bit positions in hardware shift register // values = bit positions in software variables and arrays 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 23, 22, 21, 20, 19, 18, 17, 16, 31, 30, 29, 28, 27, 26, 25, 24, 39, 38, 37, 36, 35, 34, 33, 32, 47, 46, 45, 44, 43, 42, 41, 40, 55, 54, 53, 52, 51, 50, 49, 48, 63, 62, 61, 60, 59, 58, 57, 56 }; void loop () { // continuously monitor all 64 input bits on LCD #define VERSION 1 // three functionally identical versions of this example #if VERSION == 1 input.load(); for (int position = 0; position < 64; position++) { boolean bit = input.shift(); trixel_color color = (trixel_color)bit; int xy = Mamas_BigIO_input_map[position]; int x = xy / 6; int y = xy % 6; trix.setDot (x, y, color); } #elif VERSION == 2 for (int position = 0; position < 64; position++) { boolean bit = input.read(position); trixel_color color = (trixel_color)bit; int xy = Mamas_BigIO_input_map[position]; int x = xy / 6; int y = xy % 6; trix.setDot (x, y, color); } #elif VERSION == 3 BigIO_t bits = input.read(64, 0, Mamas_BigIO_input_map); trix.clear(); for (int xy = 0; xy < 64; xy++, bits >>= 1) if (bits & 1) { int x = xy / 6; int y = xy % 6; trix.setDot (x, y); } #else #error This example has only three versions. #endif trix.show(); } // end Wave64.pde