-
Notifications
You must be signed in to change notification settings - Fork 0
/
knob_seq_Interrupt_Test.ino
34 lines (32 loc) · 1.06 KB
/
knob_seq_Interrupt_Test.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//TODO: TEST THIS.
const byte clockPin = 2;
const byte writePin = 3;
int sensorValue, lastsensorValue;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
//RESET is connect-to-low
//writePin is all on-board, so we can take it low to trigger
pinMode(writePin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(writePin), writeRoutine, FALLING);
//clockPin will take a Eurorack rising voltage, so it doesn't use
//INPUT_PULLUP and it triggers on the rising voltage
attachInterrupt(digitalPinToInterrupt(clockPin), clockRoutine, RISING);
}
// the loop routine runs over and over again forever:
void loop() {
sensorValue = analogRead(A0);
// print out the value you read:
if(sensorValue!=lastsensorValue){
Serial.println(sensorValue);
lastsensorValue=sensorValue;
}
delay(1); // delay in between reads for stability
}
void clockRoutine(){
Serial.println("Clock Recieved.");
}
void writeRoutine(){
Serial.println("Write Recieved.");
}