Teensy Noob needs help

I do a project in college for kids. I have 4 plates which lay on the ground and the kids can jump from plate to plate to play melodies or rhythms. It's more like a proof of concept, if it makes fun and works for kids. I saw the piezo drum example sketch and get one plate to work with that sketch. Now I want to connect 4 plates playing 4 different midi notes. I thought that should not be that difficult but because I am total beginner I was not able to get it running. I thought about to use the array command but I am not really sure where and how to put it in. Could someone of you help me with a solution?

Sorry for any mistakes, I am not a native speaker.

do you already have added a MIDI out? o
Or do you want to use MIDI over USB?

It would be a big advantage if you could post your current code.

As a fast way to show how MIDI could work for you, here comes some pseudo-code:

#include <MIDI.h>

MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);



  MIDI.sendNoteOn(80, 100, MIDI_CHANNEL_OUT);
  // wait some time befor sending a note-off
  delay(1000); // very bad hack... better using elapsedMillis()
  MIDI.sendNoteOff(80, 0, MIDI_CHANNEL_OUT);
  delay(1000); // very bad hack... better using elapsedMillis()

HtH, Holger
This is the standard piezo drum example:

const int channel = 10; // General MIDI: channel 10 = percussion sounds
const int note = 36; // General MIDI: note 38 = acoustic snare

const int analogPin = A0;
const int thresholdMin = 60; // minimum reading, avoid noise and false starts
const int peakTrackMillis = 12;
const int aftershockMillis = 25; // aftershocks & vibration reject

void setup() {
while (!Serial && millis() < 2500) /* wait for serial monitor */ ;
Serial.println("Piezo Peak Capture");

void loop() {
int piezo = analogRead(analogPin);
// Add other tasks to loop, but avoid using delay() or waiting.
// You need loop() to keep running rapidly to detect Piezo peaks!

// MIDI Controllers should discard incoming MIDI messages.
// http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
while (usbMIDI.read()) {
// ignore incoming messages

void peakDetect(int voltage) {
// "static" variables keep their numbers between each run of this function
static int state; // 0=idle, 1=looking for peak, 2=ignore aftershocks
static int peak; // remember the highest reading
static elapsedMillis msec; // timer to end states 1 and 2

switch (state) {
// IDLE state: wait for any reading is above threshold. Do not set
// the threshold too low. You don't want to be too sensitive to slight
// vibration.
case 0:
if (voltage > thresholdMin) {
//Serial.print("begin peak track ");
peak = voltage;
msec = 0;
state = 1;

// Peak Tracking state: capture largest reading
case 1:
if (voltage > peak) {
peak = voltage;
if (msec >= peakTrackMillis) {
//Serial.print("peak = ");
int velocity = map(peak, thresholdMin, 1023, 1, 127);
usbMIDI.sendNoteOn(note, velocity, channel);
msec = 0;
state = 2;

// Ignore Aftershock state: wait for things to be quiet again.
if (voltage > thresholdMin) {
msec = 0; // keep resetting timer if above threshold
} else if (msec > aftershockMillis) {
usbMIDI.sendNoteOff(note, 0, channel);
state = 0; // go back to idle when

I want to use MIDI over USB and generate sounds via sunvox.

Thanks for respond!
Ah, ok - I understand...

Yes, keeping an array for notes, piezos, velocity should be a solution... like:

int notes[] = { 29, 42, 30 , 33 };
int piezos[] = { A0 ,A1 ,A2, A5};
int velocity[4];

... and looping inside the loop()-function and checking values...