Changing Control Scheme to Serial Reading
This commit is contained in:
parent
a7cf62b9eb
commit
8b2a97b364
@ -13,6 +13,8 @@ struct Button {
|
|||||||
bool pressed;
|
bool pressed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Panel [led0,led1,led2,led3];
|
||||||
|
|
||||||
// Defining BOOT button on ESP32 as our built-in button.
|
// Defining BOOT button on ESP32 as our built-in button.
|
||||||
Button button1 = {INTERRUPT_PIN, 0, false};
|
Button button1 = {INTERRUPT_PIN, 0, false};
|
||||||
|
|
||||||
@ -209,25 +211,23 @@ void dmxSetup() {
|
|||||||
Serial.print("Done");
|
Serial.print("Done");
|
||||||
|
|
||||||
// ...and then set the communication pins!
|
// ...and then set the communication pins!
|
||||||
const int tx_pin = 18;
|
const int tx_pin = 23;
|
||||||
const int rx_pin = 5;
|
const int rx_pin = 22;
|
||||||
const int rts_pin = 21;
|
const int rts_pin = 21;
|
||||||
Serial.printf("\nSetting up pin %d as Transmit Pin, pin %d as Receive Pin and pin %d as RTS Pin... ", tx_pin, rx_pin, rts_pin);
|
Serial.printf("\nSetting up pin %d as Transmit Pin, pin %d as Receive Pin and pin %d as RTS Pin... ", tx_pin, rx_pin, rts_pin);
|
||||||
dmx_set_pin(dmx_num, tx_pin, rx_pin, rts_pin);
|
dmx_set_pin(dmx_num, tx_pin, rx_pin, rts_pin);
|
||||||
Serial.print("Done\n");
|
Serial.print("Done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int serialRead(){
|
void serialRead(){
|
||||||
int incomingByte;
|
String incomingByte;
|
||||||
if (Serial.available() > 0) {
|
if (Serial.available() > 0) {
|
||||||
// read the incoming byte:
|
// read the incoming byte:
|
||||||
incomingByte = Serial.read();
|
incomingByte = Serial.readStringUntil('\r\n');
|
||||||
|
Serial.print("\nI received: ");
|
||||||
// say what you got:
|
Serial.print(incomingByte);
|
||||||
Serial.print("I received: ");
|
mode = incomingByte.toInt();
|
||||||
Serial.println(incomingByte, DEC);
|
|
||||||
}
|
}
|
||||||
return incomingByte;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
@ -254,4 +254,5 @@ void loop() {
|
|||||||
dmx_wait_sent(DMX_NUM_1, DMX_TIMEOUT_TICK);
|
dmx_wait_sent(DMX_NUM_1, DMX_TIMEOUT_TICK);
|
||||||
// Now write the packet synchronously!
|
// Now write the packet synchronously!
|
||||||
dmx_write(DMX_NUM_1, dataSeq[mode], 100);
|
dmx_write(DMX_NUM_1, dataSeq[mode], 100);
|
||||||
|
serialRead();
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user