A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

TinyBasic for Nanode

As one of those that has taken up the TinyBasic Christmas Challenge issued by Ken Boak, the creator of Nanode, a range of Arduino compatible microcontroller boards, I am posting my updates. The basic code is able to run simple Basic commands and run small programs. What it lacked is a place to store programs for later retrieval and also to increase the available memory for program storage. Unlike the Arduino, the Nanode-RF comes with an external 32Kbyte static ram chip fitted and a uSD card slot.

The codebase used is at and already had a number of I/O commands added by Dave CJ.

My updates are:

  • Move static strings to program memory
  • Convert to use SRAM for TinyBasic program, variables and stack giving 32768 bytes instead of the original 1400bytes!
  • Implemented LOAD/SAVE/DIR/LRUN commands for uSD to Load, Save, directory list and load then run basic programs. All stored in plain text and can be changed by editing the files on the uSD card.
  • Include simple SRAM checker, if it fails then pulse digital pins 5 and 6 alternately
  • Added simple MEM command to display memory used
  • Added EPEEK and EPOKE to access EEPROM memory. Thanks Dave-CJ
  • Added RND for simple random number generation. Thanks Dave-CJ
  • Added TSECS for incrementing tenths of a second counter
  • Auto running of program from uSD card. Just name the program autoexec.bas and it will load and run on reset.

Filenames on the uSD card are 8.3 format and there are no checks on file extensions that you can use. Files are stored in the root directory only.

Still to do:

  • Filename handling is basic, only coded to prevent buffer overflows, format isnt checked.
  • No protection on setting I/O pins used by SRAM and uSD card. DOUT 4=0 will cause Syntax Error to be displayed for every subsequent command.

The sketch is available to download from, please note this required a Nanode with SRAM and uSD socket to fully work.

It requires a number of libraries to function:

One thing I have found is that when using Nanode with SRAM fitted, as this is a 3.3V board, the fuses set on the Atmega328P must be set correctly in order to prevent the board locking up. By default this is set to 2.7V but for a 3.3V board this can be too high, resetting it to 1.8V seems to cure this.

For those with suitable programmer, an alternative bootloader is available at This includes options for both 5V and 3.3V boards.

Bookmark this post: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

4 comments to TinyBasic for Nanode

  • ceejay


    I get a several compile errors when using a vanilla install of 0023 plus SRAM9 lib…
    TinyBasic.cpp: In function ‘void loop()’:
    TinyBasic:1391: error: ‘F’ was not declared in this scope
    TinyBasic.cpp: In function ‘void printDirectory(File, int)’:
    TinyBasic:1601: error: ‘class File’ has no member named ‘openNextFile’
    TinyBasic:1609: error: ‘class File’ has no member named ‘name’
    TinyBasic:1610: error: ‘class File’ has no member named ‘isDirectory’

    any thoughts ?

  • ceejay


    As well as Arduino 1.0…. you also need the tweaked SRAM9 file from here –

  • ceejay

    spoke too soon – this Arduino 1.0 is a bit tricksy… 🙁

  • I’ve updated the post slightly with details of the libraries. I had to add SRAM9 onto my github repository as I had updated it to work with 1.0 IDE.