Skip to content

Commit

Permalink
Merge pull request arduino#6 from bblacey/example-versioning
Browse files Browse the repository at this point in the history
Sketch reporting of name and versioning added
  • Loading branch information
henrikekblad committed Mar 21, 2014
2 parents 6404899 + 67b52ec commit ef5f00e
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ 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);

Expand Down
3 changes: 3 additions & 0 deletions libraries/MySensors/examples/IrSensor/IrSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions libraries/MySensors/examples/LightSensor/LightSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions libraries/MySensors/examples/MotionSensor/MotionSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
Expand Down
3 changes: 3 additions & 0 deletions libraries/MySensors/examples/RelayActuator/RelayActuator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libraries/MySensors/examples/RelayingNode/RelayingNode.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions libraries/MySensors/examples/ServoActuator/ServoActuator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ef5f00e

Please sign in to comment.