# Quickstart

Di bawah ini adalah beberapa contoh kode yang dapat anda gunakan untuk mengirim data dari proyek yang telah anda buat ke ANTARES.

{% tabs %}
{% tab title="ESP8266(HTTP)" %}
Di bawah ini adalah video tutorial yang dapat anda gunakan untuk mengirim dan mendapatkan data dari ANTARES melalui ESP8266 (HTTP).\
Harap install [library ini](https://github.com/antaresdocumentation/antares-esp8266-http) pada Arduino IDE.

{% embed url="<https://youtu.be/Eg06Q1HsWdM>" %}

{% code lineNumbers="true" %}

```arduino
#include <AntaresESP8266HTTP.h>

#define ACCESSKEY "your-access-key"
#define WIFISSID "your-wifi-ssid"
#define PASSWORD "your-wifi-password"

#define applicationName "your-application-name"
#define deviceName "your-device-name"

AntaresESP8266HTTP antares(ACCESSKEY);

void setup() {
  Serial.begin(115200);
  antares.setDebug(true);
  antares.wifiConnection(WIFISSID,PASSWORD);
}

void loop() {
  int temp = random(25,30);
  int hum = random(75,90);

  antares.add("temperature", temp);
  antares.add("humidity", hum);

  antares.send(applicationName, deviceName);
  delay(10000);
}
```

{% endcode %}

<figure><img src="https://content.gitbook.com/content/rRkxjRLeqOm0pNhLfsus/blobs/235TgOsav6okIyTXPae6/BUAT%20GITBOOK.png" alt=""><figcaption></figcaption></figure>

**Selamat, anda telah mengirim data ke ANTARES.**
{% endtab %}

{% tab title="ESP8266(MQTT)" %}
Harap install [library ini](https://github.com/antaresdocumentation/antares-esp8266-mqtt) pada Arduino IDE.

{% code lineNumbers="true" %}

```arduino
#include <AntaresESP8266MQTT.h>

#define ACCESSKEY "your-access-key"
#define WIFISSID "your-wifi-ssid"
#define PASSWORD "your-wifi-password"

#define applicationName "your-application-name"
#define deviceName "your-device-name"

AntaresESP8266MQTT antares(ACCESSKEY);

void setup() {
  Serial.begin(115200);
  antares.setDebug(true);
  antares.wifiConnection(WIFISSID,PASSWORD);
  antares.setMqttServer();
}

void loop() {
  int temp = random(25,30) ;
  int hum = random(75,90);

  antares.add("temperature", temp);
  antares.add("humidity", hum);

  antares.publish(applicationName, deviceName);
  delay(5000);
}
```

{% endcode %}

<figure><img src="https://content.gitbook.com/content/rRkxjRLeqOm0pNhLfsus/blobs/rQEmywYXuTuyO0vJhYmM/quickstart.png" alt=""><figcaption></figcaption></figure>

**Selamat, anda telah mengirim data ke ANTARES.**
{% endtab %}

{% tab title="NODE JS" %}
Silahkan install `antares-http` dengan npm terlebih dahulu, pastikan npm dan NodeJS terinstall pada CMD (Windows) atau Terminal (Linux):

Informasi lebih lanjut mengenai Antares untuk NodeJS dapat dilihat di [halaman npm antares-http](https://www.npmjs.com/package/antares-http).

<pre class="language-bash"><code class="lang-bash"><strong>npm init
</strong>npm install antares-http --save
</code></pre>

```javascript
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);
});
```

<figure><img src="https://content.gitbook.com/content/rRkxjRLeqOm0pNhLfsus/blobs/rQEmywYXuTuyO0vJhYmM/quickstart.png" alt=""><figcaption></figcaption></figure>

**Selamat, anda telah mengirim data ke ANTARES.**
{% endtab %}

{% tab title="PYTHON" %}
Silahkan install `antares-http` dengan pip terlebih dahulu, pastikan pip dan Python terinstall pada CMD (Windows) atau Terminal (Linux):

Informasi lebih lanjut mengenai Antares untuk Python dapat dilihat di [halaman PyPi antares-http](https://pypi.org/project/antares-http).

```bash
pip install antares-http
```

```python
from antares_http import antares

data = {
    'temperature' : 32,
    'humidity' : 80
}
antares.setAccessKey('your-access-key')
antares.send(data, 'your-project-name', 'your-device-name')
```

<figure><img src="https://content.gitbook.com/content/rRkxjRLeqOm0pNhLfsus/blobs/rQEmywYXuTuyO0vJhYmM/quickstart.png" alt=""><figcaption></figcaption></figure>

**Selamat, anda telah mengirim data ke ANTARES.**
{% endtab %}
{% endtabs %}
