Go Down

Topic: interpreter for Arduino (Read 5688 times) previous topic - next topic


Hi all,
I made my own interpreter and intepreted language (starting from uBasic), it has some interesting features and can run programs from sd card (so you don't have to load the entire program in SRAM).

It can be used as a standalone interpreter or you can set up a minimal shell you can use interactively (from serial or ethernet) or to remotely manage i/o from a bash script!
You can also customize the language with user definde function.

Hope you'll have a look!



Impressive Project!

Good documentation!

Well done!  :)


Thank you! :)

I recently added the possibility to define subprograms and as soon as possible I would like to port this interpreter on an esp8266 since I think that (on more powerful hw) it could be used to create an easy and convenient "environment" for IOT rapid prototyping.



Hi all,
I received some positive feedback about this project so I decided to develop a nice example of application made using the AVIL interpreter.

I made an "industrial like" controller for a meArm robot extending the language with a few functions.
You'll be able to:

  • manually jog your meArm
  • "teach" the robot as many positions as you want (they'll be stored on the sd card)
  • let the meArm interact with the real world using the digital I/O of the Arduino board
  • control the arm with AVIL programs stored on the sd card

Have a look here!


And here to learn more about it!

meArm Robot Controller



I fixed some problems in the website, now you can have access to a complete documentation here:



in statement 3.2.1 print - println SyntaxHighlighter " Can't find brush for: sh"

Can you use AVIl to accomplish the following?

rec 783 30
chp 1
rec 783 10
chp 0
goto start 10 // loop for 10
rec 200 10
chp 1
scan 300 20
chp 0
a = input (hr)
if hr < 60 goto alfa


Jun 09, 2017, 02:06 pm Last Edit: Jun 09, 2017, 02:12 pm by alejho

Thank you for your feedback,I fixed the error message in the docs!

...I can't really understand what are you trying to do but you can for sure use a "for" loop in your code instead of doing it with a "goto".


If you want you can also implement a custom instruction following this guideline:


So yuo can extend the language to fit your needs!



I am using Arduino Uno r3 and SD.

In sysArduinoUNO.h on line 29 I typed CHIP_SELECT = 10;
Avil has returned the error "init code".
I tested the Arduino and SD card with the SD program of SparkFun Electronics

** SD - a slightly more friendly wrapper for sdfatlib **

Below the printout of this program, works perfectly on chip_select 4, 8, 10.
Initializing SD card...Wiring is correct and a card is present.
Card type: SDHC
Volume type is FAT16

Volume size (bytes): 1986756608
Volume size (Kbytes): 1940192
Volume size (Mbytes): 1894
Files found on the card (name, date and size in bytes):
CAT           2017-05-30 12:10:58 163
CP            2017-05-30 12:10:58 542
DIOR          2017-05-30 12:10:58 161
DIOW          2017-05-30 12:10:58 190
EDITL.AV      2017-05-30 12:10:58 1666
ERRDESC       2017-05-30 12:10:58 2526
FREC          2017-05-30 12:10:58 247
FREE          2017-05-30 12:10:58 139
GETPM         2017-05-30 12:10:58 161
LS            2017-05-30 12:10:58 136
MAHOWTO       2017-05-30 12:10:58 413
MEADEMO.AV    2017-05-30 12:10:58 556
Where to look for a problem, maybe turning on the debug feature will show the problem.
Any program from FAT16 directory does not work
error code is
"read begin failed
SD error
ErrorCode: 2
ErrorData: 1 "



If you're using an Ethernet Shield you must set CHIP_SELECT=4 otherwise it will not work.

If you're using an external SD module (could you link me wich one are you using?)be sure to comment the #define ETH_IO at line 39 of compopt.h (http://avil.altervista.org/Index/2_Configurations.html)
In this way the pin 10, normally used to select the ethernet interface, will be free.



Everything is done according to your guide, checked several times.
My SD card is type no-name but working good with full speed in other programs.
I think the problem is with the SS pin (10) or Slave Select.
When using the ethernet module there is no problem.
I don't have ETH module.

Serial.print("\nInitializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
  pinMode(10, OUTPUT);     // change this to 53 on a mega

  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");


When using the ethernet module there is no problem.
I don't have ETH module.
...I can't really understand wich hardware are you using...

mmm...so you're using an Arduino Uno directly connected to an SD card?(no SD module like this one?)

Can you post the wiring between arduino and the SD card (and other eventual hardware) and attach the compopt.h file?...I will try to replicate the problem in the next days.


Yes, I'm using Arduino Uno connected directly to SD card (without SD module).

This set works well on other programs.


At the moment I can't replicate your problem since I can't build a voltage divider to drive directly the SD card without a module.

But now I'm curious about this issue and I will do it in a few days...hold on! :)

...by the way I tried to connect my Ethernet shield to my Arduino Uno "by wires" (not stacking them) and I'm able to choose the chip select that I want for the SD card...so the problem it's not on the fat16 library I suppose...


I look forward to the results of your work


I installed the W5100 ethernet card.
Ping to work correctly.
Putty via telnet to gives the message "network error Connection time out"

Go Up