Go Down

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

alejho

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!

http://avil.altervista.org/

MacrosCode

Impressive Project!

Good documentation!

Well done!  :)

alejho

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.

Ciao!

alejho

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!

https://www.youtube.com/watch?v=WH6r9CQY8rs&feature=youtu.be

And here to learn more about it!

meArm Robot Controller

Ciao!

alejho

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

http://avil.altervista.org/

spairo

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

Can you use AVIl to accomplish the following?

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


alejho

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

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".

3_Language_Reference/3.2_Statements/3.2.6_for.html

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

5.1_add_a_custom_function_to_AVIL_in_5_steps.html

So yuo can extend the language to fit your needs!

Ciao!

spairo

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.
Quote
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
fat16info:
SD error
ErrorCode: 2
ErrorData: 1 "

alejho

Hi,

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.

Ciao!

spairo



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.

Quote
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?");

alejho

Quote
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.



spairo

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

This set works well on other programs.


alejho

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...

spairo

I look forward to the results of your work

spairo

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

Go Up