Skip to content

Commit 669ad27

Browse files
authored
Merge pull request #34 from shramik49/master
Delete Arduino Uno Wifi Rev2 Example
2 parents a306d3e + f9c7b98 commit 669ad27

File tree

2 files changed

+39
-54
lines changed

2 files changed

+39
-54
lines changed

examples/Connections/UnoWifiRev2/UnoWifiRev2.ino

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
Cayenne Tank Widget Example.
3+
4+
The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.
5+
6+
Steps:
7+
1. Attach an analog input device (e.g. a temperature sensor) to your Arduino.
8+
2. Set the VIRTUAL_CHANNEL value below to the virtual channel of a Tank Custom Widget you have added in the Dashboard.
9+
3. Update the CAYENNE_OUT function below to send the data from your sensor.
10+
4. Set the Cayenne authentication info to match the authentication info from the Dashboard.
11+
5. Compile and upload this sketch.
12+
*/
13+
14+
//#define CAYENNE_DEBUG // Uncomment to show debug messages
15+
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
16+
#include <CayenneMQTTEthernet.h>
17+
18+
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
19+
char username[] = "MQTT_USERNAME";
20+
char password[] = "MQTT_PASSWORD";
21+
char clientID[] = "CLIENT_ID";
22+
23+
void setup() {
24+
Serial.begin(9600);
25+
Cayenne.begin(username, password, clientID);
26+
}
27+
28+
void loop() {
29+
Cayenne.loop();
30+
}
31+
32+
// Default function for sending sensor data at intervals to Cayenne.
33+
CAYENNE_OUT(1)
34+
{
35+
// Write data to Cayenne here.
36+
int val = analogRead(0);
37+
val = map(val, 0, 1023, 0, 100);
38+
Cayenne.virtualWrite(1, val, "tl", "null");
39+
}

0 commit comments

Comments
 (0)