Lua
Create applications in Lua
Create applications in Lua
Web-based Development Environment
The unique web-based Lua development environment brings a new level of user-experience to Screvle developers. Writing applications has never been easier. Waste no time setting up a development environment, wherever you take Screvle, all you need is a browser.
Lua is a popular scripting language with a memory efficient interpreter. Screvle can run Lua code directly on the device without the need of a compiler. Lua is flexible, extendable and easy to learn (even with limited programming experience).
Unlike other web-based development environments the one from Screvle is not hidden on the internet or in the cloud. It’s right there on the device, no need for internet access at all. Featuring the microWebserver Screvle presents you with the IDE straight from the device; it will even give you an IP address if you like (optional DHCP Server functionality included).
Featuring a color-coded editor with code-completion any browser can be used to write code directly on the SD card of the device. Many application can be stored and run at will. You can even write utility or driver libraries and include them in several applications.
The web IDE also features a console output window that displays errors (e.g. syntax or runtime errors) and all text output of the running application (through the “print” function). Via low-latency long-polling the console feedback is almost instantaneous and ideal for debugging applications.
Running your applications is as easy as clicking a button. Code is run immeadiatly without requiring compile or flashing time. You’ve never been able to know if your code works (or not) as fast as with the Lua development environment.
Multithreaded Lua Interpreter
The Lua interpreter on Screvle is multi-threaded thanks to microR2k real-time kernel. Using multiple threads simplifies application code and allows your application to write large blocks of data to a file without worrying the webinterface will not respond anymore.
Acces all peripherals ...
No more frustrating debugging of peripheral interfaces. All interfaces are available via a flexible peripheral interface. Just “open”, “read” or “write”.
Asynchronous interfaces like UART and CAN have a receive buffer of user definable size and all interfaces can be easily configured using IO-controls. Memory optimized buffers are used for sending and receiving data in Lua.
uart = peripheral.open( "uart6" ) uart.baudrate = 9600 uart:write( "Hello World!" ) |
... and even more
Using the same “open”, “read”, “write” framework you can also set up a TCP connection.
microGraphics UI Framework
Developed specifically for Screvle, the microGraphics Framework (mgf) is a low overhead, low footprint graphics library designed for flexibility and ease of use. Create user interfaces with a few lines of code. Adapt it to your taste with changeable and customizable color themes and if all that is not enough, create your own widget and use it like any other (yes, that is also available in Lua!).
Don’t worry about debouncing the buttons or sampling the touchscreen, Screvle already takes care of all this for you.
File I/O
Access files on the micro-SD card.
Save and restore Application Settings
Every applications needs settings. Changing a parameter here or there is now as easy as editing a web form. The flexible settings framework of Screvle stores arbitrary hierarchic data on the SD Card and a dynamic web page presents it all to the user. Actual data transfer of the settings is done via a JSON interface that can also be integrated in third party services. Of course you can also edit the value straight from your application code both in C and Lua.
Need one more setting? Just create one and it is ready to use. There is no more excuse for hard-coding.
Timers
Create timers for executing repetitive tasks. Just define a period (in milliseconds) and callback function.
Example:
t = timer.create( someFunction, 1000 ) t:start() |
Build Dynamic Webpages
The microWebserver running on Screvle is not only used for the web-based development environment, but can also serve the webinterface of your applications.
Not satisfied by static pages Screvle also support Lua Server Pages. These pages are a combination of static HTML intermixed with Lua code that is executed when the page is requested (comparable to PHP). Create your own true dynamic webinterfaces and allow remote-monitoring and control of your applications. Too inconvenient to go look at the display on the device? Stay behind your desk and remotely check the status via any webbrowser. Using client-side Javascript libraries even the most advanced, good looking interfaces can be build with little overhead on the Screvle device.
Example:
<HTML> <TITLE>Backlight</TITLE> <BODY> <?lua led.backlight = lsp.data ?> </BODY> </HTML> |
HTTP Client
Send HTTP requests from your Lua application to interface with third party applications. Download new firmware, send a tweet, or participate in the Internet of Things by updating your Xively stream. All it takes is a few lines of code.
MQTT Client
Use the MQTT publish/subscribe protocol send your data to the cloud or remotely receive commands.
SMTP Client
Send emails via an SMTP server and alert users of any event, even if they are not around or think even bigger and trigger almost anything via IFTTT.
Follow Us