Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By flyboy74
#72179 Is it possible to be able to import libraries. Something like the C include or the python import.

I am after this so that I can write libraries that r useful for my sons programming and he can import them into his programs. I can also share then with the community too.

I see that ESP Basic has full support for I2C, SPI and serial, this means I can write driver for many sensors.
User avatar
By Oldbod
#72296 Esp8266basic is an application-based interpreter, so it's not really practical to do on-the-fly library additions of the type I think you mean as new libraries are implemented by linking them into a new executable after also modifying the basic source application, which then has to be flashed to the esp8266.

What are the limitations that you'd be looking to overcome in eg i2c) that basic can't support with the existing commands?
User avatar
By flyboy74
#72376 Basically to be able to write useful sub routines like setup and a read an I2C sensor then save the sub routine that can be imported into any other program rather than having to cut and paste the sub routine.

This will make sharing reusing sub routines easier and sharing them with community easier too.
User avatar
By m1zar00
#73129 Plus one for this. I would like to keep working routeens in seperate source files, that are simply imported at the start of the main code... eg...

import 'routeen1.bas'
import 'routeen2.bas'

gosub [routeen_name1]
gosub [routeen name2]

It's not 'realtime', but rather at compile time.. and should be fairly simple to implement. Just chain all the imports into the code, either at the start (before the code in display) or at the point of import. The normal errors would take care of calling a sub routeen that does not exist. It would not be perfect (I'm thinking variable scope here..), but better than a program that just gets longer and longer, and therefore harder to fault find etc. Perhaps it would make more sense if their was a kind of Def Proc nnn(x,y,z) type definition, so that variables could then be local to the routeen, with variables passed and returned by the call.. This would of course be harder to implement! At the moment, I love the web editing and simplicity of installation and use. Great job and thank you for it.