Skip to main content

Timeline for Random number/sequence output

Current License: CC BY-SA 4.0

14 events
when toggle format what by license comment
Jan 31, 2019 at 2:06 vote accept Samir Izmier Chong
Jan 31, 2019 at 1:03 answer added Samir Izmier Chong timeline score: 1
Jan 30, 2019 at 8:54 history edited Samir Izmier Chong CC BY-SA 4.0
edited body
Jan 29, 2019 at 8:27 comment added Samir Izmier Chong @chrisl About the SerialUSB, you are right; its the same thing as Serial. As for the randomized order, I wonder that myself ¯_(ツ)_/¯
Jan 29, 2019 at 7:57 comment added chrisl Why do you use SerialUSB in your setup function, but Serial in the rest of the code? I'm not sure, what happens on an Arduino with only one serial interface, when using SerialUSB, but on other boards (as I recall the Due for example) These two are complete different interfaces. Though I don't see, how you can get this randomized order due to this.
Jan 29, 2019 at 7:50 comment added Samir Izmier Chong @chrisl Thank you for the link. I (somewhat) understand now how Serial.read works, but I still cannot pause the loop until the second name input and register it into record[i].naming, thus the random sequences caused by random loop exits.
Jan 28, 2019 at 14:45 comment added chrisl The problem, that Juraj mentioned, is that you seem to think, that all the data from one name input will arrive as a big chunk, so that the while loop will only exit, when a full name has been read. That is not the case. There might be pauses between arbitrary bytes in the stream, for example introduced from the OS of the PC. The while loop will often exit, before a full name is read. You can use the something like the readline function here: majenko.co.uk/blog/reading-serial-arduino
Jan 28, 2019 at 7:46 comment added Samir Izmier Chong @Juraj I would appreciate it if you can point me to any info on the topic
Jan 28, 2019 at 7:30 comment added Juraj your algorithm for reading the names is based on misunderstanding how Serial input works
Jan 28, 2019 at 6:24 comment added Samir Izmier Chong @Juraj Nope still the same, though I also tried if(int i; i<2; i++) to no avail...
Jan 28, 2019 at 6:07 comment added Juraj change ++i to i++
Jan 28, 2019 at 5:13 history edited Samir Izmier Chong
Additional tags
Jan 28, 2019 at 5:05 review First posts
Jan 28, 2019 at 8:36
Jan 28, 2019 at 5:02 history asked Samir Izmier Chong CC BY-SA 4.0