
DrColossus
Ich spiel das Solo in 4'33''
to whom it may concern (markboombastik):
ich hab meinen Fußschalter für den Alleinunterhalter von heute endlich am laufen!
Das Ding hat vier Fußtaster (die Teile für Gitarreneffekte, schließt beim drücken) und dazu 4 LEDs, die als optische Rückmeldung kurz blinken.
Die Taster sind:
- a/b
- c/d
- prev pattern
- next pattern
benötigte Teile:
- 4x Fußtaster
- 4x LED
- 4x passende Vorwiderstände für die LEDs (ja nach Helligkeitsbedürfnis)
- 1x Midi-Buchse (DIN)
- 1x 220 Ohm Widerstand
- 1x Arduino-Board
- passendes Gehäuse
- n büschn Kabel
(den LED-Kram kann man auch einfach weglassen wenn mans nicht braucht)
der Code ist von http://arduino.cc/playground/Learning/MidiFoot und dann recht stümperhaft für meine Zwecke umgebaut.
Falls ein Arduino-Profi das nochmal sauber machen will - gerne!
Viel Spaß beim nachbasteln!
ich hab meinen Fußschalter für den Alleinunterhalter von heute endlich am laufen!
Das Ding hat vier Fußtaster (die Teile für Gitarreneffekte, schließt beim drücken) und dazu 4 LEDs, die als optische Rückmeldung kurz blinken.
Die Taster sind:
- a/b
- c/d
- prev pattern
- next pattern
benötigte Teile:
- 4x Fußtaster
- 4x LED
- 4x passende Vorwiderstände für die LEDs (ja nach Helligkeitsbedürfnis)
- 1x Midi-Buchse (DIN)
- 1x 220 Ohm Widerstand
- 1x Arduino-Board
- passendes Gehäuse
- n büschn Kabel
(den LED-Kram kann man auch einfach weglassen wenn mans nicht braucht)
der Code ist von http://arduino.cc/playground/Learning/MidiFoot und dann recht stümperhaft für meine Zwecke umgebaut.
Falls ein Arduino-Profi das nochmal sauber machen will - gerne!

// midi-foot-controller for Elektron Octatrack
// original code written by The Cat Herder, changed for use with OT by haeska (unprofessional)
// Sends midi-messages for a/b, c/d, prev pattern and next pattern
// Constants
#define SWITCH1 2
#define SWITCH2 3
#define SWITCH3 4
#define SWITCH4 5
#define LED1 7
#define LED2 8
#define LED3 9
#define LED4 10
#define BOUNCEDELAY 25
// Variables:
int switches[4] = { SWITCH1, SWITCH2, SWITCH3, SWITCH4 };
int switchState[4] = { HIGH, HIGH, HIGH, HIGH };
// Initial state of switch is high due to internal pullup
int leds[4] = { LED1, LED2, LED3, LED4 };
int currentSwitch = 0;
int currentProgram = 1; // current program - sent to the output
int bypassState = LOW; // state of bypass pedal
int pedalActiveFlash = 50; // Delay for flash when pedal is pressed
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
//Serial.begin( 9600);
// Setup Switches and activation LEDs
for( currentSwitch = 0; currentSwitch < 4; currentSwitch++ ) {
pinMode( switches[currentSwitch], INPUT ); // Set pin for switch
digitalWrite( switches[currentSwitch], HIGH ); // Turn on internal pullup
pinMode( leds[currentSwitch], OUTPUT ); // Set pin for LED
flashPin( leds[currentSwitch], 100 ); // Flash LED
}
}
void loop() {
for( currentSwitch = 0; currentSwitch < 4; currentSwitch++ ) {
if((digitalRead(switches[currentSwitch]) != switchState[currentSwitch] )&&(switchState[currentSwitch] == HIGH)){
switch( currentSwitch ) {
case 0:
//Record, Button a/b on Octatrack
if( bypassState == LOW ) {
bypassState = HIGH;
noteOn( 0x93, 0x3d, 0x7F );
digitalWrite( leds[currentSwitch], LOW );
}
else {
bypassState = LOW;
noteOn( 0x93, 0x3d, 0x7F );
digitalWrite( leds[currentSwitch], HIGH );
}
break;
case 1:
//Play, Button c/d on Octatrack
if( bypassState == LOW ) {
bypassState = HIGH;
noteOn( 0x93, 0x40, 0x7F ); // bypass off
digitalWrite( leds[currentSwitch], LOW );
}
else {
bypassState = LOW;
noteOn( 0x93, 0x40, 0x7F ); // bypass on
digitalWrite( leds[currentSwitch], HIGH );
}
break;
case 2:
//Prev Program
currentProgram = currentProgram--;
if( currentProgram < 1 )
currentProgram = 0; // Don't go lower than 0
midiProg( 0xC0, currentProgram );
flashPin( leds[currentSwitch], pedalActiveFlash );
break;
case 3:
// Next Program
currentProgram = currentProgram++;
if( currentProgram > 16 )
currentProgram = 16; // Don't go lower than 97
midiProg( 0xC0, currentProgram );
flashPin( leds[currentSwitch], pedalActiveFlash );
break;
}
delay( BOUNCEDELAY );
}
switchState[currentSwitch] = digitalRead( switches[currentSwitch] );
}
}
// Send a three byte midi message
void noteOn(char status, char data1, char data2) {
Serial.print(status, BYTE);
Serial.print(data1, BYTE);
Serial.print(data2, BYTE);
}
// Send a two byte midi message
void midiProg(char status, int data ) {
Serial.print(status, BYTE);
Serial.print(data, BYTE);
}
void flashPin( int ledPin, int flashDelay ) {
digitalWrite( ledPin, HIGH );
delay( flashDelay );
digitalWrite( ledPin, LOW );
}
Viel Spaß beim nachbasteln!