Skip to content

Commit 8f4cc60

Browse files
authored
Update example.py
1 parent f14efa2 commit 8f4cc60

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

example.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#Connect to Wifi
66
GLOB_WLAN=MOD_NETWORK.WLAN(MOD_NETWORK.STA_IF)
77
GLOB_WLAN.active(True)
8-
GLOB_WLAN.connect("YOURSSID", "YOURPASSWD")
8+
GLOB_WLAN.connect("SSID", "PASSWD")
99

1010
while not GLOB_WLAN.isconnected():
1111
pass
1212

1313
#firebase example
1414
import ufirebase as firebase
15-
firebase.setURL("https://YOURDATABASE")
15+
firebase.setURL("https://DATABASE.firebaseio.com/")
1616

1717
#Put Tag1
1818
firebase.put("testtag", "1234", bg=0)
@@ -22,12 +22,23 @@
2222

2323
#Get Tag1
2424
firebase.get("testtag", "var1", bg=0)
25-
print(firebase.var1)
25+
print("testtag: "+str(firebase.var1))
2626

2727
#Get Tag2
28-
firebase.get("lolval", "lolwhat", bg=1)
29-
print("Im Downloading...")
30-
MOD_TIME.sleep(5) #Do something in this time
31-
print("lolval_1: "+str(firebase.lolwhat["testval"]["somenumbers"])+
28+
def callbackfunc():
29+
print("\nlolval_1: "+str(firebase.lolwhat["testval"]["somenumbers"])+
3230
"\nlolval_2: "+str(firebase.lolwhat["testval"]["something"])+
3331
"\nlolall: "+str(firebase.lolwhat))
32+
33+
firebase.get("lolval", "lolwhat", bg=1, cb=(callbackfunc, ()))
34+
print(end="Im getting lolval now")
35+
36+
#Do something in this time
37+
while 1:
38+
print(end=".")
39+
MOD_TIME.sleep(.100)
40+
try:
41+
firebase.lolwhat
42+
break
43+
except:
44+
pass

0 commit comments

Comments
 (0)