Daily Archives: 1/4/2012

My own lightly modified Arduino Basic

I’ve received a couple of requests for my own Arduino Basic modifications. They are pretty straightforward and small, but might be of some use, and I probably won’t have a chance to do any significant work for a couple of more weeks, so I thought I’d just toss them out there for consumption. This is all based upon Mike Field’s Tiny BASIC, and all the real credit should go to him. I added a few new commands to allow you to do some simple digital and analog I/O, and added a couple of added functions, including one that could be used to figure out how much free space you have left for BASIC programs.

My lightly modified Tiny BASIC source code, for Arduino 1.0

Changes include:

  • MODE PIN,[0|1] works like pinMode(pin, INPUT|OUTPUT). Note: to specify analog pins, you need to add 14 to the analog pin number (for the traditional Arduino, I have no idea what the MEGA does).
  • DWR pin,value and AWR pin, value act like digitalWrite and analogWrite.
  • Two additional functions (ARD(pin) and RD(pin), which should really have been DRD to match DWR) act like digitalRead and analogRead.
  • DELAY ms works like, well, delay(ms), duh.
  • The FREE(0) function returns how many bytes of program storage are left.
  • For reasons which aren’t clear to me, I modified the code to convert all lower case letters to upper case. Change it back if you like.

If you swipe this code and use it for something, let me know below: if someone makes use of my work, it gives me incentive to work on it harder. 🙂