/**************************************** * Pilotage d'actionneurs Interface-Z * carte 2 Servomoteurs 4 PWM (lampes, etc) * mode 128 pas - 7 bits. *****************************************/ // Importer la library the Midibus // http://smallbutdigital.com/themidibus.php import themidibus.*; MidiBus myBus; int[] actions = new int[8]; float angle = 0; void setup() { size(360, 180); // Liste des peripheriques Midi detectes MidiBus.list(); // MidiBus(this, port entrant In, port sortant Out) // CHOISIR LE BON NUMERO DE SORTIE myBus = new MidiBus(this, -1, 2); } void draw() { angle = angle + 0.02; actions[0] = int((sin(angle) * 64) + 63) ; // Premiere lampe actions[1] = int((sin(angle + PI/2) * 64) + 63) ; actions[2] = int((sin(angle + PI) * 64) + 63) ; actions[3] = int((sin(angle + 3*PI/2) * 64) + 63) ; actions[4] = int(map(sin(angle), -1.0, 1.0, 10, 116)) ; // Premier servo actions[5] = int(map(sin(angle + PI/2), -1.0, 1.0, 10, 116)) ; actions[6] = int(map(sin(angle + PI), -1.0, 1.0, 10, 116)) ; actions[7] = int(map(sin(angle + 3*PI/2), -1.0, 1.0, 10, 116)) ; //sendControllerChange(canal, numero, valeur) for (int i=0; i<8; i++) { myBus.sendControllerChange(0, i, actions[i]); // (canal, numero, valeur) } }