Completed Project Annex32 / Annex RDS For ESP Micros - A Quick and Dirty Example

Thread Starter

Jon Chandler

Joined Jun 12, 2008
1,560
Anyone who has followed my posts know I am a fan of Swordfish Basic for PIC18F-series micros. This comes from a Fortran 77 course in college, programming in Basic on HP-85 computers and eventually Atari 800 and ST computers. I find it simple to use and easy to understand.

I recently came across Annex32 / Annex RDS Basic for ESP micros. It's an interpreted Basic that runs on ESP micros. The Basic interpreter is installed on the ESP using a web browser tool and programming is done using a web browser connected to the ESP. A massive on-line documentation file explains the commands and the built-in support for a large number of peripherals.

I am extremely impressed how easy Annex32 is to use. Here's a quick and dirty example to illustrate. The picture shows an ESP32 and a TM1637 4-digit 7-segment display.... which, with a little code is a NTP (Network Time Protocol) sync'd clock. Support for NTP and the TM1637 are both native to the program.

How "little" code is required? See for yourself.

Code:
TM1637.SETUP 15, 16, 150
brightness = 3
TimeWas$ = ""

timer1 3600000, DoSync 'Hit NTP server once per hour to sync

gosub update 'display initial time

while 1 = 1 'update time when seconds = 00
    sec$ = mid$(time$, 7, 2)
    if sec$ = "00" then gosub update
wend

DoSync:
    print "sync" 'added to check internal ESP32 clock accuracy
    TimeWas$ = time$ 'added to check internal ESP32 clock accuracy
    option.ntpsync
    print "Time was ", TimeWas$, "Time is ", time$ 'added to check internal ESP32 clock accuracy
return

update:
    hour$ = LEFT$(time$, 2)
    min$ = mid$(time$, 4, 2)
    TM1637.PRINT hour$+"."+ min$, brightness
return
Twenty lines if I've counted correctly, including several lines to evaluate the timekeeping of the ESP's internal clock. If desired, there are also commands to periodically sync an attached RTC such as the DS3231.

Annex32 also supports hosting web pages. Below is a screen shot of the web interface for an IR remote control of a Pioneer VSX-831 amp. This remote becomes available to any device that can display a web page. The code required for this is a bit more complicated because of the HTML/CSS commands required.

20260216_141440.jpg


Screenshot_20260206_231650_Edge.jpg
 
Last edited by a moderator:

Thread Starter

Jon Chandler

Joined Jun 12, 2008
1,560
I have since changed the code to Hit the NTP server every 24 hours. The internal clock of the ESP32 appears to be very accurate, in sync with my phone 18 hours after syncing to the NTP.
 
Top