Since the Embedded Engineer has the abillity to be extended with your own “CodeBuilder” we created an implementation for Python.
This first implementation is targeted on simply showing the Raspberries IP, a crude file navigation and functions to exit the programm as well as rebooting and shutting down the raspberry.
Besides a small python script for starting the programm every line of code was generated with the LieberLieber Embedded Engineer.
Here some examples of the CodeBuilder, the generated code and the model used to generate the code.
1.) The CodeBuilder:
2.) The domain model:
3.) The state machine:
This is the main state machine which controls the LCD and its buttons.
The LCD is used to show text and the buttons are used to scroll inside the “root menu” and navigate the “output” (in this case the IP or a file listing)
4.) Example activity:
This “RunDirCommand” activity sends commands to the shell and writes the output to the “self.cmdOutput” list.
With a simple “ls –a –p” we get a list that can be used for navigation across directories.
If the selected output entry ends with a “/” we know it’s a folder and therefore change the workingdirectory and refresh the filelist.
If the selected output entry endw with “.py” we know it’s a python script and can be executed with a “sudo python [output entry]”
Everything else will leads to no action.
5.) Generated code:
6.) The starting script
This simple script is all you need to start the generated state machine.from LCDMenu import * lcd = LCDMenu() lcd.runStateMachines()
At last,… the generated code in action: