Bonjour à tous!
En farfouillant sur le forum j'ai trouver ce code:
void setup() {
DDRL = 0x0;
PORTL = 0xFF; // PORT L -> INPUT + Pull-up
DDRD = 0x0;
PORTD = 0xFF; // PORT D -> INPUT + Pull-up
DDRC = 0x0;
PORTC = 0xFF; // PORT C -> INPUT + Pull-up
Serial.begin(115200); // Serial -> midi
}
void loop() {
if(bitRead(PINL, 0)) { // BP 1
}
if(bitRead(PINL, 1)) { // BP 2
}
if(bitRead(PINL, 2)) { // BP 3
}
if(bitRead(PINL, 3)) { // BP 4
}
if(bitRead(PINL, 4)) { // BP 5
}
if(bitRead(PINL, 5)) { // BP 6
}
if(bitRead(PINL, 6)) { // BP 7
}
if(bitRead(PINL, 7)) { // BP 8
}
if(bitRead(PIND, 0)) { // BP 9
}
if(bitRead(PIND, 1)) { // BP 10
}
if(bitRead(PIND, 2)) { // BP 11
}
if(bitRead(PIND, 3)) { // BP 12
}
if(bitRead(PIND, 4)) { // BP 13
}
if(bitRead(PIND, 5)) { // BP 14
}
if(bitRead(PIND, 6)) { // BP 15
}
if(bitRead(PIND, 7)) { // BP 16
}
if(bitRead(PINC, 0)) { // BP 17
}
if(bitRead(PINC, 1)) { // BP 18
}
if(bitRead(PINC, 2)) { // BP 19
}
if(bitRead(PINC, 3)) { // BP 20
}
if(bitRead(PINC, 4)) { // BP 21
}
if(bitRead(PINC, 5)) { // BP 22
}
if(bitRead(PINC, 6)) { // BP 23
}
if(bitRead(PINC, 7)) { // BP 24
}
delay(1000); // Evite le flood
}
void MIDI_TX(byte db1, byte db2, byte db3) {
Serial.write(db1);
Serial.write(db2);
Serial.write(db3);
}
void MIDI_TX(byte db1, byte db2 ) {
Serial.write(db1);
Serial.write(db2);
}
C'est le premier code pour bouton midi que je trouve relativement simple et court mais j'ai du mal a comprendre son funcionnement et aussi a l'interpreter.
merci de votres aide!