-
Notifications
You must be signed in to change notification settings - Fork 73
Home
Welcome to the Bitlash Wiki.
Bitlash is an open source interpreted language shell and embedded programming environment. This website documents Bitlash for the popular and useful Arduino.
The Bitlash interpreter runs entirely on the Arduino and interprets commands that you type in a terminal window or send programmatically to the serial port:
bitlash here! v2.0 (c) 2012 Bill Roy -type HELP- 942 bytes free
> print "Hello, world!", millis()
Hello, world! 11939
>
- Download Bitlash
- Install Bitlash and upload it to your Arduino
- Proceed to the Documentation Index
- Jump to the Built-in Functions Reference page
- Read more About Bitlash
Bitlash is an open source interpreted language shell and embedded programming environment. This website documents Bitlash for the popular and useful Arduino.
The Bitlash shell runs entirely on the Arduino and supports many of the familiar Arduino functions. Bitlash interprets commands you type on the serial port:
bitlash here! v2.0 (c) 2012 Bill Roy -type HELP- 978 bytes free
> print "Hello, world!", millis
Hello, world! 10161
>
It's easy to extend Bitlash by naming a sequence of commands as a Bitlash function, which is like a new word in the Bitlash language. A Bitlash application is a set of such functions, and since they are stored in the EEPROM, Bitlash can start up your application automatically at boot time for standalone operation.
In cases where you need native C code to get closer to the hardware, perhaps for speed or to interface with a custom peripheral, it's also easy to integrate your C code with Bitlash as a User Function.
As scripting languages are to Internet applications, Bitlash is to embedded ones. Test your embedded C code by interacting with it through Bitlash userfunctions over your Arduino's USB or serial interface. Configure and manage your application from Bitlash rather than some hokey syntax that you cooked up for that one purpose, that's already getting in the way and won't make any sense to you when you need to extend it six months from now.
At the low end, Bitlash runs fine on an Arduino Uno, leaving most of the space for your app. On an Arduino Mega 2560, large Bitlash apps are possible. Examples include a Bitlash-powered webserver and interacting with Bitlash via telnet.
Read on for more about Bitlash.
The Bitlash embedded interpreter that runs in about 14k of memory on an Atmel AVR processor. It works nicely with Arduino to make a development and prototyping tool for those situations where you need to bang some bits on the Arduino but writing a sketch in C is premature. It's very convenient for bringing up and debugging new hardware.
The Bitlash command language is very similar to Arduino C and includes a large repertiore of the familiar Arduino C functions so you can hack your hardware from the serial command line or even over the internet via telnet.
You can store commands as functions in EEPROM, compile them into flash memory, or put them on an SD card. A user-defined bitlash startup function is run automatically at bootup, making the automation and maintenance of small applications very easy. Here is the classic Blink13 program as a complete Bitlash application in two functions, toggle13 to toggle the led and startup to initialize and run it:
> function toggle13 {d13=!d13;}
> function startup {pinmode(13,1); run toggle13,1000;}
> boot
(d13 toggles every 1000ms)
September 29, 2011
This update includes these changes:
- Preliminary support for Arduino 1.0 (examples still need rework)
- SD Card support is, by default, disabled. See the README.
- Nanode Web server support - see README.
- You can add "Built-in PROGMEM functions" - see src/bitlash-builtins.c
- You can give your pins symbolic names - see PIN_ALIASES at line 401 in src/bitlash-parser.c
June 5, 2011
I'm making an early version of Bitlash with SD Card support available for testing and use by people who can tolerate the early state of the code and the documentation. I'm hoping to get feedback on how it works, and on some of the open issues.
Here's the big news: This version runs Bitlash functions from an SD Card file system. EEPROM space is no longer a limiting factor for Bitlash applications.
You can invoke a file function by mentioning the filename from the command line or from any other function (in EEPROM or a user function) as usual.
You can pass arguments to the function using the arg(n) mechanism from the earlier beta. And those arguments can now be string arguments, too:
printf("The time is %u\n", millis)
(And there's printf()...)
Functions in files can use functions in other files, which in turn can use functions defined interchangeably with scripts from EEPROM.
These file system functions are included in the bitlashsd demo; they provide bare bones support for building file-based applications in Bitlash, or just messing around from the command line:
dir
exists("filename")
del("filename")
create("filename", "first line\nsecondline\n")
append("filename", "another line\n")
type("filename")
cd("dirname")
md("dirname")
You can write to the SD card, too, using fprintf():
fprintf("mylog.dat", "The time is %u\n", millis)
I'm looking for feedback on bugs and problems, irritations and the language design, and hardware combinations that work or don't.
Please note: SD Card support requires the SdFatBeta library by William Greiman. You need to install this library, as well as Bitlash. Instructions in the README.
March 6, 2011
Bitlash 2.0 RC2 is available for download.
This release fixes a bug which caused functions to be saved to EEPROM with extra, spurious characters at the end. See the RELEASE notes file for details.
All users are encouraged to update to this version. Please report any new bugs and issues.
February 5, 2011
Bitlash 2.0 RC1 is available for download.
Here is a summary of changes; detailed documentation is available at Bitlash Online.
-
Syntax overhaul
- Bitlash 2.0 language is considerably different
- Macros from Bitlash 1.1 will need to be updated to run in 2.0
- Key changes:
- if (expression) { stmt;...;stmt;} else {stmt;...;stmt;}
- while (expression) { stmt; }
- switch (expression) { stmt0; stmt1; ... stmtN; }
- function hello {print "Hello, world!";}
-
Macros are now Functions, they take arguments and can return a value
- arg(0) is the count of args you got
- arg(1..n) are the args
- return expression; to return a value; zero is assumed
- User Functions in C use this same scheme now
function printargs {i=0; while ++i<arg(0) {print arg(i);}}
-
New Built-In Functions
- bc: bitclear
- bs: bitset
- br: bitread
- bw: bitwrite
-
New API calls
- setOutputHandler() api allows capture of serial output
- doCharacter() api allows char-at-a-time input to Bitlash
-
New Examples
- BitChi web and telnet server
-
Small Beans
- Input buffer is 140 characters, up from 80. twitter is the new Hollerith
- Binary constants of the form 0b01010101 are supported
Bitlash 1.1 was the mainline Bitlash release in 2010. It will be replaced by Bitlash 2 during 2011.
The documentation wiki for Bitlash 1.1 is archived for reference at the Bitlash v1.1 Site Archive
February 4, 2010
These features were announced in Bitlash 1.1:
-
User Functions: This release is mainly about the new userfunctions feature, which makes it Really Easy to add your C function to Bitlash. You'll find some new examples of this feature in the Arduino IDE at the File -> Examples -> bitlash menu item, and documentation at the
-
**New Functions inb() and outb(): ** Read and write the AVR registers from your Bitlash scripts. Details on the functions page.
-
Deprecated Functions: These functions didn't make the cut at spring cleaning time and are no longer supported in the Bitlash core: du(), map(), shiftout(), sa(), sr() and usr().
January 17, 2009
After over a year in development Bitlash 1.0 is available for download.
There is one bug fix since the RC2 version, renaming the folders and files in the /examples tree to remove the '-' which became deprecated in Arduino 0017.
Bitlash 1.0 is tested on Arduino 0017 and
The Bitlash documentation is now hosted in this wiki. Please send comments to the Author.
Bitlash and this Bitlash documentation are Copyright 2012 by Bill Roy.