Commit 341bb76d authored by aurian.foulner's avatar aurian.foulner

Add new file

parents
#include <SPI.h>
#include "ThingSpeak.h"
#include <WiFiNINA.h>
const int pinTemp = A0;
const int B = 3975;
const char ssid[] = "VM1043083";
const char password[] = "xvyg3tntKgtk";
const unsigned long channel_id = 2402218;
const char write_api_key = "DA7EMSRE1MB5TGXG";
WiFiClient client;
void setup() {
Serial.begin(9600);
Serial.print("Connecting to ");
Serial.print(ssid);
WiFi.begin(ssid, password);
Serial.println();
Serial.println("Connected");
ThingSpeak.begin(client);
}
void loop() {
int value = analogRead(pinTemp);
float res = (float)(1023-value)*10000/value;
float temp = 1/(log(res/10000)/B+1/298.15)-273.15;
Serial.println(temp);
Serial.println("Posting" + String(temp, 2)+ " to ThingSpeak");
ThingSpeak.setField(1, String(temp, 2));
ThingSpeak.writeFields(channel_id, write_api_key);
delay(3000);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment