armapi  v1.0
bĂȘta
Quick started with Arduino.

Hardware

The hardware is composed of acw-duino shield and a antenna, coupled at your Arduino.

acw_duino1.png

Installation

The installation is easy. The first step is to download the API packages. You can find it on the Github page.

Run you arduino IDE and go to a menu Sketch->Include Library->Add .ZIP Library...

ide_arduino_add_lib_menu.png

Now, chose the armapi.zip file you just download.

ide_arduino_add_lib_dialog.png

And it is finish, the library is installed.

Start to code

Read the documentation

This documentation is generated from the c binding source, but it easily to understand for a cpp. In c, each functions name start by 'arm' and the first argument is a pointer to arm structure. In cpp, it were replace by the Arm class.

For example to set a mode:

//In c
//In cpp
myArm.SetMode(ARM_MODE_FSK);

In c, some functions don't need a structure, in cpp this function is converted in static method.

For example to get a max power:

//In c
getMaxPower = armFskMaxPower(42, ARM_BAUDRATE_1200);
//In cpp
getMaxPower = Arm::FskMaxPower(42, ARM_BAUDRATE_1200);

Write a code

Now you are ready to start to write a code. The API require to work a serial link. On Arduino, you must use the Serial object and give this object to the API with the Init method. Before it, you need to instanced the Arm object.

//Instanced the Arm object
Arm myArm;
//Call Init method
myArm.Init(&Serial);

You can check the error returned by the Init method to know if the initialization is successful. The Init method detect automatically the arm type (armType_t) and the library adapts itself. For example, the method LwGetConfirmedFrame() has no effect if the type is no ARM_TYPE_N8_LW, there is not reason to use this method if you ARM don't support the Lora network.

About the name of methods:

  • The methods, prefixed by Fsk are used to control the Fsk/local radio mode. See Fsk (Local) radio
  • The methods, prefixed by Sfx are used to control the Sigfox network. See Sigfox radio
  • The methods, prefixed by Lw are used to control the Lora network. See Lora radio
  • The methods, without prefixed, can be use in all case.
See also
armInit()
armInfo()

Examples

After have installed the armapi you can access and test directing the examples give by the Arduino package. For this go to File->Examples->armapi->example->... menu.

ide_arduino_add_exemples_menu.png

Sigfox downlink

This example send periodically 'Hello Sigfox' to Sigfox network.

arduino/sigfox_uplink/sigfox_uplink.ino

Sigfox uplink

This example send periodically 'Hello Sigfox' to Sigfox network and get the message from sigfox to on/off the led. The first byte is user to switch on/off the led.

  • If the byte is 0 the led is switch to off.
  • If the byte is different of 0 the led is switch to on.

arduino/sigfox_downlink/sigfox_downlink.ino

Fsk(local) echo

This example make a radio echo on the radio channel 4 with 9600bps radio speed.

arduino/fsk_echo/fsk_echo.ino