the next step will be to get the windspeed from these 2 raw values from that file:
i will probably add it this feature in the python script... guess something like that:
# Use lookup table to correct raw wind speed errors
def calc_wind_speed_ec(self, raw_mph, raw_angle):
# some sanitization: no corrections needed under 3 and no values exist above 150 mph
if raw_mph < 3 or raw_mph > 150:
return raw_mph
return self.windcal_tab[(raw_mph - 1) * 256 + raw_angle]
if you open the Serial port at 115200 bauds, your arduino should also be set at that speed or you won't get the data
that does not do anything useful. it just ensures that whatever was written to ser is sent... Since you did not write anything yet, it does nothing...
don't you want to read in a loop? a while would be better than a if
in my experience it's better to use a dedicated task to read the lines and store the lines in a queue to the arduino and another task that will unpile the lines from the queue and do the database stuff
if not you'll run into concurrency issues and risk loosing data on the serial port
yes i changed the baudrate according to your suggestions.
The script is triggered with crontab
ok i will delete ser.flush()
never used queue, is it really that much better jackson?
if you wanted to ensure there was nothing in the input buffer, you can use reset_input_buffer()
here you spit data out every 3s
if the database query does not last for more than 3s then you won't have an issue.
if it lasts longer or you accumulate delays after a while you'll start loosing incoming characters. It's not as bad as on the Arduino where the buffer is only 64 bytes deep, you probably will have 1kB or so but nevertheless if you keep this running for a looong time, it might be an issue.
start without it and if you notice you are getting garbage then you'll know where it comes from