Development v12

Warning - Product Update

All the resources present on this section belong to Waspmote v12, Waspmote Plug & Sense! v12 and Meshlium v3.8.

If you have a Waspmote v15, Waspmote Plug & Sense! v15 or Meshlium v4.0 please go to this development section.

Check what is your version and what are the differences between the old and the new one in this document.

» Ev 10: Frame Class Utility

This is the basic code to create a frame with every socket of Events Board

Required Materials

1 x Waspmote PRO
1 x Battery
1 x MiniUSB wire
1 x Events Sensor Board


* This example can only be executed in Waspmote v12


 *  ------ [Ev_10] - Frame Class Utility -------- 
 *  Explanation: This is the basic code to create a frame with every
 * 	socket of Events Board
 *  Copyright (C) 2015 Libelium Comunicaciones Distribuidas S.L. 
 *  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 
 *  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 <>. 
 *  Version:           0.1
 *  Design:            David Gascon 
 *  Implementation:    Luis Miguel Martí

#include <WaspSensorEvent_v20.h>
#include <WaspFrame.h>

// Variable to store the read value
float socket1;
float socket2;
float socket3;
uint8_t socket4;
float socket5;
float socket6;
uint8_t socket7;
uint8_t socket8;

char node_ID[] = "Node_1";

void setup() 
  USB.println(F("Frame Utility Example for Events Board"));
  // Turn on the sensor board
  // Set the Waspmote ID

void loop()
  // 1. Read sensors

  // Read Socket 1
  socket1 = SensorEventv20.readValue(SENS_SOCKET1, SENS_RESISTIVE);
  // Read Socket 2
  socket2 = SensorEventv20.readValue(SENS_SOCKET2, SENS_RESISTIVE);
  // Read Socket 3
  socket3 = SensorEventv20.readValue(SENS_SOCKET3, SENS_RESISTIVE);
  // Read Socket 4
  socket4 = SensorEventv20.readValue(SENS_SOCKET4);
  // Read Socket 5
  socket5 = SensorEventv20.readValue(SENS_SOCKET5, SENS_TEMPERATURE);
  // Read Socket 6
  socket6 = SensorEventv20.readValue(SENS_SOCKET6, SENS_HUMIDITY);
  // Read Socket 7
  socket7 = SensorEventv20.readValue(SENS_SOCKET7);
  // Read Socket 8
  socket8 = SensorEventv20.readValue(SENS_SOCKET8);

  // 2. Create ASCII frame

  // Create new frame (ASCII)

  // Add stretch
  frame.addSensor(SENSOR_ST, socket1);
  // Add luminosity
  frame.addSensor(SENSOR_LUM, socket2);
  // Add pressure
  frame.addSensor(SENSOR_PW, socket3);
  // Add vibration
  frame.addSensor(SENSOR_VBR, socket4);
  // Add temperature
  frame.addSensor(SENSOR_TCA, socket5);
  // Add humidity
  frame.addSensor(SENSOR_HUMA, socket6);
  // Add PIR
  frame.addSensor(SENSOR_PIR, socket7);
  // Add liquid presence
  frame.addSensor(SENSOR_LP_D, socket8);
  // Show the frame

  //wait 2 seconds

Quick Publish: