Skip to content

Commit c87453e

Browse files
committed
Set pin mode and data type.
1 parent 88f7474 commit c87453e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/Sensors/DigitalMotionSensor/DigitalMotionSensor.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void setup()
3838

3939
void loop()
4040
{
41+
pinMode(SENSOR_PIN, INPUT);
4142
Cayenne.loop();
4243
checkSensor();
4344
}
@@ -54,9 +55,9 @@ void checkSensor()
5455
// Check the sensor state and send data when it changes.
5556
currentState = digitalRead(SENSOR_PIN);
5657
if (currentState != previousState) {
57-
Cayenne.virtualWrite(VIRTUAL_CHANNEL, currentState);
58+
Cayenne.virtualWrite(VIRTUAL_CHANNEL, currentState, "digital_sensor", "d");
5859
previousState = currentState;
5960
}
60-
previousMillis = currentMillis;
61+
previousMillis = currentMillis;
6162
}
6263
}

0 commit comments

Comments
 (0)