Comment on page
Quickstart
Di bawah ini adalah beberapa contoh kode yang dapat anda gunakan untuk mengirim data dari proyek yang telah anda buat ke ANTARES.
ESP8266(HTTP)
ESP8266(MQTT)
NODE JS
PYTHON
Di bawah ini adalah video tutorial yang dapat anda gunakan untuk mengirim dan mendapatkan data dari ANTARES melalui ESP8266 (HTTP).
Harap install library ini pada Arduino IDE.
1
#include <AntaresESP8266HTTP.h>
2
3
#define ACCESSKEY "your-access-key"
4
#define WIFISSID "your-wifi-ssid"
5
#define PASSWORD "your-wifi-password"
6
7
#define applicationName "your-application-name"
8
#define deviceName "your-device-name"
9
10
AntaresESP8266HTTP antares(ACCESSKEY);
11
12
void setup() {
13
Serial.begin(115200);
14
antares.setDebug(true);
15
antares.wifiConnection(WIFISSID,PASSWORD);
16
}
17
18
void loop() {
19
int temp = random(25,30);
20
int hum = random(75,90);
21
22
antares.add("temperature", temp);
23
antares.add("humidity", hum);
24
25
antares.send(applicationName, deviceName);
26
delay(10000);
27
}

Selamat, anda telah mengirim data ke ANTARES.
1
#include <AntaresESP8266MQTT.h>
2
3
#define ACCESSKEY "your-access-key"
4
#define WIFISSID "your-wifi-ssid"
5
#define PASSWORD "your-wifi-password"
6
7
#define applicationName "your-application-name"
8
#define deviceName "your-device-name"
9
10
AntaresESP8266MQTT antares(ACCESSKEY);
11
12
void setup() {
13
Serial.begin(115200);
14
antares.setDebug(true);
15
antares.wifiConnection(WIFISSID,PASSWORD);
16
antares.setMqttServer();
17
}
18
19
void loop() {
20
int temp = random(25,30) ;
21
int hum = random(75,90);
22
23
antares.add("temperature", temp);
24
antares.add("humidity", hum);
25
26
antares.publish(applicationName, deviceName);
27
delay(5000);
28
}

Selamat, anda telah mengirim data ke ANTARES.
Silahkan install
antares-http
dengan npm terlebih dahulu, pastikan npm dan NodeJS terinstall pada CMD (Windows) atau Terminal (Linux):npm init
npm install antares-http --save
const antares = require('antares-http');
data = {
temperature: 32,
humidity: 80,
}
antares.setAccessKey('your-access-key');
antares.send(data, 'your-project-name', 'your-device-name')
.then((response) => {
console.log(response);
});

Selamat, anda telah mengirim data ke ANTARES.
Silahkan install
antares-http
dengan pip terlebih dahulu, pastikan pip dan Python terinstall pada CMD (Windows) atau Terminal (Linux):pip install antares-http
from antares_http import antares
data = {
'temperature' : 32,
'humidity' : 80
}
antares.setAccessKey('your-access-key')
antares.send(data, 'your-project-name', 'your-device-name')

Selamat, anda telah mengirim data ke ANTARES.
Last modified 2mo ago