Midi Drum Glove Project

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Midi Drum Glove Project

Post by gambinos »

Hi,

We cannot get the drum glove to work. We followed the instructions for the build and finally got the Adafruit boards installed with a link someone posted on the forum to add board URL in preferences. Now the program won't work with the Flora. Please help. We installed NanoStudio, but do not know how to make it connect so the glove fingers can operate as the keyboard presses.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Midi Drum Glove Project

Post by adafruit_support_carter »

Back up a little and go through the basic FLORA intro guide:
https://learn.adafruit.com/getting-star ... a/overview
Make sure you can get the blink example to load and run first. If you still have trouble with that, report back.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Midi Drum Glove Project

Post by Franklin97355 »

Now the program won't work with the Flora.
What errors do you get and what does not work?

User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Re: Midi Drum Glove Project

Post by gambinos »

We've already gotten the blink to work. We also made a lie detector last year and a GPS jacket (it was much easier on a Mac, but now we are using these at school with Windows!!).

The problem we currently have with the midi drum glove program is that the word 'keyboard' in the program errors out and is not recognized. How can we connect to the music program? Any help greatly appreciated.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Midi Drum Glove Project

Post by adafruit_support_carter »

Try putting this line at the top of your sketch:

Code: Select all

#include <Keyboard.h>

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Midi Drum Glove Project

Post by Franklin97355 »

Post the code you are trying to compile and we will take a look.

User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Re: Midi Drum Glove Project

Post by gambinos »

I tried the include keyboard line, but that is errors out too.

Code: Select all

/*
  Piezo Keyboard glove
  
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!
 
  Written by Limor Fried & Becky Stern for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
  
*/

#include <Keyboard.h>
const int indexFinger = A9; // the piezo is connected to analog pin 9 (aka D9)
const int middleFinger = A7; // the piezo is connected to analog pin 7 (aka D6)
const int thumb = A10; // the piezo is connected to analog pin 10 (aka D10)
const int pinkyFinger = A11; // the piezo is connected to analog pin 11 (aka D12)
 
const int pins[] = {thumb, indexFinger, middleFinger, pinkyFinger};
 
char Keys[] =   {'z','x','c','v'};
 
boolean currentPressed[] = {false, false, false, false};
 
const int threshold = 40;  // threshold value to decide when the detected sound is a knock or not
 
void setup()
{
  //while (!Serial)
  Serial.begin(115200);
  Serial.println("start");
 Keyboard.begin();
}
 
 
void loop()                    
{ 
  for (int i=0;i<4;i++) {
    delay(1);
    long total1 = 0;
    long start = millis();
    long total =  analogRead(pins[i]);
 
    // check if we are sensing that a finger is touching
    // and that it wasnt already pressed
    if ((total > threshold) && (! currentPressed[i])) {
      Serial.print("Key pressed #"); Serial.print(i);
      Serial.print(" ("); Serial.print(Keys[i]); Serial.println(")");
      currentPressed[i] = true;
 
   Keyboard.press(Keys[i]);
    } 
    else if ((total <= threshold) && (currentPressed[i])) {
      // key was released (no touch, and it was pressed before)
      Serial.print("Key released #"); Serial.print(i);
      Serial.print(" ("); Serial.print(Keys[i]); Serial.println(")");
      currentPressed[i] = false;
      
     Keyboard.release(Keys[i]);
    }
    
    delay(5);
  }
}
Last edited by adafruit_support_carter on Mon May 07, 2018 11:19 am, edited 1 time in total.
Reason: added [code] tags

User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Re: Midi Drum Glove Project

Post by gambinos »

Error message:

drumglove.ino:13:22: fatal error: Keyboard.h: No such file or directory
compilation terminated.
Error compiling.

Using the Flora Mainboard Version B

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Midi Drum Glove Project

Post by adafruit_support_carter »

What version of the Arduino IDE are you using? Check and make sure the Keyboard library is installed:
Sketch -> Include Library -> Manage Libraries...
type "keyboard" in the "Filter your search..." window and make sure the library shows up in the list.
libman_keyboard.jpg
libman_keyboard.jpg (75.35 KiB) Viewed 295 times

User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Re: Midi Drum Glove Project

Post by gambinos »

Thank you, I installed these libraries and now the program says it uploaded, but it's still not making any sound. I have NanoStudio open - how do I make it communicate with Flora?

User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Re: Midi Drum Glove Project

Post by gambinos »

I also put these includes at the top of the program:
#include <HID.h>
#include <Keyboard.h>

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Midi Drum Glove Project

Post by adafruit_support_carter »

If you open the serial monitor in the Arduino IDE, do you see anything being printed there when you try to use the glove?

User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Re: Midi Drum Glove Project

Post by gambinos »

No, nothing is printing in the serial monitor, but I do see on COM13 (Adafruit Flora)

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Midi Drum Glove Project

Post by adafruit_support_carter »

Hmm. If you're running the first demo code from here (with the needed #includes added):
https://learn.adafruit.com/midi-drum-glove/code
you should see some output printed to the serial console when you try to use the glove. Something like:

Code: Select all

Key pressed #0 (z)
Key released #0 (z)
Try lowering the value for threshold on this line:

Code: Select all

const int threshold = 40;  // threshold value to decide when the detected sound is a knock or not
and see if you can get the glove to respond.

User avatar
gambinos
 
Posts: 19
Joined: Sat Mar 12, 2016 11:49 pm

Re: Midi Drum Glove Project

Post by gambinos »

I went down to 10, still no response. I could not get the Flora board choice from Teensyduino to show up. Could this have something to do with it? I only see Teensy 3.6, 3.5, 3.2/3.1/ 3.0 LC, 2.0 and ++2.0 We chose just the regular Flora.

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”