A piano built with a basket of fruit, a microcontroller and a computer.

Dependencies:   USBDevice mbed

Fork of MaKeyMaKey_mbed_version by Seeed

A piano built with a basket of fruit, a microcontroller and a computer.

The idea is from Makey Makey, but uses different hardware and software. An mbed enabled microcontroller with USB is used.

https://raw.githubusercontent.com/xiongyihui/piano/master/piano.png

https://github.com/xiongyihui/piano/raw/master/hardware.jpg

Hardware

  • An Arch board
  • A basket of fruit
  • A computer with AC power
  • some wires

Software

  1. Click this link to import the program to mbed online compiler.
  2. Compile the code and download the binary file - Fruit_Piano_LPC11U24.bin.
  3. Connect the Arch board to the computer and long press the button, a USB drive named CRP DISABLD will pop up.
  4. Delete firmware.bin and copy Arch_GPIO_Ex1_LPC11U24.bin to the USB drive.
  5. Quick press the button to run the program
  6. Wire some apples or bananas to A0 - A5 (P0_11 - P0_14, P0_16, P0_22) pins of the Arch board
  7. Open Fruit Piano and play

Have fun!

Files at this revision

API Documentation at this revision

Comitter:
yihui
Date:
Mon Aug 18 01:58:34 2014 +0000
Parent:
0:4755a81efb1d
Commit message:
Custom for Fruit Piano

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4755a81efb1d -r 93bbcf91f356 main.cpp
--- a/main.cpp	Mon May 26 08:03:17 2014 +0000
+++ b/main.cpp	Mon Aug 18 01:58:34 2014 +0000
@@ -10,11 +10,11 @@
 Ticker tick;
 USBKeyboard keyboard;
 
-uint8_t       key_map[TOUCH_N] = {RIGHT_ARROW, LEFT_ARROW, DOWN_ARROW, UP_ARROW, ' ', '\n'};
-PinName       touch_pin[TOUCH_N] = {A0, A1, A2, A3, A4, A5};
+uint8_t       key_map[] = {'a', 'f', 'd', 'g', 'd', 'h', 'j', 'k', 'l', ';', '\'', '\n'};
+PinName       touch_pin[] = {A0, A3, A2, A4, A1, A5};
 DigitalInOut *p_touch_io[TOUCH_N];
 
-uint8_t touch_data[TOUCH_N] = {0, };
+uint16_t touch_data[TOUCH_N] = {0, };
 
 void detect(void)
 {
@@ -55,7 +55,7 @@
         p_touch_io[i]->write(1);
     }
     
-    tick.attach(detect, 1.0 / 64.0);
+    tick.attach(detect, 1.0 / 40.0);
     
     while(1) {
         // do something