Links

Frame 10: Tiny Frame

This example creates a BINARY Tiny frame with simple and multiple data and shows it.

Required Materials

1 x Waspmote 1 x Battery 1 x MiniUSB wire

Code

/*
* ------ FRAME_10_tiny_frame - WaspFrame Generate Tiny Frame --------
*
* Explanation: This type of frame has been designed to create short
* frames with data. The purpose of implementing tiny frames is to be
* able to create sensor data frames which can be send via short-payload
* protocols, like Sigfox or LoRaWAN.
*
* Meshlium does not support this frame format.
*
* Copyright (C) 2019 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version: 3.0
* Design: David Gascón
* Implementation: Isabel Burillo
*/
#include <WaspFrame.h>
void setup()
{
// Init USB port
USB.ON();
USB.println(F("Start program"));
// init ACC
ACC.ON();
}
void loop()
{
// Create new frame
frame.createFrame(BINARY);
// set frame fields (multiple)
frame.addSensor(SENSOR_ACC, ACC.getX(), ACC.getY(), ACC.getZ());
// set frame fields
frame.addSensor(SENSOR_BAT, PWR.getBatteryLevel());
// Print frame
frame.showFrame();
// Generate Tiny Frame
frame.generateTinyFrame();
USB.print(F("- Tiny frame generated:"));
USB.printHexln(frame.bufferTiny, frame.lengthTiny);
delay(5000);
}

Output

#
Start program
===============================
Current BINARY Frame:
Length: 31
Frame Type: 6
frame (HEX): 3C3D3E061A5284BC32C8913E276E6F64655F303123003FEBFFB4FFCC03345D
frame (STR): <=>R��2ȑ>'node_01#?�����4]
===============================
- Tiny frame generated:000B3FEBFFB4FFCC03345D
===============================
Current BINARY Frame:
Length: 31
Frame Type: 6
frame (HEX): 3C3D3E061A5284BC32C8913E276E6F64655F303123013FF3FFBDFFD003345D
frame (STR): <=>R��2ȑ>'node_01#?�����4]
===============================
- Tiny frame generated:010B3FF3FFBDFFD003345D
===============================
Current BINARY Frame:
Length: 31
Frame Type: 6
frame (HEX): 3C3D3E061A5284BC32C8913E276E6F64655F303123023FECFFCFFFCC03345D
frame (STR): <=>R��2ȑ>'node_01#?�����4]
===============================
- Tiny frame generated:020B3FECFFCFFFCC03345D
===============================
Current BINARY Frame:
Length: 31
Frame Type: 6
frame (HEX): 3C3D3E061A5284BC32C8913E276E6F64655F303123033FE0FFC4FFC703345D
frame (STR): <=>R��2ȑ>'node_01#?�����4]
===============================
- Tiny frame generated:030B3FE0FFC4FFC703345D
===============================
Current BINARY Frame:
Length: 31
Frame Type: 6
frame (HEX): 3C3D3E061A5284BC32C8913E276E6F64655F303123043FE7FFBDFFBB03345D
frame (STR): <=>R��2ȑ>'node_01#?�����4]
===============================
- Tiny frame generated:040B3FE7FFBDFFBB03345D
===============================
Current BINARY Frame:
Length: 31
Frame Type: 6
frame (HEX): 3C3D3E061A5284BC32C8913E276E6F64655F303123053FEEFFCCFFCA03345D
frame (STR): <=>R��2ȑ>'node_01#?�����4]
===============================
- Tiny frame generated:050B3FEEFFCCFFCA03345D
===============================
Current BINARY Frame:
Length: 31
Frame Type: 6
frame (HEX): 3C3D3E061A5284BC32C8913E276E6F64655F303123063FE0FFBEFFBE03345D
frame (STR): <=>R��2ȑ>'node_01#?�����4]
===============================
- Tiny frame generated:060B3FE0FFBEFFBE03345D
Last modified 2yr ago