Tell us about yourself!
Hey, sorry for the late reply, I would imagine once you have a connection you can execute select commands as you would inserts. Give it a try with a select statement and check the MySQL library for how to read the result set to see if it works.
Hey,At first glance I would imagine it has to do with not reading successfully from the USB port. Try to log what the value of the line you read from the Arduino is to quickly check if it's actually getting data. I'd guess the index error comes from the pieces array at your insert line. You could simply check your split line result was an array with two array elements before trying the insert. I'm not familiar with the postgres library so I can't confirm it's not potentially something there. Hopefully that helps, let me know what you find.Best,Tom