Hello Everyone, Trying to use a UDOOneo to receive and send serial data from my PC to test a communication protocol I am trying (trying being the key word) to write. Anyways using the following code I should be able to see a single byte being received but nothing happens in the Serial Monitor window, but I am not super familiar with programming for adruino so I may be missing something obvious int incomingByte = 0; void setup() { Serial.begin(9600, SERIAL_8N1); } void loop() { if (Serial0.available() > 0) { //receive input incomingByte = Serial0.read(); //say what you got Serial0.print("I received: "); Serial0.println(incomingByte); }
The Neo arduino has 2 serial devices, Serial and Serial0. Serial is connected to the Linux side, Serial0 is connected to pin 0 and 1. You are mixing the devices in your sketch. Replace Serial0 by Serial and it will work.
I have tried using Serial, and Serial1 but neither appear available to me, by running the code below int incomingByte = 0; void setup() { Serial.begin(9600, SERIAL_8N1); } void loop() { if (Serial0.available() > 0) { digitalWrite(13, HIGH); //Turn LED ON when Serial Available //receive input incomingByte = Serial0.read(); //say what you got Serial0.print("I received: "); Serial0.println(incomingByte); } else digitalWrite(13, LOW); //Turn LED OFF when Serial not available }
Try this and send a character to the Arduino side with the Arduino IDE serial monitor. Check the examples in the documentation: https://www.udoo.org/docs-neo/Serial_Libraries/index.html Also check my tutorials that discuss this communication between linux and Neo Arduino. Howto Neo IoT Sensors, Howto Neo Webcontrol Code: int incomingByte = 0; void setup() { Serial.begin(); } void loop() { if (Serial.available() > 0) { digitalWrite(13, HIGH); //Turn LED ON when Serial Available //receive input incomingByte = Serial.read(); //say what you got Serial.print("I received: "); Serial.println(incomingByte); } else digitalWrite(13, LOW); //Turn LED OFF when Serial not available }