Close

Python Threading

A project log for Gesture Controlled Smartwatch

A larger, more functional smartwatch with gesture controllability

thomas-mckinneyThomas McKinney 02/28/2019 at 22:330 Comments

So after the success of getting the FSR data from the Arduino to the Raspberry Pi, its time to get those values into the Kivy GUI in real time too. However, its not as simple as just copying the serial test code into the GUI unfortunately. As the serial read code is a loop of constantly checking the port for new information and then printing it if so, this loop causes a problem when running it inside the app loop of the GUI. The app (I believe) gets stuck in this serial read loop and cant complete the rest of the GUI code, and thus doesn't work. 

So after some research, I've come across a python coding concept called threading which I believe is my solution. Threading, as I understand it thus far, is the ability of running multiple threads at the same time essentially. These threads can be different process or functions etc. So in essence, I will have the GUI running in one, the serial reading in another which will feed its information into the GUI. Hopefully this will overcome the looping problem i'm facing.

Update on the other part of the project, I have brought a couple more sensors and changed the codes to reflect these extra sensors. 

Discussions