forked from sanyc/pxt-Obloq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpTest.ts
31 lines (29 loc) · 813 Bytes
/
httpTest.ts
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
//get post
Obloq.Obloq_http_setup(
SerialPin.P1,
SerialPin.P2,
"dfrobotYanfa",
"hidfrobot",
"192.168.0.106",
8080
)
basic.forever(() => {
basic.showString(Obloq.Obloq_http_get("input?id=1&val=" + input.lightLevel(), 10000))
basic.pause(50)
basic.showString(Obloq.Obloq_http_post("input?name=admin", "{\"id\":\"1\",\"val\":\"" + input.temperature() + "\"}", 10000))
basic.pause(50)
})
//IFTTT
Obloq.Obloq_http_setup(
SerialPin.P1,
SerialPin.P2,
"dfrobotYanfa",
"hidfrobot",
"maker.ifttt.com",
80
)
basic.showString(Obloq.Obloq_wifi_ipconfig())
basic.forever(() => {
basic.showString(Obloq.Obloq_http_get("trigger/testobloq/with/key/h_srC8EuWGX5izhfi7pi5", 10000))
basic.pause(100)
})