ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray
Statistics: Posted by thomaschamotte — 23 Aug 2017, 17:04
Statistics: Posted by oli_lab — 22 Aug 2017, 21:56

Statistics: Posted by thomaschamotte — 21 Aug 2017, 22:17
Statistics: Posted by oli_lab — 21 Aug 2017, 20:06



Statistics: Posted by thomaschamotte — 21 Aug 2017, 00:41
Statistics: Posted by oli_lab — 19 Aug 2017, 20:58
Indeed you are rightok
first thing to do is having a correct program for the teensy, and from what I saw, you need help !
on the teensy side, you need a program that gets midi and commands digital outputs for the optocouplers :
#define channel_opto 1
#define opto1 1 //change to another digital pin to fit your schematics
#define opto2 2 // idem
#define opto3 3 // idem
#define CCopto1 100 //CC#100 commande opto 1
#define CCopto2 102
#define CCopto3 103
#define impulseLength 100 //impulse is 100ms wide
byte token1 = 0;
byte token2 = 0;
byte token3 = 0;
#define MIDI_ON
void setup() {
// put your setup code here, to run once:
pinMode(opto1, OUTPUT);
pinMode(opto2, OUTPUT);
pinMode(opto3, OUTPUT);
#ifdef MIDI_ON
usbMIDI.setHandleControlChange(OnControlChange); //will handle control change only
#endif
} //end setup
// midi callbacks :
void OnControlChange(byte channel, byte control, byte value) {
if (channel == channel_opto) {
switch (control) {
case CCopto1: //make a impulse
if (value > 64 && token1 == 0) {
digitalWrite(opto1, HIGH);
delay(impulseLength);
digitalWrite(opto1, LOW);
}
else if (value < 64 && token1 == 1) {
token1 == 0;
}
break;
case CCopto2: //make a impulse
if (value > 64 && token2 == 0) {
digitalWrite(opto2, HIGH);
delay(impulseLength);
digitalWrite(opto2, LOW);
}
else if (value < 64 && token2 == 1) {
token2 == 0;
}
break;
case CCopto3: //make a impulse
if (value > 64 && token3 == 0) {
digitalWrite(opto3, HIGH);
delay(impulseLength);
digitalWrite(opto3, LOW);
}
else if (value < 64 && token3 == 1) {
token3 == 0;
}
break;
default :
break;
}
}
else {}
}
void loop() {
// put your main code here, to run repeatedly:
// nada
}
Statistics: Posted by thomaschamotte — 19 Aug 2017, 20:12

Statistics: Posted by thomaschamotte — 19 Aug 2017, 19:38
Statistics: Posted by oli_lab — 19 Aug 2017, 19:09




Statistics: Posted by thomaschamotte — 19 Aug 2017, 17:01
Statistics: Posted by oli_lab — 19 Aug 2017, 14:19
Statistics: Posted by thomaschamotte — 19 Aug 2017, 04:35
Statistics: Posted by thomaschamotte — 23 Aug 2017, 17:04
Statistics: Posted by oli_lab — 22 Aug 2017, 21:56

Statistics: Posted by thomaschamotte — 21 Aug 2017, 22:17
Statistics: Posted by oli_lab — 21 Aug 2017, 20:06



Statistics: Posted by thomaschamotte — 21 Aug 2017, 00:41
Statistics: Posted by oli_lab — 19 Aug 2017, 20:58
Indeed you are rightok
first thing to do is having a correct program for the teensy, and from what I saw, you need help !
on the teensy side, you need a program that gets midi and commands digital outputs for the optocouplers :
#define channel_opto 1
#define opto1 1 //change to another digital pin to fit your schematics
#define opto2 2 // idem
#define opto3 3 // idem
#define CCopto1 100 //CC#100 commande opto 1
#define CCopto2 102
#define CCopto3 103
#define impulseLength 100 //impulse is 100ms wide
byte token1 = 0;
byte token2 = 0;
byte token3 = 0;
#define MIDI_ON
void setup() {
// put your setup code here, to run once:
pinMode(opto1, OUTPUT);
pinMode(opto2, OUTPUT);
pinMode(opto3, OUTPUT);
#ifdef MIDI_ON
usbMIDI.setHandleControlChange(OnControlChange); //will handle control change only
#endif
} //end setup
// midi callbacks :
void OnControlChange(byte channel, byte control, byte value) {
if (channel == channel_opto) {
switch (control) {
case CCopto1: //make a impulse
if (value > 64 && token1 == 0) {
digitalWrite(opto1, HIGH);
delay(impulseLength);
digitalWrite(opto1, LOW);
}
else if (value < 64 && token1 == 1) {
token1 == 0;
}
break;
case CCopto2: //make a impulse
if (value > 64 && token2 == 0) {
digitalWrite(opto2, HIGH);
delay(impulseLength);
digitalWrite(opto2, LOW);
}
else if (value < 64 && token2 == 1) {
token2 == 0;
}
break;
case CCopto3: //make a impulse
if (value > 64 && token3 == 0) {
digitalWrite(opto3, HIGH);
delay(impulseLength);
digitalWrite(opto3, LOW);
}
else if (value < 64 && token3 == 1) {
token3 == 0;
}
break;
default :
break;
}
}
else {}
}
void loop() {
// put your main code here, to run repeatedly:
// nada
}
Statistics: Posted by thomaschamotte — 19 Aug 2017, 20:12

Statistics: Posted by thomaschamotte — 19 Aug 2017, 19:38
Statistics: Posted by oli_lab — 19 Aug 2017, 19:09




Statistics: Posted by thomaschamotte — 19 Aug 2017, 17:01
Statistics: Posted by oli_lab — 19 Aug 2017, 14:19
Statistics: Posted by thomaschamotte — 19 Aug 2017, 04:35