Tags:
tag this topic
create new tag
view all tags
---+ Solutions to exercise 10: TFT display ---++ Introduction The exercises on the TFT display can be implemented on the 1.4" display with its ST7735 controller or on the 2.4" display with the ILI9341 controller. Of course the coordinates must be adapted to the different pixel resolution of the display. ---++ Exercise 1: The drivers for the display controller: * ST7735.py * ili934x.py are both already included in the !MicroPython binary. Try to import them for verification. Otherwise there is nothing much to be explained about the solution. The expected results are already shown on the exercise sheet. ---++ Exercise 2: The text fonts are also already available in the !MicroPython binary. Since RAM is a scarce resource on the ESP32 we need a method allowing to have them stored in flash and get fast access to them nevertheless. The section on fonts in [[TFT display]] explains how this is done. In order ti use the font all you have to do is <verbatim>import fonts.sysfont as sysfont display.draw_text(0, 127, 'DCSIT', sysfont, Display.RED,landscape=True)</verbatim> in case of the font _sysfont_. ---++ Exercise 3: In exercise 3 we make use of classes * Label * Meter * LED defined in nanogui, a very simplistic Graphical User Interface (GUI) library developed by Peter Hinch. Please see <br /> https://github.com/peterhinch/micropython-nano-gui. This library is again already included into the !MicroPython binary. See Peter's [[https://github.com/peterhinch/micropython-nano-gui/tree/master/gui/demos][demos]] and model your solution after them. [[https://github.com/peterhinch/micropython-nano-gui/tree/master/gui/demos][color15.py ]]provides an example very similar to what we have to do for the solution. ---++ Exercise 4: To solve this exercise we take a similar path as for exercise 3. Here we use the [[https://github.com/peterhinch/micropython-nano-gui/blob/master/gui/core/fplot.py][fplot ]]module included in nanogui. Again Peter has demos showing how to use the plot classes. ---++ Exercise 5: This one is a bit more difficult! It requires some knowledge about complex numbers in Python. I took Peter's aclock demo as an example and developed my own _Scale_ class, drawing only half a circle and creating a <i>needle </i>similar to Peter's _Dial_ to show the values. The result is shown on the exercise sheet. ---++ Exercise 6: Making the Super Mario program run on the ST7735.py driver corresponds to a _porting_ task from one display driver to another, namely from the SSD1351 to the ST7735 driver. Explaining all porting details would go beyond the scope of this text. -- %USERSIG{UliRaich - 2021-02-06}% ---++ Comments %COMMENT%
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r2 - 2021-02-06
-
UliRaich
Home
Site map
AFNOG web
Embedded_Systems web
IoT_Course_English web
IoT_Course_French web
Main web
Sandbox web
TWiki web
IoT_Course_English Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
E
dit
A
ttach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback