IndexError: list index out of range


Hello everybody,

I am doing a project for a student at my University, and I chose the Dash Daq solution to setting up an instrumentation interface in Python 3 for a nut counter.

I am using an Arduino Mega 2560 that sends by serial interface a string of data to my laptop computer.
The data is split with the split() function, and in the end, only one value from the list must be selected and shown on a Dash DAQ gauge.

The only problem is nothing is shown on the gauge. I am using a print() function to see whether if the data is sent and split correctly, and it actually is. So the only problem I see here is either with the link between the backend functions and the frontend, or something that is incorrectly written in the function to display the data on the gauge. I shoud specify here, that the data comming from the Arduino is Float, not integer. Maybe that is the problem, I don’t know.

I am attaching the python 3 code and error log here for anyone willing to quickly, and urgently help me figure out this annoying problem:

Please can anyone urgently help me?
I would be eternally grateful!
I would also appreciate if anyone would also post the solution code.


Hello everybody.

Solved the problem. It seems there was a problem with the split() function. I gives out string values instead of integers, so I used int(float(pieces[8])) functions to fix the issue.

Now the gauge shows live real values. The only problem now remains that after approximately 1 minute, it suddenly freezes on one value, and I have to reset the page in order to start the readings again.

Any further help would be much appreciated.