Lamp
ODROID-Magazine-201509
ODROID-Magazine-201509
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
QT5<br />
The logic is that if the timer is not running, then we start<br />
it, else we stop it. First, give the rectangle a height, a width,<br />
and a color. Add text to the button and anchor it to a location<br />
on the screen. Below that, create the “flasher timer” and give<br />
it an interval of 500ms, which is equivalent to half of a second.<br />
The timer is then set to repeat, and an “onTriggered” callback<br />
is created, which states “while running, toggle GPIO 200 every<br />
half second.”<br />
Finally, add an exit button, which is very similar to the<br />
flasher button, but colored red and located in the bottom right.<br />
Also, instead of toggling the timer, the exit button will close the<br />
application. If this was a real replacement for the desktop environment,<br />
we would shut down instead of quit. Quitting brings<br />
you back to the LightDM screen in order to choose where to<br />
go next.<br />
Creating the binary<br />
Until now, QtCreator has likely been performing a shadow<br />
build and operating in “debug” mode. When deploying the<br />
application, we want to build for “release”. Open a Terminal<br />
window and navigate to the project directory. Once in the<br />
directory, run the following commands:<br />
$ qmake –config release blinky-ODROID.pro<br />
$ make –j4<br />
It should build without any issues. If you encounter errors,<br />
download the source from http://bit.ly/1KsPX0z. After you<br />
Figure 17 - Copying the Blink-ODROID binary to /usr/bin<br />
build it, install it by copying the executable to the /usr/bin<br />
directory:<br />
$ sudo cp blinky-ODROID /usr/bin/blinky-ODROID<br />
Testing Blinky<br />
Testing is very easy after creating the xsession configuration<br />
file. First, log out of the Lubuntu session with the normal logout<br />
button. You should be back at the LightDM screen waiting<br />
to login. At the top right, click the icon in order to open<br />
the Desktop Environment list, and choose “Blinky”. Then, log<br />
in with the normal ODROID/ODROID credentials. If all<br />
went well, you should see the blinky-ODROID example appear<br />
on the screen. This was a very simple project, but you can<br />
use it to build very complex desktop environments. The largest<br />
drawback is the lack of a WiFi manager and other convenient<br />
settings dialogs.<br />
Further reading<br />
If you want to learn more about Qt5 or building desktop<br />
environments, here are some links:<br />
Desktop Environments: http://bit.ly/1MyywH5<br />
Embedded Linux: http://bit.ly/1LMrksN<br />
Qt5 Desktop Services: http://bit.ly/1fWjtxk<br />
Plasma 5 Desktop Environment: http://bit.ly/1EAUtax<br />
Figure 16 - Building the Blinky-ODROID binary<br />
Figure 18 - Selecting the Blinky desktop environment using LightDM<br />
ODROID MAGAZINE 31