Project:Nanode/Tiny Basic: Difference between revisions

From London Hackspace Wiki

Line 3: Line 3:
We are all familiar with the process of editing code for the Arduino or Nanode, recompiling the code and then uploading the new hex code image up to the target board. Whilst this might be the way most applications for embedded microntrollers are developed these days - there is another way - and for some people it might just be what they need to get started.
We are all familiar with the process of editing code for the Arduino or Nanode, recompiling the code and then uploading the new hex code image up to the target board. Whilst this might be the way most applications for embedded microntrollers are developed these days - there is another way - and for some people it might just be what they need to get started.


Tiny Basic is an interpreted language which runs on most microcontrollers.  It needs few resources apart from a serial terminal interface and is an ideal alternative language for the Arduino or Nanode.
Tiny Basic is an interpreted language which runs on most microcontrollers.  It needs few resources apart from a serial terminal interface and is an ideal alternative language for the Arduino or Nanode. It can be customised to include functionality that is specific to the Nanode hardware, and work alongside the drivers that are used to exercise the hardware peripherals.
 
Nanode Tiny Basic is written in C, and so is reasonably compact at just under 8K bytes.  The version we use was developed by Mike Field - hamster@snap.net.nz - and he should be credited for his fine work everytime the code is modified or distributed.
 
==BASIC - WTF!==
 
As computers have got more powerful with more memory and processor resources, much of the early work done with simple basic has been forgotten - but for a whole generation of programmers - basic was their first introduction to real computer programming.


The simplest of programs can be entered from a serial terminal window - and can be executed immediately using the RUN command - for example:
The simplest of programs can be entered from a serial terminal window - and can be executed immediately using the RUN command - for example:
Line 27: Line 33:


The first task was to find a program which can be used like an operating system - in order to tie all the various hardware functions and libraries together.
The first task was to find a program which can be used like an operating system - in order to tie all the various hardware functions and libraries together.




Line 59: Line 64:
10 DOUT 4 = 1 // Set Dig 4 High
10 DOUT 4 = 1 // Set Dig 4 High
20 Let A = AIN 1 // Get input from Analogue 1
20 Let A = AIN 1 // Get input from Analogue 1
30 PRINT A    
30 PRINT A
 


==List of KeyWords==
==List of KeyWords==
552

edits