You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This sketch shows how to set up a Gauge Custom Widget with Cayenne.
5
+
6
+
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.
7
+
8
+
Steps:
9
+
1. Attach an analog input device (e.g. a temperature sensor) to your Arduino.
10
+
2. Set the VIRTUAL_CHANNEL value below to a free virtual channel (or the virtual channel of a Gauge Custom Widget you have added) in the Dashboard.
11
+
3. Update the CAYENNE_OUT function below to send the data from your sensor.
12
+
4. Set the Cayenne authentication info to match the authentication info from the Dashboard.
13
+
5. Compile and upload this sketch.
14
+
6. Once the Arduino connects to the Dashboard it should automatically create a temporary display widget (or update the Gauge widget you have added) with data.
15
+
To make a temporary widget permanent click the plus sign on the widget. Use the settings gear icon to change between Value, Gauge and Line Chart widgets.
16
+
*/
17
+
18
+
#defineCAYENNE_PRINT Serial // Comment this out to disable prints and save space
19
+
#include<CayenneMQTTEthernet.h>// Change this to use a different communication device. See Communications examples.
20
+
21
+
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
22
+
char username[] = "MQTT_USERNAME";
23
+
char password[] = "MQTT_PASSWORD";
24
+
char clientID[] = "CLIENT_ID";
25
+
26
+
#defineVIRTUAL_CHANNEL1
27
+
28
+
voidsetup()
29
+
{
30
+
Serial.begin(9600);
31
+
Cayenne.begin(username, password, clientID);
32
+
}
33
+
34
+
voidloop()
35
+
{
36
+
Cayenne.loop();
37
+
}
38
+
39
+
// This function is called at intervals to send sensor data to Cayenne.
40
+
CAYENNE_OUT(VIRTUAL_CHANNEL)
41
+
{
42
+
// Read data from the sensor and send it to the virtual channel here.
43
+
// You can write data using virtualWrite or other Cayenne write functions.
44
+
// For example, to send a temperature in Celsius you can use the following:
This sketch shows how to set up a Line Chart Custom Widget with Cayenne.
5
+
6
+
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.
7
+
8
+
Steps:
9
+
1. Attach an analog input device (e.g. a temperature sensor) to your Arduino.
10
+
2. Set the VIRTUAL_CHANNEL value below to a free virtual channel (or the virtual channel of a Line Chart Custom Widget you have added) in the Dashboard.
11
+
3. Update the CAYENNE_OUT function below to send the data from your sensor.
12
+
4. Set the Cayenne authentication info to match the authentication info from the Dashboard.
13
+
5. Compile and upload this sketch.
14
+
6. Once the Arduino connects to the Dashboard it should automatically create a temporary display widget (or update the Line Chart widget you have added) with data.
15
+
To make a temporary widget permanent click the plus sign on the widget. Use the settings gear icon to change between Value, Gauge and Line Chart widgets.
16
+
*/
17
+
18
+
#defineCAYENNE_PRINT Serial // Comment this out to disable prints and save space
19
+
#include<CayenneMQTTEthernet.h>// Change this to use a different communication device. See Communications examples.
20
+
21
+
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
22
+
char username[] = "MQTT_USERNAME";
23
+
char password[] = "MQTT_PASSWORD";
24
+
char clientID[] = "CLIENT_ID";
25
+
26
+
#defineVIRTUAL_CHANNEL1
27
+
28
+
voidsetup()
29
+
{
30
+
Serial.begin(9600);
31
+
Cayenne.begin(username, password, clientID);
32
+
}
33
+
34
+
voidloop()
35
+
{
36
+
Cayenne.loop();
37
+
}
38
+
39
+
// This function is called at intervals to send sensor data to Cayenne.
40
+
CAYENNE_OUT(VIRTUAL_CHANNEL)
41
+
{
42
+
// Read data from the sensor and send it to the virtual channel here.
43
+
// You can write data using virtualWrite or other Cayenne write functions.
44
+
// For example, to send a temperature in Celsius you can use the following:
This sketch shows how to set up a 2 State Custom Widget with Cayenne.
5
+
6
+
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.
7
+
8
+
Steps:
9
+
1. Attach a digital input device (e.g. a button) to a digital pin on your Arduino.
10
+
2. Set the SENSOR_PIN value below to the pin number you used when connecting the sensor.
11
+
3. Set the VIRTUAL_CHANNEL value below to a free virtual channel (or the virtual channel of a 2 State Custom Widget you have added) in the Dashboard.
12
+
4. Set the Cayenne authentication info to match the authentication info from the Dashboard.
13
+
5. Compile and upload this sketch.
14
+
6. Once the Arduino connects to the Dashboard it should automatically create a temporary display widget (or update the 2 State widget you have added) with data.
15
+
To make a temporary widget permanent click the plus sign on the widget.
16
+
*/
17
+
18
+
#defineCAYENNE_PRINT Serial // Comment this out to disable prints and save space
19
+
#include<CayenneMQTTEthernet.h>
20
+
21
+
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
22
+
char username[] = "MQTT_USERNAME";
23
+
char password[] = "MQTT_PASSWORD";
24
+
char clientID[] = "CLIENT_ID";
25
+
26
+
#defineVIRTUAL_CHANNEL1
27
+
#defineSENSOR_PIN0
28
+
29
+
voidsetup()
30
+
{
31
+
Serial.begin(9600);
32
+
Cayenne.begin(username, password, clientID);
33
+
}
34
+
35
+
voidloop()
36
+
{
37
+
Cayenne.loop();
38
+
}
39
+
40
+
// This function is called at intervals to send sensor data to Cayenne.
41
+
CAYENNE_OUT(VIRTUAL_CHANNEL)
42
+
{
43
+
// Read data from the sensor and send it to the virtual channel here.
44
+
// For example, to send a digital value you can use the following:
This sketch shows how to set up a Value Custom Widget with Cayenne.
5
+
6
+
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.
7
+
8
+
Steps:
9
+
1. Attach an analog input device (e.g. a temperature sensor) to your Arduino.
10
+
2. Set the VIRTUAL_CHANNEL value below to a free virtual channel (or the virtual channel of a Value Custom Widget you have added) in the Dashboard.
11
+
3. Update the CAYENNE_OUT function below to send the data from your sensor.
12
+
4. Set the Cayenne authentication info to match the authentication info from the Dashboard.
13
+
5. Compile and upload this sketch.
14
+
6. Once the Arduino connects to the Dashboard it should automatically create a temporary display widget (or update the Value widget you have added) with data.
15
+
To make a temporary widget permanent click the plus sign on the widget. Use the settings gear icon to change between Value, Gauge and Line Chart widgets.
16
+
*/
17
+
18
+
#defineCAYENNE_PRINT Serial // Comment this out to disable prints and save space
19
+
#include<CayenneMQTTEthernet.h>// Change this to use a different communication device. See Communications examples.
20
+
21
+
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
22
+
char username[] = "MQTT_USERNAME";
23
+
char password[] = "MQTT_PASSWORD";
24
+
char clientID[] = "CLIENT_ID";
25
+
26
+
#defineVIRTUAL_CHANNEL1
27
+
28
+
voidsetup()
29
+
{
30
+
Serial.begin(9600);
31
+
Cayenne.begin(username, password, clientID);
32
+
}
33
+
34
+
voidloop()
35
+
{
36
+
Cayenne.loop();
37
+
}
38
+
39
+
// This function is called at intervals to send sensor data to Cayenne.
40
+
CAYENNE_OUT(VIRTUAL_CHANNEL)
41
+
{
42
+
// Read data from the sensor and send it to the virtual channel here.
43
+
// You can write data using virtualWrite or other Cayenne write functions.
44
+
// For example, to send a temperature in Celsius you can use the following:
0 commit comments