Posts: 1
Joined: Sun Jul 15, 2018 1:18 pm

fixing frame rate on senseHAT using python

Thu Aug 09, 2018 8:38 am

i found a roll a die script on the internet and started editing it so i can kinda learn how to write python scripts and everything went okay till i tried it on my SenseHAT. i made it so that if i pushed the button that the rolladie() function started but if i press it it just changed once, while if i pressed it for a little while it kept changing for the time i pressed it but that's where it started glitching with the led`s and having trouble displaying the right image. so i googled "how can i fix the frame rate on my RPI SenseHAT in python". first result was: watch -n 0.1 date +%N, seeing it wasn't python (for all i know) i added: from subprocess import call. but when i try to run it i get an syntax error marking the 0.1
any idea how to fix this??

User avatar
Posts: 5180
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: fixing frame rate on senseHAT using python

Sat Aug 11, 2018 12:07 pm

If you had added the link to that page we could have said something about that solution.
Have you tried to run the "watch .... " command in a terminal ? I dont believe that command returns/ends so your program might just stop there if you call it from python.

User avatar
Posts: 3656
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: fixing frame rate on senseHAT using python

Sat Aug 11, 2018 5:44 pm

If you try and update them too quickly, you start to get a wave/rolling effect through the LEDs, basically as they are not all refreshed at the same instance.

I can't remember have quickly they can 'really' go, but I think it is supposed to be 60fps max.
So slow it down to less than that.
Try sleep commands?

Return to “Python”