From 22ffaf6e00cb98be9b029c886bcfca39e53271af Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 13 Feb 2013 20:08:37 +0100 Subject: [PATCH] clear rep --- sketches/testing/_4051_test.ino | 42 --------- .../testing/midi_in_out_softwareserial.ino | 92 ------------------- 2 files changed, 134 deletions(-) delete mode 100644 sketches/testing/_4051_test.ino delete mode 100644 sketches/testing/midi_in_out_softwareserial.ino diff --git a/sketches/testing/_4051_test.ino b/sketches/testing/_4051_test.ino deleted file mode 100644 index 8b6d7bb..0000000 --- a/sketches/testing/_4051_test.ino +++ /dev/null @@ -1,42 +0,0 @@ -int tolerance = 4; - -const int s0 = 10; -const int s1 = 9; -const int s2 = 8; - -int pots[] = {-1,-1}; - -void setup() { - Serial.begin(9600); - pinMode(s0,OUTPUT); - pinMode(s1,OUTPUT); - pinMode(s2,OUTPUT); -} - -void loop() { - //get Y0 of 4051 - digitalWrite(s0, LOW); - digitalWrite(s1, LOW); - digitalWrite(s1, LOW); - int read = analogRead(A1); - //only print value on change (tolerance of 4 out of 1024) - if (pots[0] < read - tolerance || pots[0] > read + tolerance) { - pots[0] = read; - Serial.print("pot 0: "); - //print value between 0 & 127 like MIDI velocity ;) - Serial.print(pots[0]/8); - Serial.println(); - } - - //get Y1 of 4051, analog to Y0 - digitalWrite(s0, HIGH); - digitalWrite(s1, LOW); - digitalWrite(s1, LOW); - read = analogRead(A1); - if (pots[1] < read - tolerance || pots[1] > read + tolerance) { - pots[1] = read; - Serial.print("pot 1: "); - Serial.print(pots[1]/8); - Serial.println(); - } -} diff --git a/sketches/testing/midi_in_out_softwareserial.ino b/sketches/testing/midi_in_out_softwareserial.ino deleted file mode 100644 index c3f368f..0000000 --- a/sketches/testing/midi_in_out_softwareserial.ino +++ /dev/null @@ -1,92 +0,0 @@ -#include - -// RX, TX for MIDI out -SoftwareSerial MIDI(10, 11); - -//button pin -const int switchPin = 6; -//rotary encoder pins -const int encAPin = 4; -const int encBPin = 5; - -//for sending note-off once after button is released -boolean btnOff = false; - -//old rotary encoder value -int encA = LOW; -//read rotary encoder value -int enc = HIGH; - -void setup() -{ - //printing baudrate - Serial.begin(9600); - //MIDI baudrate for software serial (pin 10 & 11) - MIDI.begin(31250); - //button and encoder pins as input - pinMode(switchPin, INPUT); - pinMode(encAPin, INPUT); - pinMode(encBPin, INPUT); - //activate pullup-resistors (read value is inverted, so LOW is active) - digitalWrite(switchPin, HIGH); - digitalWrite(encAPin, HIGH); - digitalWrite(encBPin, HIGH); -} - -void loop() -{ - //print incoming bytes on softwareserial, just for checking MIDI-in, worked - if (MIDI.available()) - Serial.println(MIDI.read()); - - //check if button is pressed - if (digitalRead(switchPin) == LOW) - { - if (!btnOff) { - //send note on - midiSignal(144,60,100); - btnOff = true; - } - } - if (digitalRead(switchPin) == HIGH) - { - //send note off - if (btnOff) { - midiSignal(128,60,0); - btnOff = false; - } - } - - //read encoder pin A - enc = digitalRead(encAPin); - //check if rotary encoder is turned - if ((encA == HIGH) && (enc == LOW)) { - //check direction of turning - if (digitalRead(encBPin) == HIGH) { - //send note on and note off directly, so signal is send on every turn - midiSignal(144,62,100); - midiSignal(128,62,100); - } else { - //other direction, other note value - midiSignal(144,61,100); - midiSignal(128,61,100); - } - } - //save "old" encoder value - encA = enc; -} - -//send MIDI signal through softwareserial -void midiSignal(byte b1, byte b2, byte b3) { - //debug printing - Serial.print("send: "); - Serial.print(b1); - Serial.print(" | "); - Serial.print(b2); - Serial.print(" | "); - Serial.print(b3); - Serial.println(""); - MIDI.write(b1); - MIDI.write(b2); - MIDI.write(b2); -}