We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c5dc10 commit bef1951Copy full SHA for bef1951
src/main.ts
@@ -1,10 +1,17 @@
1
import { delay } from "@devicescript/core"
2
import { createData, publishData, startAdafruitIOMQTTClient } from "."
3
+import { schedule } from "@devicescript/runtime"
4
5
console.log(`post data using http`)
6
await createData(123)
7
8
console.log(`post data using mqtt in 5s`)
9
await delay(5000)
10
const client = await startAdafruitIOMQTTClient()
-await publishData(client, 456)
11
+
12
+schedule(
13
+ async () => {
14
+ await publishData(client, 456)
15
+ },
16
+ { interval: 5000 }
17
+)
0 commit comments