Skip to content
Tom Moxon edited this page Feb 24, 2016 · 10 revisions

Within the Arduino IDE you can explore the Embedis examples under :

Files -> Examples -> Embedis

Using The Embedis Command Line Interface

The Embedis command line interface (CLI) uses familiar SET/GET/DEL commands for storing, retriving, and deleting key-value pairs in the persistant memory stores. For example :

    set mykey somevalue
    +OK
    get mykey
    +somevalue
    del mykey
    :1

The different persistent memory stores are called "dictionaries", and you can query what dictionary types are available on your system with the DICTIONARIES command, for example:

    DICTIONARIES
    *3
    +FRAM
    +FLASH
    +EEPROM

Would indicate that EEPROM, FLASH, and FRAM are available on that system. New "dictionaries", or persistent memory stores, are easily added to the Embedis server by adding a handler with READ, WRITE, and COMMIT methods to your sketch.

The "select" command is used to switch between different storage devices Different memory types are selected using their device name, for example:

    select EEPROM
    +OK free = 8190

Would select an internal EEPROM for storage, and inform you that it has 8190 bytes of storage remaining. The current version of Embedis supports a maximum of 64K Keys, and uses two bytes of the 8196 bytes of the EEPROM to indicate the key pointer (in this case, no or zero keys).

A list of keys can be retrieved using the KEYS command for the selected memory:

   select EEPROM \n
   +OK free = 8190 \n
    keys
    *0

In this case, we show zero keys, or an empty dictionary.

Embedis starts writing from the high memory address of the device, and writes "down" in addressing, from high to low memory addresses. The reason for this is to be able to coexist with other uses of the same EEPROM, such as the Device Tree information for the auto-configuration of Socks, Hats, Capes, and Shields.

Access to hardware resources are accomplished similarly using the READ and WRITE commands, for example:

    HARDWARE
    *4
    +wifi
    +vcc
    +temp
    +blte
    
    READ VCC
    +3.335
    
    READ TEMP
    +37.542

Several custom commands are shown in the Embedis examples for the Arduino, including pinMode, DigitalWrite, DigitalRead, and AnalogRead, allowing you to read sensors and toggle I/O pins directly from the Embedis Command Line Interface. For example, to toggle the BUILTIN LED ON and OFF on a typical Arduino board:

    pinMode 13 OUTPUT 
    +OK 
    digitalWrite 13 HIGH 
    +OK 
    digitalWrite 13 LOW 
    +OK 

Embedis is designed to be small, lightweight, efficient, and extensible.

Clone this wiki locally