Read 32 ints Arduino Serial

  • Yes I work with [rafprojet]

  • Thanks for moving the forum location [sterretje]

  • With an Arduino Uno I can send via the Serial Monitor in Arduino IDE with ctrl+v and enter sent every 0.02 sec

  • So with the recvWithStartEndMarkers found in Serial Input Basics
    I see in another function :

if(newData){
    newData = false;

And I look at receivedChars but the big issue is that I can send (ASCII I think)
<1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 > And I will work than I send it again, it works, but at random attempts (1st or 11th or 19th), it will not get a space or an integer, and it will mess with all the data.

  • This problem of random data loses is the same when I tried myself a succession of if Serial.available() => Serial.read(); But it will also loose data at some point
  • I have tried the Serial.parseInt() but it will wait like 0.3 sec before processing
  • All those tests are in the pure Loop() function, with 0 other code.
  • The perfection should be 64 ints, because I have an array of 64 values and the goal is to say that each int in Serial go in my array. And when I tried with 8 values it was 'quite' ok
  • Changing Serial.begin(115200); or Serial.begin(9600); don't change anything
  • What is weird is that on wokwi.com a simulation of Arduino, I have the same issue
  • The bug is before, but after the code, I use isDigit() on the j receivedChars[j]
    then j+1 then and that's how I get 16 integer