Scripting Language Rapidly Develops A Clock

In the past, you might very well have started programming in Basic. It wasn’t very powerful language and it was difficult to build big projects with, but it was simple to learn, easy to use, and the interpreter made it easy to try things out without a big investment of time. Today you are more likely to get started using something like an Arduino, but it is easy to miss the accessible language and immediate feedback when you are doing simple projects. Annex WiFi RDS (Rapid Development Suite) is a scripting language for the ESP8266 that isn’t quite Basic, but it shares a lot of the same attributes. One example project from [cicciocb] is a scrolling dot matrix LED clock.

The code is really simple:

' Simple program using Annex and a MAX7219 dot matrix module
' by cicciocb 2019
'Set 4 8x8 displays with GPIO15 as CS pin
MAXSCROLL.SETUP 4, 15
INTENSITY = 5
'Set the first message with Annex
MAXSCROLL.PRINT "Annex"
MAXSCROLL.SHOW 31, INTENSITY
PAUSE 1000
'Set the refresh rate of the display (50 msec) - lower values -> scroll faster
TIMER0 50, SCROLLME
WAIT

SCROLLME:
'Scroll the display with the intensity defined before
MAXSCROLL.SCROLL INTENSITY 
' Set the text with the Date and Time
MAXSCROLL.TEXT DATE$ + " " + TIME$
RETURN

Of course, one reason it is simple is that Annex has a built-in set up for the LED drivers (MAXSCROLL). It also integrates with a remote web browser very easily, so you can embed HTML output in your projects.

If you look at the project’s main page, there is support for a lot of things including devices such as Neopixels, servos, LCDs, and temperature sensors. There’s also support for a lot of protocols and algorithms ranging from MQTT to PID controllers.

If you really miss Basic, you can use it on the web. Not to mention, that QuickBasic is still floating around.

17 thoughts on “Scripting Language Rapidly Develops A Clock

  1. The “program” appears simple because it isn’t really the program. The real work is all being done by the functions, which aren’t shown. It’s the Wizard of Oz “man behind the curtain” trick.

    While BASIC has many faults, you could at least SEE what the entire program was doing.

      1. It’s an alternative language for programming the microcontroller. Not everybody learned ‘C’ (or wants to). Might be useful to some people, to know there are more options, besided Arduino. It’s still building something, and done differently than most people would have done it. He could have just bought a scrolling led matrix clock online, probably cheaper than the parts he used.

        Send HAD link, maybe they’ll do an article on one of your projects, so we can criticize it… Either you don’t build anything, or you can’t take what you have fun dishing out. Most of these people doing the ‘hacks’, didn’t put them online to get published on HAD, they did it to share their experience with other people.

      2. Well it certainly enables other hacks. The Sonoff remote control switches for example use the Esp82Xx series and by replacing the firmware with Annex you can now control the relays etc from your phone without the internet connection usually required.

      3. Stuffing a brand new OS onto an esp module rates as a Hack in my mind!
        Especially one that makes available a very understandable language that many of us cut our teeth in programming with.

    1. “The “program” appears simple because it isn’t really the program.”

      This could be said about almost any program which manipulates real world devices unless you are writing absolutely everything in assembly language. With Arduino, you’re likely to use a library. Libraries certainly simplify programs.

      Annex has many of these simplifying features. My personal favorite is the ability easily to “push” changed values (like sensor readings) to an html page, with no user refreshing of the page–but there are many others. As far as I am concerned, the more “simplifying” the better.

      1. Unless you are flipping switches on a front panel and loading memory locations, you’re not programming in the controller’s native binary language. Even assembly language hides those details. C is a very long way from that.

    2. Yeah, it may not be low level, but scripting languages allow really fast iteration. Change one value and run and see what happens. Arduino is nice but for esp8266 the compile, load ,run cycle can get annoying.

  2. Find myself in line with leeahart there and wanting to argue that BASIC was, in fact, “powerful”. Many implementations weren’t as fine-grained as something like C, but it was/IS easy to figure out at glance what the code does. Debugging BASIC in comparison to C (at least for the code I’ve written) is minutes vs. hours. I could probably go on, but I risk going on a rant, and I really don’t want to detract from the awesome project presented here. // just chucking out a couple pennies

    1. … “Basic was, in fact, powerful”
      Agreed!!
      I would argue that Annex can run circles around most all the other esp OS’s that are available!
      Check out some of the Annex examples and you will be amazed.

    2. My worry is now [leeahart] implies using standard defined functions is bad, even in basic.

      The “print” command for instance will be written to ensure output on the hardware it is running on.
      Avoiding that and using “poke” to insert text directly to the output hardware is a bad idea when you go to run that software on another device.
      Using “print” I can trust it will have the same effect on the different hardware, yet would not at all be certain poking into a specific memory address will at all have the same effect!

      This is especially bad practice when the memory addresses used on device A output text, but on device B those same addresses flip IO pins instead, and the print command on B uses the proper/different memory locations.

      Using the provided function will work. Using [leeahart]’s method in the above example could have just brought high a pin tied to ground and shorted the device out.

  3. I enjoy programming again! Almost (no better!) as in the old days on C64, AtariST etc ;-)
    With Annex-RDS it is possible to create extremely fast projects based on the ESP8266. The cooperation with the internal web server and external scripts in the browser is amazing.
    Almost all common actuators and sensors can be controlled or queried with simple commands.
    Even the simple SONOFF modules (1M!) can be programmed.
    And that all succeeds with a Webbrowser and the completely web-based user interface.

    PeterN

  4. As a user of Annex I can tell you it is POWERFUL and Fast!
    The Annex developers are very responsive and have implemented many new features in the last few releases.
    If you have a spare esp8266 laying around I highly recommend giving it a try.
    The amazing thing is that the IDE for writing code is hosted right onboard the esp module. Once you flash Annex you no longer need the PC (you could use a tablet or even your cell phone for simple changes) You can do OverTheAir firmware updates.

    To generate an email from your code takes only two lines of code…
    EMAIL.SETUP “mail.smtp2go.com”, 465, “user”, “password”,1
    r = EMAIL (“fromemail@xyz.com”, “toemail@abc.com”, “Important message ” + date$, “body” )

    Give it a try, you will not be disappointed.
    dwight

    1. It does look like fun and dont have to use Lua so worth trying. Ha. Silly arguments on which language is better when is all compiled /interpreted .Sigh. Will be holding on to my old school current limiting resistors tho.

  5. BASIC always seems to get a bad rap, but this implementation is nothing short of amazing. Its simplicity makes cranking out projects quite easy, yet it has very powerful features. The web interface is awesome and makes programing the device quite simple and fast. Make a change, hit run, make another change, hit run… super simple and fast, the way it should be. The include functions are great and cover a lot of areas. The web functionality is simply wonderful. Probably should put it through the wringer before making assumptions based on “BASIC”. A great piece of work right here…

  6. I jumped on the ESP8266 bandwagon in late 2014, struggling with the first Espressif frameworks, then finding more success with Sming, before being seduced by the Arduino port. But this seems to be a really well-thought-out implemention of a complete RAD framework/toolset for the ESP8266. There’s a whole lot more going on here than just a “scripting language”.

    Well done. I hope it rains for at least one day this weekend so I can have a good play with this.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.