subjektivdk
Posts: 9
Joined: Tue Sep 01, 2015 6:13 pm
Location: Denmark
Contact: Website

Menu system

Wed Sep 02, 2015 8:10 am

Does anyone have an idea to how to make a menu system that is easy to control using the joystick and LED display?
subjektiv.dk

scotty101
Posts: 3671
Joined: Fri Jun 08, 2012 6:03 pm

Re: Menu system

Wed Sep 02, 2015 8:23 am

How complex do you want it to be?

A simple menu could just be a python list (or dictionary) of menu options that are displayed on the screen and can be selected by moving the joystick or pressing the button. Moving the joystick left or right moves between menu items in the list.
Response of the menu might be a bit slow since writing to the screen prevents button presses being detected immediately.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5856
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Menu system

Wed Sep 02, 2015 9:04 am

Something like this has been developed for the astro pi mission. I don't know if it's going to be public, but I'll ask.

scotty101
Posts: 3671
Joined: Fri Jun 08, 2012 6:03 pm

Re: Menu system

Wed Sep 02, 2015 10:14 am

ShiftPlusOne wrote:Something like this has been developed for the astro pi mission. I don't know if it's going to be public, but I'll ask.
Is this the "Master Control Program"? I asked a similar question on the blog post. Don't think it was answered.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5856
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Menu system

Wed Sep 02, 2015 10:23 am

That's the one.

Still, developing your own would be more interesting. There's a lot of stuff in MCP that you'll never need, I think.

scotty101
Posts: 3671
Joined: Fri Jun 08, 2012 6:03 pm

Re: Menu system

Wed Sep 02, 2015 10:26 am

I had been going to develop one but got distracted writing a version of snake and pong!

Original Poster, if you have some more details about what you are looking for, I'll see if I have some time when I have my SenseHat handy.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5856
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Menu system

Wed Sep 02, 2015 10:54 am

scotty101 wrote:got distracted writing a version of snake
That was the first thing I did as well (/usr/src/sense-hat/examples)... maybe the software would be in a much better state if I didn't then get distracted playing it. :roll:

scotty101
Posts: 3671
Joined: Fri Jun 08, 2012 6:03 pm

Re: Menu system

Wed Sep 02, 2015 12:06 pm

Yeah I spotted that version after I wrote mine based on the python example "Wormy". I also made it so that the worm could wrap round the screens edges.

I still need to spend some time thinking about how to use one of the other keypress event libraries rather than pygame.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5856
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Menu system

Wed Sep 02, 2015 12:26 pm

scotty101 wrote:I still need to spend some time thinking about how to use one of the other keypress event libraries rather than pygame.
Have you seen this bunch of posts?
viewtopic.php?f=104&t=119025#p807878

scotty101
Posts: 3671
Joined: Fri Jun 08, 2012 6:03 pm

Re: Menu system

Wed Sep 02, 2015 12:33 pm

ShiftPlusOne wrote:
scotty101 wrote:I still need to spend some time thinking about how to use one of the other keypress event libraries rather than pygame.
Have you seen this bunch of posts?
viewtopic.php?f=104&t=119025#p807878
Yep, that was what started my thought process. I haven't decided which of the methods is most suitable for standalone Pi's where using PyGame is overkill. I think evdev will be the easiest apart from the fact that you have to map it to a specific input device.

Any idea what the real AstroPi uses?
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5856
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Menu system

Wed Sep 02, 2015 12:43 pm

scotty101 wrote:Any idea what the real AstroPi uses?
The parts I wrote (in C) access the input device directly, MCP uses python-evdev, and I think some student code uses pygame.
scotty101 wrote:the fact that you have to map it to a specific input device
Not quite, you can read from all the devices:
https://python-evdev.readthedocs.org/en ... le-devices

scotty101
Posts: 3671
Joined: Fri Jun 08, 2012 6:03 pm

Re: Menu system

Wed Sep 02, 2015 12:57 pm

ShiftPlusOne wrote:
scotty101 wrote:the fact that you have to map it to a specific input device
Not quite, you can read from all the devices:
https://python-evdev.readthedocs.org/en ... le-devices
Ahhh. I guess I could use glob to get all of the input devices and listen to all of them for specific key presses. I'd like to replicate the pygame functionality. I'll give it a bash tomorrow.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

subjektivdk
Posts: 9
Joined: Tue Sep 01, 2015 6:13 pm
Location: Denmark
Contact: Website

Re: Menu system

Thu Sep 03, 2015 8:46 am

scotty101 wrote:I had been going to develop one but got distracted writing a version of snake and pong!

Original Poster, if you have some more details about what you are looking for, I'll see if I have some time when I have my SenseHat handy.
I was thinking of something like the code used for the Pimoroni Display-O-Tron 3000 https://github.com/pimoroni/dot3k
subjektiv.dk

scotty101
Posts: 3671
Joined: Fri Jun 08, 2012 6:03 pm

Re: Menu system

Thu Sep 03, 2015 9:23 am

subjektivdk wrote:
scotty101 wrote: Original Poster, if you have some more details about what you are looking for, I'll see if I have some time when I have my SenseHat handy.
I was thinking of something like the code used for the Pimoroni Display-O-Tron 3000 https://github.com/pimoroni/dot3k
The Display-O-Tron has the advantage of multiple lines all shown simultaneously rather than a single line of scrolling text. An SenseHat menu would have to be a lot simpler.
Last edited by scotty101 on Thu Sep 03, 2015 9:46 am, edited 1 time in total.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

subjektivdk
Posts: 9
Joined: Tue Sep 01, 2015 6:13 pm
Location: Denmark
Contact: Website

Re: Menu system

Thu Sep 03, 2015 9:40 am

Yes I am aware of the need for it to be much simpler. But the functionality could be more or less the same - one would only be able to see one menu item at a time.
subjektiv.dk

User avatar
JSingleton
Posts: 18
Joined: Fri Jan 16, 2015 12:10 pm
Contact: Website

Re: Menu system

Fri Sep 04, 2015 4:15 pm

There is a new version of the display-o-tron: https://shop.pimoroni.com/collections/r ... o-tron-hat

The joystick (as used in the sense HAT) has been replaced with capacitative touch buttons.
Computing4Kids.com
@shutdownscanner
unop.uk

subjektivdk
Posts: 9
Joined: Tue Sep 01, 2015 6:13 pm
Location: Denmark
Contact: Website

Re: Menu system

Thu Sep 10, 2015 1:47 pm

scotty101 wrote:I had been going to develop one but got distracted writing a version of snake and pong!

Original Poster, if you have some more details about what you are looking for, I'll see if I have some time when I have my SenseHat handy.
Simple graphics for every menu item. Use joystick to move up/down, joystick press or right to select, left to leave menu item. Then the uo/down should just cycle the menu.
subjektiv.dk

Return to “Astro Pi”