Python reading serial port UART1



  • Greetings from Sunny South Africa! :)

    I have a nano spitting out sensor data to my onion via UART1 every 10 seconds or so. I can read the data perfectly using cat and screen but struggling to find a way to do this with python (which i have very little experience with).

    My needs are simple: read sensor data when UART1 has about 30 bytes of data, then write sensor data to a remote mysql server. Can anyone help point me in the right direction?

    Thanks in Advance! :)



  • Take a look at PySerial as described under "Using Python". Good luck with your project.



  • Thank you @Ken-Conrad ! I found a really good example of how to use PySerial on instructables that was written for Pi and it worked out well after i changed UART details. Now just to get mysql installed and we good to go! :)



Looks like your connection to Onion Community was lost, please wait while we try to reconnect.