Timeline for Issues with Arduino UNO printing repeated "double" on serial monitor
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 30, 2020 at 15:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jul 31, 2020 at 13:19 | comment | added | JRobert | @Delta_G: "Doesn’t matter what IDE you use to write the code" - But it may matter if you use its in-built terminal emulator. | |
Jul 31, 2020 at 12:49 | answer | added | chrisl | timeline score: 1 | |
Jul 31, 2020 at 12:07 | comment | added | Avong | Dear Delta_G OK, i am noting all suggestions. Cheers! | |
Jul 31, 2020 at 12:05 | comment | added | Delta_G | It’s not necessary to have the delay if you write proper code to handle serial data. Have it look for an end marker before it does the comparison. Or have it wait until available returns the full length of the string before you start reading it. | |
Jul 31, 2020 at 12:04 | comment | added | Delta_G | Doesn’t matter what IDE you use to write the code the code is the same. The problem is that the serial data doesn’t come all at once. You get one character and read it and then before the next character arrives available is again 0 and you go off to compare your one character you read. While you’re doing that the rest of the string arrives. When you get back around you’ve now got the whole string. With the delay you’re giving the string time to complete arrive one letter at a time on the port. | |
Jul 31, 2020 at 11:53 | comment | added | Avong | Hello DataFiddler, You great, your suggestion works. it was just a case of delay which ignored. I actually added delay(10) in-between character reads. and no more print duplication. BUT WHY is that necessary? in eclipse i don't think i have that experience. IT WORTH NOTING WHEN USING ARDUINO IDE! | |
Jul 31, 2020 at 11:53 | history | edited | chrisl | CC BY-SA 4.0 |
added 178 characters in body
|
Jul 31, 2020 at 11:41 | comment | added | DataFiddler |
9600 Bd means 1ms per character. If there's no terminating character to rely on, simply waiting a few ms via delay(10); after the first Serial.available()> 0 is an ugly but doable alternative in this case.
|
|
Jul 31, 2020 at 11:14 | comment | added | Majenko | You have a fundamental misunderstanding of how serial communication works. You can't just read "while available" because that will not be true. You need to "read if available and up until the terminating character". | |
Jul 31, 2020 at 11:08 | review | First posts | |||
Jul 31, 2020 at 15:24 | |||||
Jul 31, 2020 at 11:07 | history | asked | Avong | CC BY-SA 4.0 |