Wondering if anyone has come across this, i am doing a time based project which requires me to dump the incoming serial buffer on occasion so that i don't have any lag,
anyway, I originally made the prog in Arduino 0022 and its been working great, but now I have upgraded to 1.0 the Serial.flush(); function doesn't work for incoming data, thus giving me my original problem.
Anyone know how to wipe the incoming buffer in 1.0?
Well, I don't really care about the data that I dumb because I'm only sampling for a certain number and then acting on if I receive that number or not, I have an overlap time there its is safe not to sample, so it seems to all work out in the end, though have had a few teething problems but that's just to do with stuff like thresholds, maybe I'm doing something not right but its been working great! I think!!
That last post didn't quite come out right, haha, anyway you get the jist of it, though how would I actually wipe the buffer, is it EEPROM memory or something?
PaulS to answer your question correctly, and maybe clarify what I'm actually trying to do, The reason i said that it reduces lag is that I have two xbee modules, one is on a continuous transmit loop, (every 0.5 seconds) and when i receive that signal i'm activating a relay, anyhow, when i go out of range the relay stays on for the same amount of time that i was in range, because it has stored up a huge amount of received data in the incoming buffer, therefor i must remove it before i sample again, this way when i go out of range it cuts off straight away.
anyhow, when i go out of range the relay stays on for the same amount of time that i was in range, because it has stored up a huge amount of received data in the incoming buffer
Not more than 32 bytes, since that is the incoming serial buffer size with 1.0. How long can it take to read and ignore, or not, 32 bytes?
Actually 32 (well 64) seconds, because its a delayed process, though good thought ill have a look at that. Could I use Serial.find to mod this? instead of trying to do it manually
I'd read 32 in other posts, and assumed that the information was accurate. You are correct; it was not.
In any case 32, 64, or 128, the previous buffer size, hardly qualifies as "a huge amount of received data in the incoming buffer". The Arduino can read and decide what to do with 128 bytes of data very quickly. The slow part might be actually using the data.
Actually on that subject, i assumed that "ATmega 328" meant 32 kb and 8 bit,when I compile it says of a 32256 maximum, is that flash then and not SRAM?