Page 1 of 1

Programming joystick in Sense HAT w/ Scratch?

Posted: Tue Jun 14, 2016 6:19 pm
by birv2
Did a search on this and nothing came up.....

Is it possible to control the joystick on the Sense HAT through Scratch? I've done it with Python but I'm planning on aiming this at beginning coders so Scratch seems a better fit at that level.

EDIT: looks like it is possible (https://www.raspberrypi.org/documentati ... /README.md). Has anyone tried it successfully?

TIA,
Bob Irving

Re: Programming joystick in Sense HAT w/ Scratch?

Posted: Wed Jun 15, 2016 7:01 am
by MarcScott
Yes, the Sense HAT joystick just maps to the cursor keys, so just using a `when up arrow key pressed` block, for instance, will let Scratch detect the use of the joystick.

Re: Programming joystick in Sense HAT w/ Scratch?

Posted: Wed Jun 15, 2016 12:17 pm
by birv2
Awesome. Thanks!

Re: Programming joystick in Sense HAT w/ Scratch?

Posted: Wed Jun 15, 2016 7:31 pm
by ghp
Hello,
the only not very perfect point is that the central button is mapped to the 'enter' key. The enter key is also the green flag event in scratch. So it can't be used to commit input, but always restarts the scratch program.
Regards,
Gerhard

Re: Programming joystick in Sense HAT w/ Scratch?

Posted: Wed Jun 15, 2016 7:38 pm
by birv2
Hmm. So pushing down on the joystick in the middle position = green flag?
That could be tricky.

Re: Programming joystick in Sense HAT w/ Scratch?

Posted: Wed Aug 30, 2017 1:49 pm
by DavTor
Has someone tried the joystick in Scratch 2 in Debian Stretch? The sensors and the LED matrix works well, but I can not use the joystick in Scratch 2. Someone else?. Thanks

Re: Programming joystick in Sense HAT w/ Scratch?

Posted: Wed Aug 30, 2017 6:10 pm
by mob-i-l
DavTor wrote:
Wed Aug 30, 2017 1:49 pm
Has someone tried the joystick in Scratch 2 in Debian Stretch? The sensors and the LED matrix works well, but I can not use the joystick in Scratch 2. Someone else?. Thanks
It works for me as the arrow keys events, and there is an "enter" among the keys, for the joystick press, which doesn't exist in standard Scratch 2.

E.g.

when enter key pressed

when down arrow key pressed

Re: Programming joystick in Sense HAT w/ Scratch?

Posted: Thu Aug 31, 2017 6:42 am
by DavTor
SOLVED. I'm sorry. It was because of the remote desktop connection. Thanks