-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIDEA code
59 lines (48 loc) · 1.34 KB
/
IDEA code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
ARDUINO CODE
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
#include <FirebaseArduino.h>
#include <ArduinoJson.h>
#include <ESP8266HTTPClient.h>
// Set these to run example.
#define FIREBASE_HOST "smart-home-f5995-default-rtdb.firebaseio.com"
#define FIREBASE_AUTH "AxKFBFQR4F4294UvzSy1Am34dR3oN8R9JsSlDkX"
#define WIFI_SSID "0opsyProxy :-)"
#define WIFI_PASSWORD "12345678"
String myString;
int vr = A0; // variable resistor connected
int sdata = 0; // The variable resistor value will be stored in sdata.
void setup()
{
// Debug console
Serial.begin(9600);
pinMode(vr ,INPUT);
// connect to wifi.
pinMode(D0,OUTPUT);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Firebase.setString("Variable/Value","smart-home-f5995-default-rtdb");
}
void loop()
{
sdata = analogRead(vr);
myString = String(sdata);
Serial.println(myString);
Firebase.setString("Variable/Value",myString);
delay(1000);
}