Close

7S-LED example for W1401

A project log for eForth for cheap STM8S gadgets

Turn cheap modules from AliExpress into interactive development kits!

thomasThomas 04/17/2017 at 13:280 Comments

In the last log entry I described a feature for number and text output on grouped (structured) 7S-LED displays. In this log entry I'd like to give an example of how easy presenting information is.

The XH-W1401 module has a 7S-LED display grouped in 3 x 2 digits (yellow, large red, yellow). There is no decimal point, but that's a different story.

The following code displays different types of information on the different sections:

FILE
: timer TIM 655 / ;
: ain 5 ADC! ADC@ 100 1023 */ ;
: show timer . ain . BKEY . CR ;
HAND

The word timer returns the 16 bit ticker value scaled to 0..99, and the word ain does the same for the analog input (on the sensor header). show displays the values of timer, ain, and the board key bitmap code from BKEY followed by a CR (new line).

The following session demonstrates the feature:

show 19 28 0
 ok
' show bg !

Calling show directly sends the output to the console. Running the same word in the background displays the values of timer on the left red 7S-LED group, ain on the middle red LEDs, and the board key bitmap on the right yellow group.

Discussions