Components and supplies
Single Turn Potentiometer- 10k ohms
Tactile Switch, Top Actuated
Arduino UNO
Project description
Code
Encore un code de clavier midi
csharp
1// MAIS CELUI CI CEST LE BON :) 2//CODE N°24, CINQUIEME SEMAINE DE PROG 3//THANK "PretEnGineering" POUR LA STRUCTURE ;) 4//Beru 5#include <MIDI.h> 6//#include <pitches.h> 7MIDI_CREATE_DEFAULT_INSTANCE(); // DECLARATION PIN DIGITAL 8int buttonZpin = 2; 9int buttonApin = 3; 10int buttonBpin = 4; 11int buttonCpin = 5; 12int buttonDpin = 6; 13int buttonEpin = 7; 14int buttonFpin = 8; 15int buttonGpin = 9; 16int buttonHpin = 10; 17int buttonIpin = 11; 18int buttonJpin = 12; 19int buttonKpin = 13; 20 //DECLARATION PIN ANALOGIQUE 21int analogpot1 = A0; // POTARD 1 22int analogpot2 = A1; 23 //ROLE DES PIN ANALOGUE 24int analogpot1Old = 0; 25int analogpot2Old = 0; 26int analogpot1New = 0; 27int analogpot2New = 0; 28 // VALEUR DES PIN ANALOGUE = RECONNU POUR LE MAPPAGE ABLETON COMME " C-54 " & " C-55 " ETC... 29#define analogpot1CC 54 30#define analogpot2CC 55 31 32void setup() { 33 34MIDI.begin (); // ETAT DES PIN DIGITAL 35 36pinMode(buttonZpin, INPUT_PULLUP);// UTILISE LA RESISTANCE DE LA CARTE // A ENLEVER SI RESISTANCE // ATTENTION AU CHANGEMENT DE BRANCHEMENT DES BOUTTON !!! 37pinMode(buttonApin, INPUT_PULLUP); 38pinMode(buttonBpin, INPUT_PULLUP); 39pinMode(buttonCpin, INPUT_PULLUP); 40pinMode(buttonDpin, INPUT_PULLUP); 41pinMode(buttonEpin, INPUT_PULLUP); 42pinMode(buttonFpin, INPUT_PULLUP); 43pinMode(buttonGpin, INPUT_PULLUP); 44pinMode(buttonHpin, INPUT_PULLUP); 45pinMode(buttonIpin, INPUT_PULLUP); 46pinMode(buttonJpin, INPUT_PULLUP); 47pinMode(buttonKpin, INPUT_PULLUP); 48 49pinMode(analogpot1, INPUT); 50pinMode(analogpot2, INPUT); 51 52Serial.begin(9600); ///////////////////////////////////////////////////////// BAULT Serial.begin(115200); 53} 54 55void loop() { 56 // ETAT ACTUEL DES PIN ANALOGUE 57static bool buttonZvalueOld = HIGH; 58static bool buttonAvalueOld = HIGH; 59static bool buttonBvalueOld = HIGH; 60static bool buttonCvalueOld = HIGH; 61static bool buttonDvalueOld = HIGH; 62static bool buttonEvalueOld = HIGH; 63static bool buttonFvalueOld = HIGH; 64static bool buttonGvalueOld = HIGH; 65static bool buttonHvalueOld = HIGH; 66static bool buttonIvalueOld = HIGH; 67static bool buttonJvalueOld = HIGH; 68static bool buttonKvalueOld = HIGH; 69 70bool buttonZvalueNew = digitalRead(buttonZpin); 71bool buttonAvalueNew = digitalRead(buttonApin); 72bool buttonBvalueNew = digitalRead(buttonBpin); 73bool buttonCvalueNew = digitalRead(buttonCpin); 74bool buttonDvalueNew = digitalRead(buttonDpin); 75bool buttonEvalueNew = digitalRead(buttonEpin); 76bool buttonFvalueNew = digitalRead(buttonFpin); 77bool buttonGvalueNew = digitalRead(buttonGpin); 78bool buttonHvalueNew = digitalRead(buttonHpin); 79bool buttonIvalueNew = digitalRead(buttonIpin); 80bool buttonJvalueNew = digitalRead(buttonJpin); 81bool buttonKvalueNew = digitalRead(buttonKpin); 82 83////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 84//NOTE SANS LES DIESES | RANGEE PAR 2 OCTAVES, SOIT LA CAPACIT2 DU CLAVIER MIDI BOIS // 85// OCTAVE + 28 30 32 33 35 37 39 40 42 44 45 47 48 49 51 FREQUENCES BASSES = NOTES GRAVES // 86// OCTAVES EN PROG 52,54,56,57,59,61,63,64,66,68,69,71,73,75 // 87// OCTAVE - 64 66 68 69 71 73 75 76 78 80 81 83 85 87 88 FREQUENCES HAUTES = NOTES AIGUES // 88////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 89 90 91 if (buttonAvalueNew != buttonAvalueOld){ /////////////////////////////////////////PREMIERE NOTE///////////////////////////////////////////////////////////// 92 if (buttonAvalueNew == LOW){ // SI J APPUIE ...|`||METTRE A L ETAT "HIGH" SI RESISTANCES, ET BRANCHEZ AU GROUND LE BOUTON;) ET ENLEVER INPUT_PULLUP DANS LA DECLARATION 93 MIDI.sendNoteOn(52, 127, 1); // (NUM NOTE,VELOCITE,ETAT?) 94 Serial.println("Note A On"); 95 } 96 else { 97 MIDI.sendNoteOff(52, 0, 1); 98 Serial.println("Note A Off"); 99 } 100 buttonAvalueOld = buttonAvalueNew; 101 }//////////////////////////////////////////////////////////////////////////// B /////////////////////////////////////////////////////////////////////////////// 102 103 if (buttonBvalueNew != buttonBvalueOld){ 104 if (buttonBvalueNew == LOW){ 105 MIDI.sendNoteOn(54, 127, 1); 106 Serial.println("Note B On"); 107 } 108 else { 109 MIDI.sendNoteOff(54, 0, 1); 110 Serial.println("Note B Off"); 111 } 112 buttonBvalueOld = buttonBvalueNew; 113 }//////////////////////////////////////////////////////////////////////////// C ///////////////////////////////////////////////////////////////////////// 114 115 if (buttonCvalueNew != buttonCvalueOld){ 116 if (buttonCvalueNew == LOW){ 117 MIDI.sendNoteOn(56, 127, 1); 118 Serial.println("Note C On"); 119 } 120 else { 121 MIDI.sendNoteOff(56, 0, 1); 122 Serial.println("Note C Off"); 123 } 124 buttonCvalueOld = buttonCvalueNew; 125 }//////////////////////////////////////////////////////////////////////////// D /////////////////////////////////////////////////////////////////////// 126 127 if (buttonDvalueNew != buttonDvalueOld){ 128 if (buttonDvalueNew == LOW){ 129 MIDI.sendNoteOn(57, 127, 1); 130 Serial.println("Note D On"); 131 } 132 else { 133 MIDI.sendNoteOff(57, 0, 1); 134 Serial.println("Note D Off"); 135 } 136 buttonDvalueOld = buttonDvalueNew; 137 }/////////////////////////////////////////////////////////////////////////// E ///////////////////////////////////////////////////////////////////// 138 139 if (buttonEvalueNew != buttonEvalueOld){ 140 if (buttonEvalueNew == LOW){ 141 MIDI.sendNoteOn(59, 127, 1); 142 Serial.println("Note E On"); 143 } 144 else { 145 MIDI.sendNoteOff(59, 0, 1); 146 Serial.println("Note E Off"); 147 } 148 buttonEvalueOld = buttonEvalueNew; 149 } 150///////////////////////////////////////////52,54,56,57,59,61,63,64,66,68,69,71,73,75//////// F /////////////////////////////////////////////////////////// 151 if (buttonFvalueNew != buttonFvalueOld){ 152 if (buttonFvalueNew == LOW){ 153 MIDI.sendNoteOn(61, 127, 1); 154 Serial.println("Note F On"); 155 } 156 else { 157 MIDI.sendNoteOff(61, 0, 1); 158 Serial.println("Note F Off"); 159 } 160 buttonFvalueOld = buttonFvalueNew; 161 }//////////////////////////////////////////////////////////////////////// G /////////////////////////////////////////////////////////////////////////// 162 163 if (buttonGvalueNew != buttonGvalueOld){ 164 if (buttonGvalueNew == LOW){ 165 MIDI.sendNoteOn(63, 127, 1); 166 Serial.println("Note G On"); 167 } 168 else { 169 MIDI.sendNoteOff(63, 0, 1); 170 Serial.println("Note G Off"); 171 } 172 buttonGvalueOld = buttonGvalueNew; 173 }////////////////////////////////////////////////////////////////////////////// H ////////////////////////////////////////////////////////////////////// 174 175 if (buttonHvalueNew != buttonHvalueOld){ 176 if (buttonHvalueNew == LOW){ 177 MIDI.sendNoteOn(64, 127, 1); 178 Serial.println("Note H On"); 179 } 180 else { 181 MIDI.sendNoteOff(64, 0, 1); 182 Serial.println("Note H Off"); 183 } 184 buttonHvalueOld = buttonHvalueNew; 185 }//////////////////////////////////////////////////////////////////////// I ////////////////////////////////////////////////////////////////////////////// 186 187 if (buttonIvalueNew != buttonIvalueOld){ 188 if (buttonIvalueNew == LOW){ 189 MIDI.sendNoteOn(66, 127, 1); 190 Serial.println("Note I On"); 191 } 192 else { 193 MIDI.sendNoteOff(66, 0, 1); 194 Serial.println("Note I Off"); 195 } 196 buttonIvalueOld = buttonIvalueNew; 197 }///////////////////////////////////////////////////////////////////// J ///////////////////////////////////////////////////////////////////////////////// 198 199 if (buttonJvalueNew != buttonJvalueOld){ 200 if (buttonJvalueNew == LOW){ 201 MIDI.sendNoteOn(68, 127, 1); 202 Serial.println("Note J On"); 203 } 204 else { 205 MIDI.sendNoteOff(68, 0, 1); 206 Serial.println("Note J Off"); 207 } 208 buttonJvalueOld = buttonJvalueNew; 209 } 210//////////////////////////////////////////52,54,56,57,59,61,63,64,66,68,69,71,73,75//// K ////////////////////////////////////////////////////////////////////// 211 if (buttonKvalueNew != buttonKvalueOld){ 212 if (buttonKvalueNew == LOW){ 213 MIDI.sendNoteOn(69, 127, 1); 214 Serial.println("Note K On"); 215 } 216 217 else { 218 MIDI.sendNoteOff(69, 0, 1); 219 Serial.println("Note K Off"); 220 } 221 buttonKvalueOld = buttonKvalueNew; 222 }/////////////////////////////////////////////////////////////////////// Z //////////////////////////////////////////////////////////////////////////////////// 223 224 if (buttonZvalueNew != buttonZvalueOld){ 225 if (buttonZvalueNew == LOW){ 226 MIDI.sendNoteOn(50, 127, 1); 227 Serial.println("Note Z On"); 228 } 229 else { 230 MIDI.sendNoteOff(50, 0, 1); 231 Serial.println("Note Z Off"); 232 } 233 234 buttonZvalueOld = buttonZvalueNew; 235 }/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 236 237 238/////////////////////////////////////////////////////-POTARDS-///////////////////////////////////////////////////////////////////////////////////////////// 239 240int pot1 = analogRead(A0); 241int pot2 = analogRead(A1); 242int analogpot1New = analogRead(A0); 243int analogpot2New = analogRead(A1); 244 245 if (analogpot1New - analogpot1Old >= 35 || analogpot1Old - analogpot1New >= 35) {//////////////////////// POTARD 1 //////////////////////////////////////// 246 analogpot1Old = analogpot1New; 247 analogpot1New = (map(analogpot1New, 1023, 0, 0, 120)); 248 analogpot1New = (constrain(analogpot1New, 0, 120)); 249 MIDI.sendControlChange(analogpot1CC, analogpot1New, 1); 250// Serial.print ("pot: "); 251// Serial.println(pot1); 252// Serial.print("potread: "); 253// Serial.println(analogpot1New); 254 } 255 256 if (analogpot2New - analogpot2Old >= 35 || analogpot2Old - analogpot2New >= 35) {////////////////////// POTARD 2 ///////////////////////////////////////// 257 analogpot2Old = analogpot2New; 258 analogpot2New = (map(analogpot2New, 1023, 0, 0, 120)); 259 analogpot2New = (constrain(analogpot2New, 0, 120)); 260 MIDI.sendControlChange(analogpot2CC, analogpot2New, 1); 261// Serial.print ("pot: "); 262// Serial.println(pot2); 263// Serial.print("potread: "); 264// Serial.println(analogpot2New); 265 } 266 267delay(25); 268}
Encore un code de clavier midi
csharp
1// MAIS CELUI CI CEST LE BON :) 2//CODE N°24, CINQUIEME SEMAINE DE PROG 3 4//THANK "PretEnGineering" POUR LA STRUCTURE ;) 5//Beru 6#include <MIDI.h> 7//#include 8 <pitches.h> 9MIDI_CREATE_DEFAULT_INSTANCE(); // DECLARATION PIN DIGITAL 10int 11 buttonZpin = 2; 12int buttonApin = 3; 13int buttonBpin = 4; 14int buttonCpin 15 = 5; 16int buttonDpin = 6; 17int buttonEpin = 7; 18int buttonFpin = 8; 19int 20 buttonGpin = 9; 21int buttonHpin = 10; 22int buttonIpin = 11; 23int buttonJpin 24 = 12; 25int buttonKpin = 13; 26 //DECLARATION PIN ANALOGIQUE 27int 28 analogpot1 = A0; // POTARD 1 29int analogpot2 = A1; 30 //ROLE 31 DES PIN ANALOGUE 32int analogpot1Old = 0; 33int analogpot2Old = 0; 34int analogpot1New 35 = 0; 36int analogpot2New = 0; 37 // VALEUR DES PIN ANALOGUE 38 = RECONNU POUR LE MAPPAGE ABLETON COMME " C-54 " & " C-55 " ETC... 39#define 40 analogpot1CC 54 41#define analogpot2CC 55 42 43void setup() { 44 45MIDI.begin 46 (); // ETAT DES PIN DIGITAL 47 48pinMode(buttonZpin, INPUT_PULLUP);// UTILISE 49 LA RESISTANCE DE LA CARTE // A ENLEVER SI RESISTANCE // ATTENTION AU CHANGEMENT 50 DE BRANCHEMENT DES BOUTTON !!! 51pinMode(buttonApin, INPUT_PULLUP); 52pinMode(buttonBpin, 53 INPUT_PULLUP); 54pinMode(buttonCpin, INPUT_PULLUP); 55pinMode(buttonDpin, INPUT_PULLUP); 56pinMode(buttonEpin, 57 INPUT_PULLUP); 58pinMode(buttonFpin, INPUT_PULLUP); 59pinMode(buttonGpin, INPUT_PULLUP); 60pinMode(buttonHpin, 61 INPUT_PULLUP); 62pinMode(buttonIpin, INPUT_PULLUP); 63pinMode(buttonJpin, INPUT_PULLUP); 64pinMode(buttonKpin, 65 INPUT_PULLUP); 66 67pinMode(analogpot1, INPUT); 68pinMode(analogpot2, INPUT); 69 70Serial.begin(9600); 71 ///////////////////////////////////////////////////////// BAULT Serial.begin(115200); 72} 73 74void 75 loop() { 76 // ETAT ACTUEL DES PIN ANALOGUE 77static 78 bool buttonZvalueOld = HIGH; 79static bool buttonAvalueOld = HIGH; 80static bool 81 buttonBvalueOld = HIGH; 82static bool buttonCvalueOld = HIGH; 83static bool buttonDvalueOld 84 = HIGH; 85static bool buttonEvalueOld = HIGH; 86static bool buttonFvalueOld = 87 HIGH; 88static bool buttonGvalueOld = HIGH; 89static bool buttonHvalueOld = HIGH; 90static 91 bool buttonIvalueOld = HIGH; 92static bool buttonJvalueOld = HIGH; 93static bool 94 buttonKvalueOld = HIGH; 95 96bool buttonZvalueNew = digitalRead(buttonZpin); 97bool 98 buttonAvalueNew = digitalRead(buttonApin); 99bool buttonBvalueNew = digitalRead(buttonBpin); 100bool 101 buttonCvalueNew = digitalRead(buttonCpin); 102bool buttonDvalueNew = digitalRead(buttonDpin); 103bool 104 buttonEvalueNew = digitalRead(buttonEpin); 105bool buttonFvalueNew = digitalRead(buttonFpin); 106bool 107 buttonGvalueNew = digitalRead(buttonGpin); 108bool buttonHvalueNew = digitalRead(buttonHpin); 109bool 110 buttonIvalueNew = digitalRead(buttonIpin); 111bool buttonJvalueNew = digitalRead(buttonJpin); 112bool 113 buttonKvalueNew = digitalRead(buttonKpin); 114 115////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 116//NOTE 117 SANS LES DIESES | RANGEE PAR 2 OCTAVES, SOIT LA CAPACIT2 DU CLAVIER MIDI BOIS // 118// 119 OCTAVE + 28 30 32 33 35 37 39 40 42 44 45 47 48 49 51 FREQUENCES 120 BASSES = NOTES GRAVES // 121// OCTAVES EN PROG 52,54,56,57,59,61,63,64,66,68,69,71,73,75 122 // 123// OCTAVE - 64 124 66 68 69 71 73 75 76 78 80 81 83 85 87 88 FREQUENCES HAUTES = NOTES AIGUES // 125////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 126 127 128 129 if (buttonAvalueNew != buttonAvalueOld){ /////////////////////////////////////////PREMIERE 130 NOTE///////////////////////////////////////////////////////////// 131 if (buttonAvalueNew 132 == LOW){ // SI J APPUIE ...|`||METTRE A L ETAT "HIGH" SI RESISTANCES, ET BRANCHEZ 133 AU GROUND LE BOUTON;) ET ENLEVER INPUT_PULLUP DANS LA DECLARATION 134 MIDI.sendNoteOn(52, 135 127, 1); // (NUM NOTE,VELOCITE,ETAT?) 136 Serial.println("Note A On"); 137 138 } 139 else { 140 MIDI.sendNoteOff(52, 0, 1); 141 Serial.println("Note 142 A Off"); 143 } 144 buttonAvalueOld = buttonAvalueNew; 145 }//////////////////////////////////////////////////////////////////////////// 146 B /////////////////////////////////////////////////////////////////////////////// 147 148 149 if (buttonBvalueNew != buttonBvalueOld){ 150 if (buttonBvalueNew == LOW){ 151 152 MIDI.sendNoteOn(54, 127, 1); 153 Serial.println("Note B On"); 154 } 155 156 else { 157 MIDI.sendNoteOff(54, 0, 1); 158 Serial.println("Note 159 B Off"); 160 } 161 buttonBvalueOld = buttonBvalueNew; 162 }//////////////////////////////////////////////////////////////////////////// 163 C ///////////////////////////////////////////////////////////////////////// 164 165 166 if (buttonCvalueNew != buttonCvalueOld){ 167 if (buttonCvalueNew == LOW){ 168 169 MIDI.sendNoteOn(56, 127, 1); 170 Serial.println("Note C On"); 171 } 172 173 else { 174 MIDI.sendNoteOff(56, 0, 1); 175 Serial.println("Note 176 C Off"); 177 } 178 buttonCvalueOld = buttonCvalueNew; 179 }//////////////////////////////////////////////////////////////////////////// 180 D /////////////////////////////////////////////////////////////////////// 181 182 183 if (buttonDvalueNew != buttonDvalueOld){ 184 if (buttonDvalueNew == LOW){ 185 186 MIDI.sendNoteOn(57, 127, 1); 187 Serial.println("Note D On"); 188 } 189 190 else { 191 MIDI.sendNoteOff(57, 0, 1); 192 Serial.println("Note 193 D Off"); 194 } 195 buttonDvalueOld = buttonDvalueNew; 196 }/////////////////////////////////////////////////////////////////////////// 197 E ///////////////////////////////////////////////////////////////////// 198 199 200 if (buttonEvalueNew != buttonEvalueOld){ 201 if (buttonEvalueNew == LOW){ 202 203 MIDI.sendNoteOn(59, 127, 1); 204 Serial.println("Note E On"); 205 } 206 207 else { 208 MIDI.sendNoteOff(59, 0, 1); 209 Serial.println("Note 210 E Off"); 211 } 212 buttonEvalueOld = buttonEvalueNew; 213 } 214///////////////////////////////////////////52,54,56,57,59,61,63,64,66,68,69,71,73,75//////// 215 F /////////////////////////////////////////////////////////// 216 if (buttonFvalueNew 217 != buttonFvalueOld){ 218 if (buttonFvalueNew == LOW){ 219 MIDI.sendNoteOn(61, 220 127, 1); 221 Serial.println("Note F On"); 222 } 223 else { 224 225 MIDI.sendNoteOff(61, 0, 1); 226 Serial.println("Note F Off"); 227 } 228 229 buttonFvalueOld = buttonFvalueNew; 230 }//////////////////////////////////////////////////////////////////////// 231 G /////////////////////////////////////////////////////////////////////////// 232 233 234 if (buttonGvalueNew != buttonGvalueOld){ 235 if (buttonGvalueNew == LOW){ 236 237 MIDI.sendNoteOn(63, 127, 1); 238 Serial.println("Note G On"); 239 } 240 241 else { 242 MIDI.sendNoteOff(63, 0, 1); 243 Serial.println("Note 244 G Off"); 245 } 246 buttonGvalueOld = buttonGvalueNew; 247 }////////////////////////////////////////////////////////////////////////////// 248 H ////////////////////////////////////////////////////////////////////// 249 250 251 if (buttonHvalueNew != buttonHvalueOld){ 252 if (buttonHvalueNew == LOW){ 253 254 MIDI.sendNoteOn(64, 127, 1); 255 Serial.println("Note H On"); 256 } 257 258 else { 259 MIDI.sendNoteOff(64, 0, 1); 260 Serial.println("Note 261 H Off"); 262 } 263 buttonHvalueOld = buttonHvalueNew; 264 }//////////////////////////////////////////////////////////////////////// 265 I ////////////////////////////////////////////////////////////////////////////// 266 267 268 if (buttonIvalueNew != buttonIvalueOld){ 269 if (buttonIvalueNew 270 == LOW){ 271 MIDI.sendNoteOn(66, 127, 1); 272 Serial.println("Note I 273 On"); 274 } 275 else { 276 MIDI.sendNoteOff(66, 0, 1); 277 Serial.println("Note 278 I Off"); 279 } 280 buttonIvalueOld = buttonIvalueNew; 281 }///////////////////////////////////////////////////////////////////// 282 J ///////////////////////////////////////////////////////////////////////////////// 283 284 285 if (buttonJvalueNew != buttonJvalueOld){ 286 if (buttonJvalueNew 287 == LOW){ 288 MIDI.sendNoteOn(68, 127, 1); 289 Serial.println("Note J 290 On"); 291 } 292 else { 293 MIDI.sendNoteOff(68, 0, 1); 294 Serial.println("Note 295 J Off"); 296 } 297 buttonJvalueOld = buttonJvalueNew; 298 } 299//////////////////////////////////////////52,54,56,57,59,61,63,64,66,68,69,71,73,75//// 300 K ////////////////////////////////////////////////////////////////////// 301 if 302 (buttonKvalueNew != buttonKvalueOld){ 303 if (buttonKvalueNew == LOW){ 304 305 MIDI.sendNoteOn(69, 127, 1); 306 Serial.println("Note K On"); 307 } 308 309 310 else { 311 MIDI.sendNoteOff(69, 0, 1); 312 Serial.println("Note 313 K Off"); 314 } 315 buttonKvalueOld = buttonKvalueNew; 316 }/////////////////////////////////////////////////////////////////////// 317 Z //////////////////////////////////////////////////////////////////////////////////// 318 319 320 if (buttonZvalueNew != buttonZvalueOld){ 321 if (buttonZvalueNew 322 == LOW){ 323 MIDI.sendNoteOn(50, 127, 1); 324 Serial.println("Note Z 325 On"); 326 } 327 else { 328 MIDI.sendNoteOff(50, 0, 1); 329 Serial.println("Note 330 Z Off"); 331 } 332 333 buttonZvalueOld = buttonZvalueNew; 334 }/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 335 336 337 338/////////////////////////////////////////////////////-POTARDS-///////////////////////////////////////////////////////////////////////////////////////////// 339 340int 341 pot1 = analogRead(A0); 342int pot2 = analogRead(A1); 343int analogpot1New = analogRead(A0); 344int 345 analogpot2New = analogRead(A1); 346 347 if (analogpot1New - analogpot1Old >= 348 35 || analogpot1Old - analogpot1New >= 35) {//////////////////////// POTARD 1 //////////////////////////////////////// 349 350 analogpot1Old = analogpot1New; 351 analogpot1New = (map(analogpot1New, 352 1023, 0, 0, 120)); 353 analogpot1New = (constrain(analogpot1New, 0, 120)); 354 355 MIDI.sendControlChange(analogpot1CC, analogpot1New, 1); 356// Serial.print 357 ("pot: "); 358// Serial.println(pot1); 359// Serial.print("potread: 360 "); 361// Serial.println(analogpot1New); 362 } 363 364 if (analogpot2New 365 - analogpot2Old >= 35 || analogpot2Old - analogpot2New >= 35) {////////////////////// 366 POTARD 2 ///////////////////////////////////////// 367 analogpot2Old = analogpot2New; 368 369 analogpot2New = (map(analogpot2New, 1023, 0, 0, 120)); 370 analogpot2New 371 = (constrain(analogpot2New, 0, 120)); 372 MIDI.sendControlChange(analogpot2CC, 373 analogpot2New, 1); 374// Serial.print ("pot: "); 375// Serial.println(pot2); 376// 377 Serial.print("potread: "); 378// Serial.println(analogpot2New); 379 380 } 381 382delay(25); 383}
Downloadable files
90304553_628621817916213_4590903500610732032_n_BVx5AuZ4U1.jpg
remember to remove the resistors to save. And replace in the declaration of PIN (INPUTPULLUP) by (INPUT) so that the arduino uses the resistance integrated in the card;) Then connect the buttons to the ground.
90304553_628621817916213_4590903500610732032_n_BVx5AuZ4U1.jpg
midi_wood_berru_J56DcE6Eiz.png
midi_wood_berru_J56DcE6Eiz.png
90304553_628621817916213_4590903500610732032_n_BVx5AuZ4U1.jpg
remember to remove the resistors to save. And replace in the declaration of PIN (INPUTPULLUP) by (INPUT) so that the arduino uses the resistance integrated in the card;) Then connect the buttons to the ground.
90304553_628621817916213_4590903500610732032_n_BVx5AuZ4U1.jpg
Documentation
video-1584886044_QRrkHS0Ndg.mp4
video-1584886044_QRrkHS0Ndg.mp4
Test in PCB
Pcb create via easy eda with arduino micro
Test in PCB
boitier final
Ajout d'un ecran lcd.
boitier final
midi_alpha_berru_iCIZTc9rCw.png
midi_alpha_berru_iCIZTc9rCw.png
midi_alpha_berru_face_J907vdkn9H.png
midi_alpha_berru_face_J907vdkn9H.png
video-1584886044_QRrkHS0Ndg.mp4
video-1584886044_QRrkHS0Ndg.mp4
midi_alpha_berru_face_J907vdkn9H.png
midi_alpha_berru_face_J907vdkn9H.png
midi_alpha_berru_iCIZTc9rCw.png
midi_alpha_berru_iCIZTc9rCw.png
Test in PCB
Pcb create via easy eda with arduino micro
Test in PCB
boitier final
Ajout d'un ecran lcd.
boitier final
Comments
Only logged in users can leave comments
gleberruyer
0 Followers
•0 Projects
Table of contents
Intro
16
0