From the Command-Line:
You can call the BASIC Stamp Tools For Linux commands directly from a shell terminal. It's easy to use these commands within a 'Makefile', too! (See below.)
- Create your PBASIC™ code using your favorite text editor (Emacs, vi, Nano, Joe, Kate, Gnotepad, etc.)
- Tokenize the code using bstamp_tokenize:
bstamp_tokenize PROGRAM.bs2 PROGRAM.tok
- Send the tokenized program to the BASIC Stamp®, using bstamp_run:
bstamp_run PROGRAM.tok
If your program writes any output to the serial port (e.g., using PBASIC™ "
DEBUG
" commands), bstamp_run will display them.
Using Pipes on the Command-Line:
As of the version released in May, 2004, the BASIC Stamp Tools For Linux can be chained together using POSIX 'pipes' (the "|
" character in your shell).If you send a file to the 'standard input' (
stdin
) of bstamp_tokenize, and the tokenized version will be sent to its 'standard output' (stdout
).You can then pipe the tokenized version of your program to bstamp_run's 'standard input', and it will be uploaded to the BASIC Stamp® device and ran!
cat PROGRAM.bs2 | bstamp_tokenize | bstamp_run
The advantage is that there's only one line of commands you need to issue, and there's no intermediate ("PROGRAM.tok") file created.
(Thanks to Francis Esmonde-White for adding this feature.)
Using a Makefile
Using the tools with 'make' is quite easy. Here's a simple example 'Makefile':
# My makefile
all: program.tok
clean:
-rm program.tok
program.tok: program.bs2
bstamp_tokenize program.bs2 program.tokIf you edit the source file, program.bs2, you need only run the command "
make
" and it will automatically re-tokenize it (updating program.tok).You can even add a "
run
" target, which will re-tokenize and send and run the program on the BASIC Stamp!
... run: program.tok
...
bstamp_run program.tok
Run the command "
make run
" and off it goes!
From within KDevelop:
KDevelop is a popular graphical tool for writing software 1 that's part of the K Desktop Environment (KDE) for Linux and Unix.Instructions coming soon. (If you can help explain this, please e-mail Bill Kendrick.)
- 1.
- Also known as an Integrated Development Environment, or IDE.