From 061a2a60d3dfc21e6f5c24693fe37c2047a01f66 Mon Sep 17 00:00:00 2001 From: CHRISTOPHE Date: Fri, 18 Oct 2019 21:48:59 +0200 Subject: [PATCH] essai avec 24 capteurs --- .../{ => MidiHallSynth32}/MidiHallSynth32.ino | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) rename ressource arduino/MidiHallSynthChrom/{ => MidiHallSynth32}/MidiHallSynth32.ino (93%) diff --git a/ressource arduino/MidiHallSynthChrom/MidiHallSynth32.ino b/ressource arduino/MidiHallSynthChrom/MidiHallSynth32/MidiHallSynth32.ino similarity index 93% rename from ressource arduino/MidiHallSynthChrom/MidiHallSynth32.ino rename to ressource arduino/MidiHallSynthChrom/MidiHallSynth32/MidiHallSynth32.ino index e24c165..b0616f5 100644 --- a/ressource arduino/MidiHallSynthChrom/MidiHallSynth32.ino +++ b/ressource arduino/MidiHallSynthChrom/MidiHallSynth32/MidiHallSynth32.ino @@ -155,6 +155,14 @@ int DePL7 = 128 ; // +void noteOn(int cmd, int pitch, int velocity) /* plays a MIDI note. Doesn't check to see that cmd is greater than 127, + or that data values are less than 127 */ +{ + Serial.write(cmd); + Serial.write(pitch); + Serial.write(velocity); +} + @@ -202,8 +210,6 @@ void setup() - - /* DDRA = B11111111 ; /* initialisation du port A en entré sur toutes les broches */ /* NE FONCTIONNE PAS ! */ @@ -221,23 +227,23 @@ void setup() { noteOn( 0x80, i , 0x00 ) ; - } - - + } +delay(2000); } - - - +/* void noteOn(int cmd, int pitch, int velocity) /* plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that data values are less than 127 */ +/* { Serial.write(cmd); Serial.write(pitch); Serial.write(velocity); } + +*/ @@ -260,11 +266,11 @@ void loop() EPA6 = RegistreA & Masque64 ; EPA7 = RegistreA & Masque128 ; - if ( ( EPA0 == 0 ) && ( DePA0 == 1 ) ) { noteOn(0x90, 0x24 , 0x70 ) ; } + if ( ( EPA0 == 0 ) && ( DePA0 == 1 ) ) { noteOn(0x90, 0x24 , 0x90 ) ; } if ( ( EPA0 == 1 ) && ( DePA0 == 0 ) ) { noteOn(0x80, 0x24 , 0x00 ) ;} - if ( ( EPA1 == 0 ) && ( DePA1 == Masque2 ) ) noteOn(0x90, 0x25 , 0x70 ) ; - if ( ( EPA1 == Masque2 ) && ( DePA1 == 0 ) ) noteOn(0x80, 0x25 , 0x00 ) ; + if ( ( EPA1 == 0 ) && ( DePA1 == Masque2 ) ) {noteOn(0x90, 0x25 , 0x70 ) ;} + if ( ( EPA1 == Masque2 ) && ( DePA1 == 0 ) ) {noteOn(0x80, 0x25 , 0x00 ) ;} if ( ( EPA2 == 0 ) && ( DePA2 == Masque4 ) ) { noteOn(0x90, 0x26 , 0x70 ) ;} if ( ( EPA2 == Masque4 ) && ( DePA2 == 0 ) ) { noteOn(0x80, 0x26 , 0x00 ) ; } @@ -297,8 +303,8 @@ void loop() if ( ( EPB0 == 0 ) && ( DePB0 == 1 ) ) { noteOn(0x90, 0x2C , 0x70 ) ; } /* gestion du port B */ if ( ( EPB0 == 1 ) && ( DePB0 == 0 ) ) { noteOn(0x80, 0x2C , 0x00 ) ;} - if ( ( EPB1 == 0 ) && ( DePB1 == Masque2 ) ) noteOn(0x90, 0x2D , 0x70 ) ; - if ( ( EPB1 == Masque2 ) && ( DePB1 == 0 ) ) noteOn(0x80, 0x2D , 0x00 ) ; + if ( ( EPB1 == 0 ) && ( DePB1 == Masque2 ) ) { noteOn(0x90, 0x2D , 0x70 ) ;} + if ( ( EPB1 == Masque2 ) && ( DePB1 == 0 ) ) { noteOn(0x80, 0x2D , 0x00 ) ;} if ( ( EPB2 == 0 ) && ( DePB2 == Masque4 ) ) { noteOn(0x90, 0x2E , 0x70 ) ;} if ( ( EPB2 == Masque4 ) && ( DePB2 == 0 ) ) { noteOn(0x80, 0x2E , 0x00 ) ; } @@ -332,8 +338,8 @@ void loop() if ( ( EPC0 == 0 ) && ( DePC0 == 1 ) ) { noteOn(0x90, 0x34 , 0x70 ) ; } /* gestion du port C */ if ( ( EPC0 == 1 ) && ( DePC0 == 0 ) ) { noteOn(0x80, 0x34 , 0x00 ) ;} - if ( ( EPC1 == 0 ) && ( DePC1 == Masque2 ) ) noteOn(0x90, 0x35 , 0x70 ) ; - if ( ( EPC1 == Masque2 ) && ( DePC1 == 0 ) ) noteOn(0x80, 0x35 , 0x00 ) ; + if ( ( EPC1 == 0 ) && ( DePC1 == Masque2 ) ) { noteOn(0x90, 0x35 , 0x70 ) ;} + if ( ( EPC1 == Masque2 ) && ( DePC1 == 0 ) ) { noteOn(0x80, 0x35 , 0x00 ) ;} if ( ( EPC2 == 0 ) && ( DePC2 == Masque4 ) ) { noteOn(0x90, 0x36 , 0x70 ) ;} if ( ( EPC2 == Masque4 ) && ( DePC2 == 0 ) ) { noteOn(0x80, 0x36 , 0x00 ) ; } @@ -367,8 +373,8 @@ void loop() if ( ( EPL0 == 0 ) && ( DePL0 == 1 ) ) { noteOn(0x90, 0x3C , 0x70 ) ; } /* gestion du port L */ if ( ( EPL0 == 1 ) && ( DePL0 == 0 ) ) { noteOn(0x80, 0x3C , 0x00 ) ;} - if ( ( EPL1 == 0 ) && ( DePL1 == Masque2 ) ) noteOn(0x90, 0x3D , 0x70 ) ; - if ( ( EPL1 == Masque2 ) && ( DePL1 == 0 ) ) noteOn(0x80, 0x3D , 0x00 ) ; + if ( ( EPL1 == 0 ) && ( DePL1 == Masque2 ) ) {noteOn(0x90, 0x3D , 0x70 ) ; } + if ( ( EPL1 == Masque2 ) && ( DePL1 == 0 ) ){ noteOn(0x80, 0x3D , 0x00 ) ; } if ( ( EPL2 == 0 ) && ( DePL2 == Masque4 ) ) { noteOn(0x90, 0x3E , 0x70 ) ;} if ( ( EPL2 == Masque4 ) && ( DePL2 == 0 ) ) { noteOn(0x80, 0x3E , 0x00 ) ; }