I've got a problem I just can't figure out. The idea for arduino is to listen to serial port and execute function calls based on a single character it receives...however, at the same time I'd like arduino to send sensor data to the computer every 10 seconds but I'm stuck on how to do that.
First I figured I'd just run two different python scripts (one that runs in every 10 seconds sending character 'a' to get the sensor data and the other that is waiting for a character input (other than 'a') and then sending that to arduino. This ofcourse creates a port in use error when it happens to run at the same time.
Are there any good ways to do this? Ideal would be that arduino waits for serial input for ~9 secs and then executes the sensor read and sends the data and goes back to waiting state. But on the other hand, for that ~1 secs it wouldn't be listening to serial port.