Modified all example sketches to report the sketch info to the gateway/controller.

This commit is contained in:
Bruce Lacey
2014-03-21 13:39:02 -07:00
parent 64048992cc
commit f828eec251
16 changed files with 52 additions and 3 deletions
@@ -1,5 +1,5 @@
// This is an example on how to send in battery measurement for a sensor
// For instruction how to measure battery power on A0 see the follwoing forum
// This is an example that demonstrates how to report the battery level for a sensor
// Instructions for measuring battery capacity on A0 are available in the follwoing forum
// thread: http://forum.micasaverde.com/index.php/topic,20078.0.html
@@ -21,6 +21,9 @@ void setup()
// use the 1.1 V internal reference
analogReference(INTERNAL);
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Battery Meter", "1.0");
}
void loop()
@@ -23,6 +23,10 @@ void setup()
sensors.begin();
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Temperature Sensor", "1.0");
// Fetch the number of attached sensors
numSensors = sensors.getDeviceCount();
// Register all sensors to gw (they will be created as child devices)
@@ -21,6 +21,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Distance Sensor", "1.0");
// Register all sensors to gw (they will be created as child devices)
gw.sendSensorPresentation(0, S_DISTANCE);
metric = gw.isMetricSystem();
@@ -39,6 +39,10 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Energy Meter", "1.0");
// Register this device as power sensor
gw.sendSensorPresentation(CHILD_ID, S_POWER);
@@ -26,6 +26,9 @@ void setup()
irrecv.enableIRIn(); // Start the ir receiver
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("IR Sensor", "1.0");
// Register a sensors to gw. Use binary light for test purposes.
gw.sendSensorPresentation(CHILD_1, S_LIGHT);
}
@@ -38,6 +38,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Light Lux Sensor", "1.0");
// Register all sensors to gateway (they will be created as child devices)
gw.sendSensorPresentation(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
@@ -17,6 +17,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Light Sensor", "1.0");
// Register all sensors to gateway (they will be created as child devices)
gw.sendSensorPresentation(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
}
@@ -14,6 +14,10 @@ Sleep sleep;
void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Motion Sensor", "1.0");
pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
// Register all sensors to gw (they will be created as child devices)
gw.sendSensorPresentation(CHILD_ID, S_MOTION);
@@ -27,6 +27,10 @@ boolean metric;
void setup() {
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Pressure Sensor", "1.0");
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
while (1) { }
@@ -16,6 +16,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Relay", "1.0");
// Register all sensors to gw (they will be created as child devices)
for (int i=0; i<NUMBER_OF_RELAYS;i++) {
gw.sendSensorPresentation(RELAY_1+i, S_LIGHT);
@@ -26,6 +26,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Relay & Button", "1.0");
// Set buttonPin as Input
pinMode(BUTTON_PIN, INPUT);
buttVal = digitalRead(BUTTON_PIN); //read initial state
@@ -16,7 +16,7 @@ void setup()
gw.begin();
//Send the sensor node sketch version information to the gateway
gw.sendSketchInfo("RelayingNode", "1.2");
gw.sendSketchInfo("Relaying Node", "1.0");
}
void loop()
@@ -29,6 +29,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Servo", "1.0");
// Register all sensors to gw (they will be created as child devices)
gw.sendSensorPresentation(CHILD_ID, S_COVER);
@@ -16,6 +16,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Soil Moisture Sensor", "1.0");
pinMode(DIGITAL_INPUT_SOIL_SENSOR, INPUT); // sets the soil sensor digital pin as input
// Register all sensors to gw (they will be created as child devices)
gw.sendSensorPresentation(CHILD_ID, S_MOTION);
@@ -17,6 +17,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Clock", "1.0");
// Register any sensortype. This example we just create a motion sensor.
gw.sendSensorPresentation(CHILD_ID, S_MOTION);
@@ -48,6 +48,9 @@ void setup()
{
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Water Meter", "1.0");
// Register this device as Waterflow sensor
gw.sendSensorPresentation(CHILD_ID, S_WATER);