-
Dear all, thank you for all your great work! 👍 Whatever I try on the LGT Nano style, the Software Serial is not operational. I try SoftwareSerial or PostNeoSWSerial, nothing works. The following code is able to send test strings to the hardware serial only: #include <SoftwareSerial.h>
//#include <PostNeoSWSerial.h>
const uint8_t RX = PB1;
const uint8_t TX = PB2;
SoftwareSerial swSerial(RX, TX);
//PostNeoSWSerial swSerial(RX, TX);
void setup() {
Serial.begin(115200);
while (!Serial)
{
// Wait for serial port to connect. Needed for native USB port only
delay(100);
}
// Define pin modes for TX and RX
pinMode(RX, INPUT);
pinMode(TX, OUTPUT);
swSerial.begin(9600);
}
void loop() { // run over and over
Serial.println("tick");
swSerial.println("tick");
/*while (swSerial.available()) {
Serial.write(swSerial.read());
}*/
while (Serial.available()) {
swSerial.write(static_cast<char>(Serial.read()));
}
delay(100);
} I think the software serial functionality is broken. Could someone please kindly share their working software serial example, and the corresponding LGT8FX platform version? Which Nano pins are capable to do software serial RX/TX? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I guess you want to use pins 9 and 10 as SoftwareSerial pins. Then you need to use these numbers: SoftwareSerial swSerial(9, 10); PB1 and PB2 are pins 9 and 10, but if you use PB1 and PB2 in your code, it just means 1 and 2. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, @wollewald 👍 . So I've confused Arduino pin numbers with Port/Pin numbers. When I return to Arduino coding, I always run into the same confusion. |
Beta Was this translation helpful? Give feedback.
-
Although with SoftwareSerial it works now, with PostNeoSWSerial I still get this: |
Beta Was this translation helpful? Give feedback.
I guess you want to use pins 9 and 10 as SoftwareSerial pins. Then you need to use these numbers:
SoftwareSerial swSerial(9, 10);
PB1 and PB2 are pins 9 and 10, but if you use PB1 and PB2 in your code, it just means 1 and 2.