Danke für die schnellen Antworten!
Hab ein bisschen rum probiert aber bekomme es nicht auf die reihe.. Bin noch ziemlicher Anfänger
Das hier ist mein Code:
#include <Wire.h>
#include <Adafruit_Trellis.h>
#define LED 13 // Pin for heartbeat LED (shows code is working)
#define CHANNEL 1 // MIDI channel number
Adafruit_Trellis trellis;
uint8_t heart = 0; // Heartbeat LED counter
unsigned long prevReadTime = 0L; // Keypad polling timer
uint8_t mod;
uint8_t vel;
uint8_t fxc;
uint8_t rate;
uint8_t note[] = {
60, 61, 62, 63,
56, 57, 58, 59,
52, 53, 54, 55,
48, 49, 50, 51
};
void setup() {
pinMode(LED, OUTPUT);
trellis.begin(0x70); // Pass I2C address
#ifdef AVR
// Default Arduino I2C speed is 100 KHz, but the HT16K33 supports
// 400 KHz. We can force this for faster read & refresh, but may
// break compatibility with other I2C devices...so be prepared to
// comment this out, or save & restore value as needed.
TWBR = 12;
#endif
trellis.clear();
trellis.writeDisplay();
mod = map(analogRead(0), 0, 1023, 0, 127);
vel = map(analogRead(1), 0, 1023, 0, 127);
fxc = map(analogRead(2), 0, 1023, 0, 127);
rate = map(analogRead(3),0, 1023, 0, 127);
usbMIDI.sendControlChange(1, mod, CHANNEL);
usbMIDI.sendControlChange(11, vel, CHANNEL);
usbMIDI.sendControlChange(12, fxc, CHANNEL);
usbMIDI.sendControlChange(13, rate, CHANNEL);
}
void loop() {
unsigned long t = millis();
if((t - prevReadTime) >= 20L) { // 20ms = min Trellis poll time
if(trellis.readSwitches()) { // Button state change?
for(uint8_t i=0; i<16; i++) { // For each button...
if(trellis.justPressed(i)) {
usbMIDI.sendNoteOn(note*, 127, CHANNEL);*
- trellis.setLED(i);*
- } else if(trellis.justReleased(i)) {*
_ usbMIDI.sendNoteOff(note*, 0, CHANNEL);_
_ trellis.clrLED(i);_
_ }_
_ }_
_ trellis.writeDisplay();_
_ }_
uint8_t newModulation = map(analogRead(0), 0, 1023, 0, 127);
_ if(mod != newModulation) {_
_ mod = newModulation;_
_ usbMIDI.sendControlChange(1, mod, CHANNEL);_
_ }_
uint8_t newVelocity = map(analogRead(1), 0, 1023, 0, 127);
_ if(vel != newVelocity) {_
_ vel = newVelocity;_
_ usbMIDI.sendControlChange(11, vel, CHANNEL);_
_ }_
uint8_t newEffect = map(analogRead(2), 0, 1023, 0, 127);
_ if(fxc != newEffect) {_
_ fxc = newEffect;_
_ usbMIDI.sendControlChange(12, fxc, CHANNEL);_
_ }_
uint8_t newRate = map(analogRead(3), 0, 1023, 0, 127);
_ if(rate !=newRate) {_
_ rate = newRate;_
_ usbMIDI.sendControlChange(13, rate, CHANNEL);_
_ }_
_ prevReadTime = t;_
_ digitalWrite(LED, ++heart & 32); // Blink = alive*_
* }*
* while(usbMIDI.read()); // Discard incoming MIDI messages*
}
könnte mir jemand helfen?