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 the new Development Section.

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

» SC 06: Crack Propagation Sensor Reading

In this example the Smart Cities sensor board is turned on and the crack propagation sensor read every second approximately, printingthe measured value through the USB port.

Required Materials

1 x Waspmote
1 x Battery
1 x Smart Cities board
1 x Crack Propagation sensor


* This sensor is thought to operate on the LDR socket.
* Remember to connect the battery to Waspmote for proper operation.
* The connection of the sensor is described in the Smart Cities technical guide.
* Take into account that when powering the luminosity sensor you will be turning on also the temperature, humidity and dust sensors.
* When this sensor is to be used, a modification of the LDR socket is recommended for proper operation, but take into account that it will disable the use of the LDR on the socket anymore. For more information please contact Libelium sales department.
* This example can only be executed in Waspmote v12


 *  --[SC_6] - Reading the Crack Propagation Sensor on Smart Cities board-- 
 *  Explanation: Turn on the sensor every second, taking a measurement and
 *               printing its result through the USB port.
 *  Copyright (C) 2012 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 Gascón 
 *  Implementation:    Manuel Calahorra

#include <WaspSensorCities.h>

// Variable to store the read value
float value;

void setup()
  // Turn on the USB and print a start message

  // Turn on the sensor board
  // Turn on the RTC
void loop()
  // Part 1: Sensor reading
  // Turn on the sensor and wait for stabilization and response time
  SensorCities.setSensorMode(SENS_ON, SENS_CITIES_CP);
  // Read the crack propagation sensor 
  value = SensorCities.readValue(SENS_CITIES_CP);
  // Turn off the sensor
  SensorCities.setSensorMode(SENS_OFF, SENS_CITIES_CP);
  // Part 2: USB printing
  // Print the resistance read value through the USB
  USB.print(F("Output: "));


Output: 904.0000000000
Output: 904.0000000000
Output: 904.0000000000
Output: 904.0000000000
Output: 904.0000000000
Output: 904.0000000000
Output: 904.0000000000
Output: 857.0000000000
Output: 857.0000000000
Output: 847.0000000000
Output: 847.0000000000
Output: 836.0000000000
Output: 805.0000000000
Output: 0.0000000000
Output: 0.0000000000
Output: 0.0000000000

Quick Publish: