





























I have been attempting to learn Nihongo (Japanese). It is a failing attempt really, since I have so little time lately.
However, I wanted to make myself flash cards or a simple test for the Hiragana.
Around that time, I bought a WaveShare e-Paper hat for the Raspberry Pi, and was having fun developing interfaces for it.
One of the uses that I figured I could put the Pi to was a test. A simple Hiragana quiz.
The WaveShare e-paper screen has three colors: White, Black and Red. This tricolor variant is a little slow, compared to the Kindle for example. However it works quite well.
It is controlled using images, so you can display anything you can represent as an image.
That’s sort of easier said than done, though. If not for the Python-Pillow library, I wouldn’t know where to begin.
The first step was a simple Python function to get a dictionary of hiragana characters against their roman equivalents.
This was a lot easier than hard coding the dictionary into the program.
The next steps were randomly selecting a kana character and displaying it on screen with a possible question. I had to also randomize the answer’s position.
Again, fairly simple, granted what I wanted to achieve.
The test_romaji_hiragana function took care of the interactions with the
Raspberry Pi’s GPIO library. The function also handled the actual displaying of
the question on the screen.
The epd library is WaveShare’s own library for the e-paper display. It has some Python 2.7 dependencies, which I need to weed out in the future. I’m skeptical of WaveShare’s software support, since their documentation leaves much for the user to discover on their own. However, their hardware is quite fun to use!
Python-PIL, as always, is fun to use. The epd library takes two Image objects: one for the blacks, and another for the reds. Needless to say, the rest of the space with a 100% transparency, is the white region.
The rest of the code is available at my personal library for this project. I’ve named it Tomodachi, Japanese for friend. It has some bugs, I’ll admit, but it was quite fun to work on. I will be going back to this project to tinker with it some more, perhaps for the PiFaceCAD module next, or the WaveShare Game Hat.
One of the things I want to make is a mario-styled sidescroller game to teach me the Kana. Perhaps I’ll use the GameHat for that. It would be a great project.
There is joy in going wrong also. You learn something new.
The project taught me several valuable lessons:
Looking back at this project, there are several enhancements I’d like to make:
This project was one of my early forays into combining hardware and software in a meaningful way. The constraints of the e-paper display—limited colors, slow refresh rate—actually enhanced the experience by forcing focus on each question.
The tactile nature of physical buttons combined with the visual feedback of the e-paper display created an engaging learning environment that pure software solutions often lack.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。