-
Notifications
You must be signed in to change notification settings - Fork 0
/
RGB_encoder_panel.ino
55 lines (43 loc) · 1.76 KB
/
RGB_encoder_panel.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "chips.h"
#include "rotControls.h"
//----------variables for stepper leds -----need to change stepTime for BPM count or whatever
unsigned long previousMillis = 0;//temporary - for timing the stepper leds
unsigned long stepTime =150; //temporary - for timing the stepper leds
//--------------------------------setup()-----------------------------//
void setup(){
chipsBegin();//initialise the mcp23s17 chips
delay(400); //let things settle
setPins(); //set mcp chip pins to input or output
delay(400); //let things settle
//-----------do a startup led routine on the rotaries for DEBUG
startUp();
allKnobsOff1();//switch off all rotary led colours
delay(400);//keep things settled
}
//--------------------------------loop()-------------------------------//
void loop(){
//-------------led stepper-----------------------//
unsigned long currentMillis = millis();
if((currentMillis - previousMillis) > stepTime) {
previousMillis = currentMillis;
getStep();//change stepTime to bpm variable, using fixed value as DEBUG
}
//-----------read ports all the time, we are not using interupts-----//
for(volatile int yy=0; yy<8; yy++){
mcpChips[yy]=mcpArray[yy].readGpioPort();//read all chips
}
//---------check to see if a button has been pushed
checkRotButtons();///DEBUG - function contains a serial print for debug. Change to somethng useful
//---------see if rotary is sending a signal
checkRot();
for(int x=0;x<16;x++){
if(Counter[x] != oldCounter[x]){
/////DEBUG = do something if change in rotaries. change for something useful
Serial.print("rotary ");//debug
Serial.print(rotaryOrder[x]);//debug
Serial.print("...value = ");//debug
Serial.println(Counter[x]); //debug
oldCounter[x] =Counter[x];
}
}
}//end of loop