Ag xtr 13: dendrometer sensor reading
Basic example that turns on, reads and turn off the sensor. Measured parameters are stored in the corresponding class variables and printed by the serial monitor.

Required Materials

- 1 Waspmote Plug & Sense! Smart Agriculture Xtreme - 1 dendrometer sensor

Notes

- This example is only valid for Waspmote v15

Code

1
/*
2
----------- [Ag_xtr_13] - Dendrometer sensor reading --------------------
3
4
Explanation: Basic example that turns on, reads and turn off the
5
sensor. Measured parameters are stored in the corresponding class
6
variables and printed by the serial monitor.
7
8
Measured parameters:
9
- Trunk diameter
10
- Stem diameter
11
- Fruit diameter
12
13
14
Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
15
http://www.libelium.com
16
17
This program is free software: you can redistribute it and/or modify
18
it under the terms of the GNU General Public License as published by
19
the Free Software Foundation, either version 3 of the License, or
20
(at your option) any later version.
21
22
This program is distributed in the hope that it will be useful,
23
but WITHOUT ANY WARRANTY; without even the implied warranty of
24
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
GNU General Public License for more details.
26
27
You should have received a copy of the GNU General Public License
28
along with this program. If not, see .
29
30
Version: 3.1
31
Design: David Gascón
32
Implementation: J.Siscart, V.Boria
33
*/
34
35
#include <WaspSensorXtr.h>
36
37
/*
38
SELECT THE RIGHT SOCKET FOR EACH SENSOR.
39
40
Possible sockets for this sensor are:
41
- XTR_SOCKET_C _________
42
|---------|
43
| A B C |
44
|_D__E__F_|
45
46
47
Example: a 5TM sensor on socket A will be
48
[Sensor Class] [Sensor Name] [Selected socket]
49
Decagon_5TM mySensor (XTR_SOCKET_A);
50
51
Refer to the technical guide for information about possible combinations.
52
www.libelium.com/downloads/documentation/smart_agriculture_xtreme_sensor_board.pdf
53
*/
54
55
/*
56
Select dendrometer type:
57
- DENDRO_DD: Stem diameter
58
- DENDRO_DF: Fruit diameter
59
- DENDRO_DC3: Trunk diameter
60
*/
61
// [Sensor Class] [Sensor Name] [dendrometer type]
62
dendrometer mySensor(DENDRO_DD);
63
64
void setup()
65
{
66
USB.println(F("Dendrometer example"));
67
}
68
69
void loop()
70
{
71
// 1. Turn ON the sensor
72
mySensor.ON();
73
74
// 2. Read the sensor
75
mySensor.read();
76
77
// 3. Turn off the sensor
78
mySensor.OFF();
79
80
// 4. Print information
81
USB.println(F("---------------------------"));
82
USB.println(F("Dendrometer"));
83
USB.print(F("Diameter:"));
84
USB.printFloat(mySensor.diameter, 3);
85
USB.println(F(" mm"));
86
USB.println(F("---------------------------\n"));
87
88
delay(5000);
89
90
}
Copied!

Output

1
H#
2
Dendrometer example
3
---------------------------
4
Dendrometer
5
Diameter:2.496 mm
6
---------------------------
7
---------------------------
8
Dendrometer
9
Diameter:3.496 mm
10
---------------------------
Copied!
Last modified 1yr ago