Arduino_Genuino
Published

Displaying Sensor Values Arduino IoT Cloud

This project will show you how to set up an Arduino IoT Cloud dashboard and display multiple sensor values.

BeginnerFull instructions provided1 hour4,213
Displaying Sensor Values Arduino IoT Cloud

Things used in this project

Hardware components

Arduino MKR WiFi 1010
Arduino MKR WiFi 1010
Or another IoT Cloud compatible board
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×2
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IoT Cloud
Arduino IoT Cloud

Story

Read more

Code

IoTPotentiometers

Arduino
Upload this sketch from the IoT Cloud
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/3d801846-1f2a-4a88-857a-fda14addeacc
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int pot1;
int pot2;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
const int potPin1 = A1;
const int potPin2 = A2;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
pinMode(potPin1, INPUT);
pinMode(potPin2, INPUT);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
pot1 = analogRead(potPin1);
pot2 = analogRead(potPin2);
Serial.println(pot1);
Serial.println(pot2);
}

Credits

Arduino_Genuino
91 projects • 11344 followers
Contact

Comments

Please log in or sign up to comment.