Simpler serial read
With chars instead of strings.
This commit is contained in:
parent
d9814ec1a2
commit
ba628fc65b
1 changed files with 5 additions and 4 deletions
|
@ -41,14 +41,15 @@ void setup() {
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
// SERIAL
|
// SERIAL
|
||||||
while (Serial.available()) {
|
while ( Serial.available() > 0 ) {
|
||||||
String rcv_sr = Serial.readString();
|
int rcv_sr = Serial.read();
|
||||||
|
|
||||||
// Send data to serial port
|
// Send data to serial port
|
||||||
Serial.println("RX serial: " + rcv_sr);
|
Serial.print("RX serial: ");
|
||||||
|
Serial.println(rcv_sr, DEC);
|
||||||
|
|
||||||
// Switch LEDs
|
// Switch LEDs
|
||||||
switch (rcv_sr[0]) {
|
switch (rcv_sr) {
|
||||||
case 'g' :
|
case 'g' :
|
||||||
led_allOff();
|
led_allOff();
|
||||||
led_greenLine();
|
led_greenLine();
|
||||||
|
|
Loading…
Reference in a new issue