Table des matières

Teensy

<blockquote>The Teensy is a complete USB-based microcontroller development system, in a very small footprint, capable of implementing many types of projects. All programming is done via the USB port. No special programmer is needed, only a standard “Mini-B” USB cable and a PC or Macintosh with a USB port.(http://www.pjrc.com/teensy/)</blockquote>

Installation

Teensy Vs Arduino

Pins

Teensy et Raspberry Pi

Ethernet

Touch > Midi

Envoie de valeurs avec touchRead() en MIDI.

// adpapted from http://reso-nance.org/wiki/projets/teensymiditouchcontroller/
 
/* TOUCHPINS */
int const nbTouch = 6; // number of pins to use as touchpins, sending note values
int touch[nbTouch];
int touchOn[nbTouch];
int touchPins[] = {15,16,17,18,19,22,};
int touchPitch[] = {36,37,38,39,40,41}; // MIDI pitches
int touchThreshold = 3200; 
 
const int channel = 1;
 
void setup() { 
   Serial.begin(38400); 
 } 
 
void loop() {
 
  for (int i = 0; i < nbTouch; i++) {
 
    touch[i] = touchRead(touchPins[i]);
    //Serial.print();
    //Serial.print("\t");
 
    if (touch[i] > touchThreshold && touchOn[i] == 0) {
      usbMIDI.sendNoteOn(touchPitch[i], map(touch[i],1300, 6000, 0, 127), channel);
      touchOn[i] = 1;
    }
    if (touch[i] < touchThreshold && touchOn[i] == 1) {
      usbMIDI.sendNoteOff(touchPitch[i], 0, channel);
      touchOn[i] = 0;
    }
  }
 
 //Serial.println();
 delay(10);
}