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