Initial commit

This commit is contained in:
Lukas Bachschwell 2015-11-20 17:00:38 +01:00
commit 5f0dc82993
2 changed files with 139 additions and 0 deletions

136
PringlesLooper.ino Executable file
View File

@ -0,0 +1,136 @@
#include <MIDI.h>
bool oldValues[9] = {
1, 1, 1, 1, 1, 1, 1, 1, 1};
int tempState = 1;
int time = 0;
int bar = 1;
int pedalNote = 10;
int clearNote = 9;
void tick()
{
if (time == 24)
time = 0;
if (bar == 4)
bar = 0;
if((time == 0)&&(bar == 0))
digitalWrite(13,HIGH);
if(time == 3)
digitalWrite(13,LOW);
if(time == 0)
bar++;
if((time == 0)&&(bar != 0))
digitalWrite(12,HIGH);
if(time == 3)
digitalWrite(12,LOW);
time++;
}
void goClock()
{
time = 0;
bar = 0;
}
void stopClock()
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
}
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDI.setHandleClock(tick);
MIDI.setHandleStart(goClock);
// MIDI.setHandleContinue(goClock);
MIDI.setHandleStop(stopClock);
//Modeled
digitalWrite(11,HIGH);
}
void loop() {
MIDI.read();
for(int i = 2; i <= 10; i++) {
tempState = digitalRead(i);
if(tempState != oldValues[i-2])
{
// debouncetime
delay(1);
tempState = digitalRead(i);
if(tempState != oldValues[i-2]){
if(i == 10)
{
if(tempState == 0)
MIDI.sendNoteOn(pedalNote, 127, 1);
else
MIDI.sendNoteOff(pedalNote, 0, 1);
}
else if(i == 7)
{
if(tempState == 0){
if(pedalNote == 10)
{
pedalNote = 11;
clearNote = 13;
digitalWrite(11,LOW);
}
else{
pedalNote = 10;
clearNote = 9;
digitalWrite(11,HIGH);
}
}
}
else if(i == 9)
{
if(tempState == 0)
MIDI.sendNoteOn(clearNote, 127, 1);
else
MIDI.sendNoteOff(clearNote, 0, 1);
}
else
{
if(tempState == 0)
MIDI.sendNoteOn(i, 127, 1);
else
MIDI.sendNoteOff(i, 0, 1);
}
}
}
oldValues[i-2] = tempState;
}
}

3
README.md Normal file
View File

@ -0,0 +1,3 @@
The Pringles Looper features a Midicontroller in a pringlescan with several pedals,
buttons and leds to control Loopy on an ios device.