element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sci Fi Your Pi
  • Challenges & Projects
  • Design Challenges
  • Sci Fi Your Pi
  • More
  • Cancel
Sci Fi Your Pi
Blog I Ching Week 5: Video Evidence
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: taodude
  • Date Created: 17 Jun 2015 10:28 PM Date Created
  • Views 749 views
  • Likes 2 likes
  • Comments 4 comments
  • i_ching_hexagrams
  • sci_fi_your_pi
  • sci_fi_pi
Related
Recommended

I Ching Week 5: Video Evidence

taodude
taodude
17 Jun 2015

Introduction

 

Welcome to Week 5 of the I Ching hexagrams project.  At a last I have the code stable enough to create a video to show what i have achieved.  It might not look that impressive, but I have managed to get (most of) the bugs out of the start-up code so that the display output is reasonably predictable.

image

 

What I Have Done So Far

 

The code that underlies this little video consists of the following elements:

  • Introductory Splash screen based on the sysinfo.py module from the PiFaceCAD library, but adapted to include alternation between a fixed text instruction page and an animated depiction of the I Ching characters.  They should be displayed vertically as in the graphic above to represent the way the Chinese would write them, but the PiFaceCAD display needs to be horizontally aligned for the Western characters to display correctly
  • Menu choices based on the radio.py module in the PiFaceCAD library, but adapted to deal with multiple menu levels.
  • Background program modules to handle the routine tasks.
  • Interrupt handlers to process the switch presses
  • creation of a global 'menus' class to manage passing of control tokens between the background code and the interrupt handlers and to control the transition between menus by passing pointer values.

Implementation of exception handlers to trap unexpected events.

The code is probably not very elegant, but it represents how far I have come in learning Python.

 

What the Video Shows

The video starts with the instruction screen, and then alternates this with a depiction of the I Ching characters that moves right and left in the display.  The right hand (slightly separated) button is designated the 'Back' button, and pressing this from the splash screen invokes the first page of the top-level menu. Pressing any of the other buttons will jump to a specific page in the top-level menu, but i could only show one exit from the splash screen.

Once in the main part of the program, pressing either of the four closely-spaced buttons will select a specific menu page.  I did not demonstrate it in the video, but moving the 'T' button left and right will move through the menu options, rolling around through the ends, to allow menus of more than four options to be accommodated.

Pressing the 'T' button in will invoke an action associated with the menu choice: this can currently be one of:

  • Select a lower level menu.
  • Invoke a command, such as calling a function or other module
  • Quit the program.

In the video, the beginning text of the 'Cast Hexagram' level 2 menu (Stalks) can be seen before a bug causes it to be overwritten with the error message from the exception handler.

I inadvertently pressed the 'back' button twice when returning to the top-level menu: 'Cast Hexagram' can be seen briefly before the 'Halt Requested' message identifies that the back button was pressed from the top-level menu.

Control is then passed back to the background program, which stops after displaying the 'Program Stopped' message.

Further bugs mean that the event listeners for the switches are not switched off, and some interesting things then happen to the display.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply

Top Comments

  • balearicdynamics
    balearicdynamics over 10 years ago +2
    Hi Trevor, It seems that to manage this "simple menu manager" of PiFaceCAD it's not so simple as they declared. It's not the first time I meet something that seems simple but then reveal to be cryptic…
  • taodude
    taodude over 10 years ago in reply to balearicdynamics +1
    Useful suggestions, thanks, Enrico The biggest problem for me has been learning to code in Python, rather than any issues with the PiFaceCAD. For this first test, i was mainly concerned with handing over…
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to taodude

    AsI have to use the PiFaceCAD too and probably with a menu setting, let me know if I can help you.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • taodude
    taodude over 10 years ago in reply to balearicdynamics

    Useful suggestions, thanks, Enrico

     

    The biggest problem for me has been learning to code in Python, rather than any issues with the PiFaceCAD.

     

    For this first test, i was mainly concerned with handing over control in a reliable way between background code and interrupt handlers.  This was not the only solution, because i could have just polled the switch status and not worried about interrupts.

     

    I like the suggestion about confirming the Quit command: as you say that is an easy change.

     

    Regarding the menu level and active menu item indicators: i will have to think about that as the display is only 16 x 2 characters, and I didn't want to mess around with scrolling text for this test.  That is why there is only one menu option displayed at a time, together with a longer string of text.

     

    You have set some thoughts running, though, and i will have another look at what is possible.

     

    Thanks again,

    Trevor

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago

    Hi Trevor,

     

    It seems that to manage this "simple menu manager" of PiFaceCAD it's not so simple as they declared. It's not the first time I meet something that seems simple but then reveal to be cryptic ...

     

    If I can make you some suggestions on the menu usability seeing the video, what seems needed for the better interface usability is a sign (maybe a simple '*' or '>' or - better - another custom character) beside the current menu choice to give immediate visual perception of what is the current active option the use can choice.

     

    Second detail not essential but useful in my opinion is a menu level info; maybe placed on the rightmost side of the display upper line. If the menu has more than one level you can use something like

    • [0] for the main menu (quit exit)
    • [1] for the first level menu
    • [1.1] for the choice 1 of the menu 1
    • [x.y] for the further menu

    etc.

    In fact alternatively at least a custom character showing to the user (always top rightmost position) if he is to the main level of if exists a back to previous level option. I think that this can change dramatically the usage giving a simple yet useful navigation info to the user to be always aware where he is.

     

    Second thing, as it is almost simple, especially when the user is newbie playing the program, to exit, the most "dangerous" Quit button should ask for a confirmation before definitely close the pogram.

     

    Enrico

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • taodude
    taodude over 10 years ago

    Using this evidence, i have now got the menu level changes working, but it is too late to take, process and post another video tonight.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube