Chat here about code rewrites, mods, etc... with respect to the github project https://github.com/esp8266/Arduino

Moderator: igrr

User avatar
By russmathis
#16603 The following code works ok. It should send "test" to the serial monitor every second.
void setup(){
Serial.begin(9600);
while(true){
Serial.println("test");
delay(1000);
}
}
void loop(){}

However, the folling code does not work, nothing is output to the serial monitor;
void setup(){
while(true){
Serial.println("test");
delay(1000);
Serial.swap(); //just testing if I can flip back and forth first
delay(1000); //maybe should not use delay? block interrupts?
Serial.swap();
}
void loop(){}

The goal is to collect input from an RFID device on pins 15 & 13 but if the above don't work
I suspect waiting for input on the swaped lines wont work either. Actually I tried already
and went back to this simple routine to test functionality with no success.

Anyone have any ideas?

One thought I'll try next is to delay without using delay(1000). Perhaps a while((millis()-startMillis)<1000)

Thanks.