Page 1 of 1

SenseHat Joystick events

Posted: Sun Jul 31, 2016 5:36 pm
by Stoop
If you look here https://pythonhosted.org/sense-hat/api/#joystick you will see this code:

Code: Select all

from sense_hat import SenseHat
from time import sleep

sense = SenseHat()
event = sense.stick.wait_for_event()
print("The joystick was {} {}".format(event.action, event.direction))
sleep(0.1)
event = sense.stick.wait_for_event()
print("The joystick was {} {}".format(event.action, event.direction))
When I run this, I get the following error:

Traceback (most recent call last):
File "/home/pi/scripts/joy1.py", line 5, in <module>
event = sense.stick.wait_for_event()
AttributeError: 'SenseHat' object has no attribute 'stick'


Anyone know what's up?

Re: SenseHat Joystick events

Posted: Mon Aug 01, 2016 11:28 am
by dgordon42
Is your Pi's software up to date?
There have been changes to the Sense Hat modules in the last month.
If your running Jessie,

Code: Select all

sudo apt-get update
sudo apt-get upgrade
should get you up to date.

Hope this helps,
Dave.

Re: SenseHat Joystick events

Posted: Mon Aug 01, 2016 2:48 pm
by Stoop
Yes, thanks Dave, I did perform an update just the other day and I am all up to date.

Re: SenseHat Joystick events

Posted: Mon Aug 01, 2016 3:44 pm
by ShiftPlusOne
The apt package hasn't been updated yet. Will get that fixed asap.

Re: SenseHat Joystick events

Posted: Mon Aug 08, 2016 10:49 am
by Davespice
They are available in pip already, see here: viewtopic.php?f=104&t=154230
But if you can wait a few days they should also be available in apt.