Usage


Installation of the Library

  • Download library
  • Follow install guide from arduino.cc
  • Restart Arduino IDE
  • Load supplied microBox example

Shell commands

cat parameter
The command cat prints a parameter.
Example:
    cat /dev/hostname
cd directory
The command cd changes to current directory.
Example:
    cd /dev
echo value > parameter
The command echo writes a value to a parameter.
Example:
    echo 45.78 > /dev/temp_setpoint
loadpar
The command loadpar reads parameter values form EEProm that have been written before.
ll
The command ll lists the contents of the current directory in long form.
ls
The command ls lists the contents of the current directory.
savepar
The command savepar writes the values of all parameters to EEProm.
watch command
The command watch prints the output of a command in a 1 sec. intervall
Example:
    watch cat temperature_act
watchcsv command
The command watchcsv prints the output of a command in a 1 sec. intervall and seperates the outputs by semicolon.
Example:
    watchcsv cat temperature_act

Library-functions (API)


microBox/microBoxEsp class

After including microbox.h into the sketch a microBox instance is available as microbox.

void microBox::begin(PARAM_ENTRY *pParams, const char* hostName, bool localEcho=true, char *histBuf=NULL, int historySize=0)
The method begin initializes the microBox library.
Parameters:
  • pParams Pointer to parameter array
  • hostName Hostname to be shown command prompt
  • localEcho Enable echo of input characters
  • histBuf Pointer to buffer for command history
  • historySize Length of command history buffer
struct PARAM_ENTRY
  • paramName Name of parameter
  • pParam Pointer to parameter
  • parType Parameter type and access rights: PARTYPE_INT, PARTYPE_DOUBLE or PARTYPE_STRING plus PARTYPE_RW or PARTYPE_RO
  • len Parameter length in byte (only for strings)
  • setFunc Callback will be called after writing to parameter
  • getFunc Callback will be called before reading the parameter
  • id ID passed to callbacks
void microBoxEsp::begin(PARAM_ENTRY *pParams, const char *hostName, const char *loginPassword, char *histBuf = NULL, int historySize=0, HardwareSerial *serial=&Serial)
The method begin initializes the microBoxEsp library with esp8266 support.
Parameters:
  • pParams Pointer to parameter array
  • hostName Hostname to be shown command prompt
  • loginPassword Login password
  • histBuf Pointer to buffer for command history
  • historySize Length of command history buffer
  • serial Serial port to be used
void cmdParser()
The method cmdParser has to be called cyclic to get full microBox functionality.
bool AddCommand(const char *cmdName, void (*cmdFunc)(char **param, uint8_t parCnt))
The method AddCommand adds a user command to microBox.
Parameters:
  • cmdName Name of new command
  • cmdFunc Pointer to function of new command

Esp8266 class

After including microbox.h into the sketch a microBox instance is available as esp8266.

void ConfigSettings(bool apMode, char *ssid, char *key)
The method ConfigSettings configures the Wifi connection of the esp8266 module. This method has to be called only once. The module saves the parameters set even after a power off.
Parameters:
  • apMode Set module to AccessPoint mode or station mode
  • ssid SSID for AccessPoint
  • key WPA-Key
void print(const __FlashStringHelper *buffer)
The method print sends a string from flash via the esp8266 module.
Parameters:
  • buffer Pointer to string in flash
void print(const char *buffer)
The method print sends a string via the esp8266 module.
Parameters:
  • buffer Pointer to string
void print(int val)
The method print sends a integer value as string via the esp8266 module.
Parameters:
  • val Int that will be send as string
void print(double val, int digits)
The method print sends a double value as string via the esp8266 module.
Parameters:
  • val Double that will be send as string
  • digits count of decimal places
void println(const __FlashStringHelper *buffer)
The method print sends a string from flash via the esp8266 module with trailing CRLF.
Parameters:
  • buffer Pointer to string in flash
void println(const char *buffer)
The method print sends a string via the esp8266 module with trailing CRLF.
Parameters:
  • buffer Pointer to string
void println()
The method println sends CRLF via the esp8266 module.
void write(const uint8_t *buffer, size_t size)
The method write sends a buffer via the esp8266 module.
Parameters:
  • buffer buffer
  • size length of buffer