Skip to content

Instantly share code, notes, and snippets.

@EDISON-SCIENCE-CORNER
Created August 22, 2021 13:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EDISON-SCIENCE-CORNER/992507729bdbf8d6dfb019b310819789 to your computer and use it in GitHub Desktop.
Save EDISON-SCIENCE-CORNER/992507729bdbf8d6dfb019b310819789 to your computer and use it in GitHub Desktop.
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/96da2ac8-336f-496e-9206-e9c105ec58b0
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
bool led;
CloudTemperatureSensor temperature;
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"
int outputpin=A0;
void setup() {
// Initialize serial and wait for port to open:
pinMode(2,OUTPUT);
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// 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();
int analogValue=analogRead(outputpin);
float millivolts=(analogValue/1024.0)*3300;
float celsius=millivolts/10;
temperature=celsius;
// Your code here
}
void onLedChange() {
if(led==0)
{digitalWrite(2,HIGH);
}
else
{digitalWrite(2,LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment