By | 14/03/2021
Tutorial ESP8266 NodeMCU Jam Digital dan JWS LCD TFT 1.8

Tutorial NodeMCU ESP8266 dan Wemos D1 Mini membuat program jam digital sekaligus jadwal waktu sholat (JWS) beserta alarmnya menggunakan NTP server dan LCD TFT 1.8 akan dibahas pada artikel kali ini.

Mengambil waktu dari internet dengan NTP server dengan NodeMCU atau Wemos D1 Mini ESP8266 tidak lagi memerlukan modul RTC seperti DS3231 atau DS1307.

Sebelumnya juga saya sudah pernah menuliskan beberapa artikel terkait NTP server dengan nodemcu atau wemos d1 mini ESP8266, sehingga kalian bisa membacanya juga Jam Dot Matrix Waktu dari NTP Server Wemos ESP8266

Menggunakan NTP server lebih sederhana dari pada harus menambah modul RTC yang memerlukan pengeluaran biaya tambahan untuk membeli modul DS3231 atau DS1307

Cara kerja pengambilan waktu NTP Server ESP8266

Network Time Protocol (NTP) adalah sebuah protokol yang digunakan untuk pengsinkronan waktu di dalam sebuah jaringan bisa pada jaringan LAN (Local Area Network) maupun pada jaringan internet dan untuk sinkronisasi jam-jam sistem komputer di atas paket-switching, variabel-latency jaringan data. Proses sinkronisasi ini dilakukan didalam jalur komunikasi data yang biasanya menggunakan protokol komunikasi TCP/IP. Sehingga proses ini sendiri dapat dilihat sebagai proses komunikasi data yang hanya melakukan pertukaran paket-paket data saja.

NTP bekerja dengan menggunakan algoritma Marzullo dengan menggunakan referensi skala waktu UTC. Sebuah jaringan NTP biasanya mendapatkan perhitungan waktunya dari sumber waktu yang tepercaya seperti misalnya radio clock atau atomic clock yang terhubung dengan sebuah time server. Kemudian jaringan NTP ini akan mendistribusikan perhitungan waktu akurat ini ke dalam jaringan lain

Sumber Wikipedia

Tutorial ESP8266 NodeMCU Jam Digital dan JWS LCD TFT 1.8
Tutorial ESP8266 NodeMCU Jam Digital dan JWS LCD TFT 1.8

Tutorial ESP8266 Mengambil Jam dengan NTP Server

Sebelum masuk ke tutorialnya alangkah lebih baiknya kalian menyiapkan alat alat yang dibutuhkan untuk membuat projek jam digital ntp server dengan esp8266 nodemcu atau wemos d1 mini

berikut merupakan daftar bahan yang diperlukan untuk mengikuti tutorial ini.

  1. NodeMCU atau Wemos D1 Mini ESP8266
  2. LCD TFT 1.8
  3. Kabel Jumper
  4. Arduino IDE
  5. Kabel USB

Download library WiFiUdp.h dan NTPClient.h

Library ini berfungsi untuk dapat membuat esp8266 terhubung ke server waktu. Sebernya tidak perlu anda download jika sudah menginstall board ESP8266

Karena sudah tersedia satu paket library ESP8266WIFI.h dengan WiFiUdp.h sedangkan NTPClient harus mendownload nya

Karena didalam library NTPClient tidak ada fungsi untuk memanggil nilai tanggal tahun dan bulan, maka edit file library nya menjadi seperti ini

NTPClient.h

#pragma once

#include "Arduino.h"

#include <Udp.h>

#define SEVENZYYEARS 2208988800UL
#define NTP_PACKET_SIZE 48
#define NTP_DEFAULT_LOCAL_PORT 1337

class NTPClient {
  private:
    UDP*          _udp;
    bool          _udpSetup       = false;

    const char*   _poolServerName = "pool.ntp.org"; // Default time server
    int           _port           = NTP_DEFAULT_LOCAL_PORT;
    long          _timeOffset     = 0;

    unsigned long _updateInterval = 60000;  // In ms

    unsigned long _currentEpoc    = 0;      // In s
    unsigned long _lastUpdate     = 0;      // In ms

    byte          _packetBuffer[NTP_PACKET_SIZE];

    void          sendNTPPacket();

  public:
    NTPClient(UDP& udp);
    NTPClient(UDP& udp, long timeOffset);
    NTPClient(UDP& udp, const char* poolServerName);
    NTPClient(UDP& udp, const char* poolServerName, long timeOffset);
    NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval);

    /**
     * Set time server name
     *
     * @param poolServerName
     */
    void setPoolServerName(const char* poolServerName);

    /**
     * Starts the underlying UDP client with the default local port
     */
    void begin();

    /**
     * Starts the underlying UDP client with the specified local port
     */
    void begin(int port);

    /**
     * This should be called in the main loop of your application. By default an update from the NTP Server is only
     * made every 60 seconds. This can be configured in the NTPClient constructor.
     *
     * @return true on success, false on failure
     */
    bool update();

    /**
     * This will force the update from the NTP Server.
     *
     * @return true on success, false on failure
     */
    bool forceUpdate();
    
    int getYear() const;
    int getMonth() const;
    int getDate() const;
    int getDay() const;
    int getHours() const;
    int getMinutes() const;
    int getSeconds() const;

    /**
     * Changes the time offset. Useful for changing timezones dynamically
     */
    void setTimeOffset(int timeOffset);

    /**
     * Set the update interval to another frequency. E.g. useful when the
     * timeOffset should not be set in the constructor
     */
    void setUpdateInterval(unsigned long updateInterval);

    /**
     * @return time formatted like `hh:mm:ss`
     */
    String getFormattedTime() const;

    /**
     * @return time in seconds since Jan. 1, 1970
     */
    unsigned long getEpochTime() const;

    /**
     * Stops the underlying UDP client
     */
    void end();
};

NTPClient.cpp

/**
 * The MIT License (MIT)
 * Copyright (c) 2015 by Fabrice Weinberg
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#include "NTPClient.h"

NTPClient::NTPClient(UDP& udp) {
  this->_udp            = &udp;
}

NTPClient::NTPClient(UDP& udp, long timeOffset) {
  this->_udp            = &udp;
  this->_timeOffset     = timeOffset;
}

NTPClient::NTPClient(UDP& udp, const char* poolServerName) {
  this->_udp            = &udp;
  this->_poolServerName = poolServerName;
}

NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset) {
  this->_udp            = &udp;
  this->_timeOffset     = timeOffset;
  this->_poolServerName = poolServerName;
}

NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval) {
  this->_udp            = &udp;
  this->_timeOffset     = timeOffset;
  this->_poolServerName = poolServerName;
  this->_updateInterval = updateInterval;
}

void NTPClient::begin() {
  this->begin(NTP_DEFAULT_LOCAL_PORT);
}

void NTPClient::begin(int port) {
  this->_port = port;

  this->_udp->begin(this->_port);

  this->_udpSetup = true;
}

bool NTPClient::forceUpdate() {
  #ifdef DEBUG_NTPClient
    Serial.println("Update from NTP Server");
  #endif

  this->sendNTPPacket();

  // Wait till data is there or timeout...
  byte timeout = 0;
  int cb = 0;
  do {
    delay ( 10 );
    cb = this->_udp->parsePacket();
    if (timeout > 100) return false; // timeout after 1000 ms
    timeout++;
  } while (cb == 0);

  this->_lastUpdate = millis() - (10 * (timeout + 1)); // Account for delay in reading the time

  this->_udp->read(this->_packetBuffer, NTP_PACKET_SIZE);

  unsigned long highWord = word(this->_packetBuffer[40], this->_packetBuffer[41]);
  unsigned long lowWord = word(this->_packetBuffer[42], this->_packetBuffer[43]);
  // combine the four bytes (two words) into a long integer
  // this is NTP time (seconds since Jan 1 1900):
  unsigned long secsSince1900 = highWord << 16 | lowWord;

  this->_currentEpoc = secsSince1900 - SEVENZYYEARS;

  return true;
}

bool NTPClient::update() {
  if ((millis() - this->_lastUpdate >= this->_updateInterval)     // Update after _updateInterval
    || this->_lastUpdate == 0) {                                // Update if there was no update yet.
    if (!this->_udpSetup) this->begin();                         // setup the UDP client if needed
    return this->forceUpdate();
  }
  return true;
}

unsigned long NTPClient::getEpochTime() const {
  return this->_timeOffset + // User offset
         this->_currentEpoc + // Epoc returned by the NTP server
         ((millis() - this->_lastUpdate) / 1000); // Time since last update
}
int NTPClient::getYear() const {
  time_t rawtime = this->getEpochTime();
  struct tm * ti;
  ti = localtime (&rawtime);
  int year = ti->tm_year + 1900;
  
  return year;
}

int NTPClient::getMonth() const {
  time_t rawtime = this->getEpochTime();
  struct tm * ti;
  ti = localtime (&rawtime);
  int month = (ti->tm_mon + 1) < 10 ? 0 + (ti->tm_mon + 1) : (ti->tm_mon + 1);
  
  return month;
}

int NTPClient::getDate() const {
  time_t rawtime = this->getEpochTime();
  struct tm * ti;
  ti = localtime (&rawtime);
  int month = (ti->tm_mday) < 10 ? 0 + (ti->tm_mday) : (ti->tm_mday);
  
  return month;
}

int NTPClient::getDay() const {
  return (((this->getEpochTime()  / 86400L) + 4 ) % 7); //0 is Sunday
}
int NTPClient::getHours() const {
  return ((this->getEpochTime()  % 86400L) / 3600);
}
int NTPClient::getMinutes() const {
  return ((this->getEpochTime() % 3600) / 60);
}
int NTPClient::getSeconds() const {
  return (this->getEpochTime() % 60);
}

String NTPClient::getFormattedTime() const {
  unsigned long rawTime = this->getEpochTime();
  unsigned long hours = (rawTime % 86400L) / 3600;
  String hoursStr = hours < 10 ? "0" + String(hours) : String(hours);

  unsigned long minutes = (rawTime % 3600) / 60;
  String minuteStr = minutes < 10 ? "0" + String(minutes) : String(minutes);

  unsigned long seconds = rawTime % 60;
  String secondStr = seconds < 10 ? "0" + String(seconds) : String(seconds);

  return hoursStr + ":" + minuteStr + ":" + secondStr;
}

void NTPClient::end() {
  this->_udp->stop();

  this->_udpSetup = false;
}

void NTPClient::setTimeOffset(int timeOffset) {
  this->_timeOffset     = timeOffset;
}

void NTPClient::setUpdateInterval(unsigned long updateInterval) {
  this->_updateInterval = updateInterval;
}

void NTPClient::setPoolServerName(const char* poolServerName) {
    this->_poolServerName = poolServerName;
}

void NTPClient::sendNTPPacket() {
  // set all bytes in the buffer to 0
  memset(this->_packetBuffer, 0, NTP_PACKET_SIZE);
  // Initialize values needed to form NTP request
  // (see URL above for details on the packets)
  this->_packetBuffer[0] = 0b11100011;   // LI, Version, Mode
  this->_packetBuffer[1] = 0;     // Stratum, or type of clock
  this->_packetBuffer[2] = 6;     // Polling Interval
  this->_packetBuffer[3] = 0xEC;  // Peer Clock Precision
  // 8 bytes of zero for Root Delay & Root Dispersion
  this->_packetBuffer[12]  = 49;
  this->_packetBuffer[13]  = 0x4E;
  this->_packetBuffer[14]  = 49;
  this->_packetBuffer[15]  = 52;

  // all NTP fields have been given values, now
  // you can send a packet requesting a timestamp:
  this->_udp->beginPacket(this->_poolServerName, 123); //NTP requests are to port 123
  this->_udp->write(this->_packetBuffer, NTP_PACKET_SIZE);
  this->_udp->endPacket();
}

Jika kesulitan mencari tempat file librarynya bisa langsung buka folder document/arduino/libraries

Contoh Program Mengambil Waktu Lokal Indonesia WIB

Berikut saya berikan contoh kode pengambilan waktu atau jam dari NTP server menggunakan NodeMCU ESP8266 atau Wemos D1 Mini

#include <NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

#define tahun timeClient.getYear()
#define bulan timeClient.getMonth()
#define tanggal timeClient.getDate()
#define hari daysOfTheWeek[timeClient.getDay()]
#define jam timeClient.getHours()
#define menit timeClient.getMinutes()
#define detik timeClient.getSeconds()


const char *ssid     = "anakkendali";
const char *password = "bayardikitlimangewu";

const long utcOffsetInSeconds = 25200;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

// Define NTP Client to get time
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "asia.pool.ntp.org", utcOffsetInSeconds);


void setup() {
  Serial.begin(9600);

  WiFi.begin(ssid, password);

  while ( WiFi.status() != WL_CONNECTED ) {
    delay ( 500 );
    Serial.print ( "." );
  }

  timeClient.begin();
}

void loop() {
  timeClient.update();
  Serial.print(hari);
  Serial.print(", ");
  Serial.print(tanggal);
  Serial.print("/");
  Serial.print(bulan);
  Serial.print("/");
  Serial.print(tahun);
  Serial.print("\t");
  Serial.print(jam);
  Serial.print(":");
  Serial.print(menit);
  Serial.print(":");
  Serial.println(detik);
  delay(1000);
}
Contoh Program Mengambil Waktu Lokal Indonesia WIB NTP Server Internet Tutorial ESP8266 NodeMCU Jam Digital dan JWS LCD TFT 1.8
Contoh Program Mengambil Waktu Lokal Indonesia WIB NTP Server Internet

Tutorial Jam Digital dan Jadwal Waktu Sholat Internet LCD TFT 1.8

Sebelum masuk ke langkah tutorial membuat jam digital dengan LCD TFT 1.8 sebaiknya baca terlebih dahulu Tutorial ESP8266 NodeMCU Mengakses LCD TFT 1.8 ST7735

Untuk skmatik dan rangkaian LCD TFT 1.8 dengan NodeMCU sama persis hanya programnya saja yang berubah, dan ikuti program dibawah ini

ESP8266-LCD-TFT-1.8-NTP-Server Tutorial ESP8266 NodeMCU Jam Digital dan JWS LCD TFT 1.8
ESP8266 LCD TFT 1.8
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#include <NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <ArduinoJson.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecure.h>

#define tahun timeClient.getYear()
#define bulan timeClient.getMonth()
#define tanggal timeClient.getDate()
#define hari daysOfTheWeek[timeClient.getDay()]
#define jam timeClient.getHours()
#define menit timeClient.getMinutes()
#define detik timeClient.getSeconds()
#define TFT_CS     D6
#define TFT_RST    D1
#define TFT_DC     D2

#define TFT_SCLK D5   // set these to be whatever pins you like!
#define TFT_MOSI D7   // set these to be whatever pins you like!

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define GREY    0x8410
#define ORANGE  0xE880

char waktujam[5];
char waktutanggal[10];
char jws[10];

const char *ssid     = "anakkendali";
const char *password = "bayardikitlimangewu";

const uint8_t fingerprint[] PROGMEM = "0xe1, 0xd7, 0x8c, 0x24, 0xe8, 0x08, 0xc8, 0xcc, 0x57, 0xff, 0xf7, 0x1d, 0x13, 0xc6, 0xd5, 0x47, 0x17, 0xaa, 0xfd, 0xa8";

const long utcOffsetInSeconds = 25200;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

// Define NTP Client to get time
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "asia.pool.ntp.org", utcOffsetInSeconds);
String imsak, subuh, dhuha, dzuhur, ashar, maghrib, isya;

void setup(void) {
  Serial.begin(9600);
  WiFi.begin(ssid, password);

  while ( WiFi.status() != WL_CONNECTED ) {
    delay (500);
    Serial.print ( "." );
  }

  timeClient.begin();
  // Use this initializer if you're using a 1.8" TFT
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab

  Serial.println("Initialized");

  timeClient.update();
  delay(2000);

  tft.fillScreen(BLACK);
  tft.setRotation(1);
  req_api();
  sprintf (waktujam, "%02d:%02d", jam, menit);
  drawtext(40, 30, 3, waktujam, RED);
  drawtext(10, 100, 1, "Imsak", CYAN);
  drawtext(45, 100, 1, "Subuh", CYAN);
  drawtext(80, 100, 1, "Duhur", CYAN);
  drawtext(115, 100, 1, "Ashar", CYAN);
  drawtext(50, 65, 1, "Magrib", CYAN);
  drawtext(95, 65, 1, "Isya", CYAN);

}
unsigned long oldtime;

void loop() {
  timeClient.update();

  if (millis() - oldtime >= 60000) {
    tft.fillScreen(BLACK);
    req_api();
    oldtime = millis();
    sprintf (waktujam, "%02d:%02d", jam, menit);
    drawtext(40, 30, 3, waktujam, RED);
    drawtext(10, 100, 1, "Imsak", CYAN);
    drawtext(45, 100, 1, "Subuh", CYAN);
    drawtext(80, 100, 1, "Duhur", CYAN);
    drawtext(115, 100, 1, "Ashar", CYAN);
    drawtext(50, 65, 1, "Magrib", CYAN);
    drawtext(95, 65, 1, "Isya", CYAN);
  }
}

void drawtext(int x, int y, int sz, char *text, uint16_t color) {
  tft.setTextSize(sz);
  tft.setCursor(x, y);
  tft.setTextColor(color);
  tft.setTextWrap(true);
  tft.print(text);
}

void req_api() {
  sprintf (waktutanggal, "%02d-%02d-%02d", tahun, bulan, tanggal);
  WiFiClientSecure client;
  client.setInsecure(); //the magic line, use with caution
  client.connect("api.banghasan.com", 80);

  //  client -> setFingerprint(fingerprint);

  HTTPClient https;
  String url = "https://api.banghasan.com/sholat/format/json/jadwal/kota/687/tanggal/";
  url += waktutanggal;

  Serial.println(url);
  https.begin(client, url);
  int httpCode = https.GET();
  String payload = https.getString();
  Serial.println(payload);

  DynamicJsonDocument doc (1024);
  DeserializationError error = deserializeJson(doc, payload);
  JsonObject results = doc["jadwal"]["data"];
  sprintf (waktujam, "%02d:%02d", jam, menit);
  String ashar = results["ashar"];
  String dhuha = results["dhuha"];
  String dzuhur = results["dzuhur"];
  String imsak = results["imsak"];
  String maghrib = results["maghrib"];
  String isya = results["isya"];
  String subuh = results["subuh"];

  Serial.print("Ashar = ");
  Serial.println(ashar);
  Serial.print("Dhuha = ");
  Serial.println(dhuha);
  Serial.print("Dzuhur = ");
  Serial.println(dzuhur);
  Serial.print("Imsak = ");
  Serial.println(imsak);
  Serial.print("Maghrib = ");
  Serial.println(maghrib);
  Serial.print("Isya = ");
  Serial.println(isya);
  Serial.print("Subuh = ");
  Serial.println(subuh);
  Serial.println();

  imsak.toCharArray(jws, 10);
  drawtext(10, 110, 1, jws, RED);
  subuh.toCharArray(jws, 10);
  drawtext(45, 110, 1, jws, RED);
  dzuhur.toCharArray(jws, 10);
  drawtext(80, 110, 1, jws, RED);
  ashar.toCharArray(jws, 10);
  drawtext(115, 110, 1, jws, RED);
  maghrib.toCharArray(jws, 10);
  drawtext(50, 75, 1, jws, RED);
  isya.toCharArray(jws, 10);
  drawtext(95, 75, 1, jws, RED);

  if (error) {
    Serial.print(F("deserializeJson() failed: "));
    Serial.println(error.c_str());
    return;
  }

}

Berikut merupakan hasil dari program diatas

Tutorial ESP8266 NodeMCU Jam Digital dan JWS LCD TFT 1.8

Api yang saya gunakan dari https://fathimah.docs.apiary.io/# silahkan kalian gunakan gratis dan jangan salah gunakan, karena yang punya api tersebut sudah sangat baik menyediakan untuk kita secara gratis.

Programnya mungkin tidak sesuai dengan harapan anda, jika menginginkan program yang sesuai permintaan anda silahkan isi form di https://www.anakkendali.com/jasa-custom-coding-arduino-iot-dan-cetak-pcb/

Terimakaish sudah berkunjung untuk membaca tutorial membuat jam digital dan jadwal waktu sholat dengan mengambil data dari internet.

NTP Server dan juga API jadwal waktu sholat versi anakkendali.com menggunakan nodemcu esp8266 dan juga LCD TFT 1.8.

Keyword

  1. ESP8266 NTP Server,
  2. NodeMCU NTP Server,
  3. Wemos D1 Mini ESP8266 NTP Server,
  4. LCD TFT 1.8 ESP8266,
  5. NodeMCU TFT 1.8 NTP Server,
  6. JWS ESP8266,
  7. Jadwal Waktu Sholat ESP8266 LCD TFT 1.8,

6 Replies to “Tutorial ESP8266 NodeMCU Jam Digital dan JWS LCD TFT 1.8”

  1. tommy

    C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino: In function ‘void req_api()’:

    sketch_apr02b:99:10: error: ‘class WiFiClientSecure’ has no member named ‘setInsecure’

    client.setInsecure(); //the magic line, use with caution

    ^

    sketch_apr02b:106:26: error: no matching function for call to ‘HTTPClient::begin(WiFiClientSecure&, String&)’

    https.begin(client, url);

    ^

    C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino:106:26: note: candidates are:

    In file included from C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino:9:0:

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:136:10: note: bool HTTPClient::begin(String)

    bool begin(String url);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:136:10: note: candidate expects 1 argument, 2 provided

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:137:10: note: bool HTTPClient::begin(String, String)

    bool begin(String url, String httpsFingerprint);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:137:10: note: no known conversion for argument 1 from ‘WiFiClientSecure’ to ‘String’

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:138:10: note: bool HTTPClient::begin(String, uint16_t, String)

    bool begin(String host, uint16_t port, String uri = “/”);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:138:10: note: no known conversion for argument 1 from ‘WiFiClientSecure’ to ‘String’

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:139:10: note: bool HTTPClient::begin(String, uint16_t, String, String)

    bool begin(String host, uint16_t port, String uri, String httpsFingerprint);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:139:10: note: candidate expects 4 arguments, 2 provided

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:141:10: note: bool HTTPClient::begin(String, uint16_t, String, bool, String)

    bool begin(String host, uint16_t port, String uri, bool https, String httpsFingerprint) __attribute__ ((deprecated));

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:141:10: note: candidate expects 5 arguments, 2 provided

    sketch_apr02b:110:3: error: ‘DynamicJsonDocument’ was not declared in this scope

    DynamicJsonDocument doc (1024);

    ^

    sketch_apr02b:110:23: error: expected ‘;’ before ‘doc’

    DynamicJsonDocument doc (1024);

    ^

    sketch_apr02b:111:3: error: ‘DeserializationError’ was not declared in this scope

    DeserializationError error = deserializeJson(doc, payload);

    ^

    sketch_apr02b:111:24: error: expected ‘;’ before ‘error’

    DeserializationError error = deserializeJson(doc, payload);

    ^

    sketch_apr02b:112:24: error: ‘doc’ was not declared in this scope

    JsonObject results = doc[“jadwal”][“data”];

    ^

    sketch_apr02b:148:7: error: ‘error’ was not declared in this scope

    if (error) {

    ^

    exit status 1
    ‘class WiFiClientSecure’ has no member named ‘setInsecure’

    Reply
    1. tommy

      C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino: In function ‘void req_api()’:

      sketch_apr02b:99:10: error: ‘class WiFiClientSecure’ has no member named ‘setInsecure’

      client.setInsecure(); //the magic line, use with caution

      ^

      sketch_apr02b:106:26: error: no matching function for call to ‘HTTPClient::begin(WiFiClientSecure&, String&)’

      https.begin(client, url);

      ^

      C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino:106:26: note: candidates are:

      In file included from C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino:9:0:

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:136:10: note: bool HTTPClient::begin(String)

      bool begin(String url);

      ^

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:136:10: note: candidate expects 1 argument, 2 provided

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:137:10: note: bool HTTPClient::begin(String, String)

      bool begin(String url, String httpsFingerprint);

      ^

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:137:10: note: no known conversion for argument 1 from ‘WiFiClientSecure’ to ‘String’

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:138:10: note: bool HTTPClient::begin(String, uint16_t, String)

      bool begin(String host, uint16_t port, String uri = “/”);

      ^

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:138:10: note: no known conversion for argument 1 from ‘WiFiClientSecure’ to ‘String’

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:139:10: note: bool HTTPClient::begin(String, uint16_t, String, String)

      bool begin(String host, uint16_t port, String uri, String httpsFingerprint);

      ^

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:139:10: note: candidate expects 4 arguments, 2 provided

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:141:10: note: bool HTTPClient::begin(String, uint16_t, String, bool, String)

      bool begin(String host, uint16_t port, String uri, bool https, String httpsFingerprint) __attribute__ ((deprecated));

      ^

      C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:141:10: note: candidate expects 5 arguments, 2 provided

      sketch_apr02b:110:3: error: ‘DynamicJsonDocument’ was not declared in this scope

      DynamicJsonDocument doc (1024);

      ^

      sketch_apr02b:110:23: error: expected ‘;’ before ‘doc’

      DynamicJsonDocument doc (1024);

      ^

      sketch_apr02b:111:3: error: ‘DeserializationError’ was not declared in this scope

      DeserializationError error = deserializeJson(doc, payload);

      ^

      sketch_apr02b:111:24: error: expected ‘;’ before ‘error’

      DeserializationError error = deserializeJson(doc, payload);

      ^

      sketch_apr02b:112:24: error: ‘doc’ was not declared in this scope

      JsonObject results = doc[“jadwal”][“data”];

      ^

      sketch_apr02b:148:7: error: ‘error’ was not declared in this scope

      if (error) {

      ^

      exit status 1
      ‘class WiFiClientSecure’ has no member named ‘setInsecure’

      mohon di bantu mas ???
      terima kasih

      Reply
  2. tommy

    C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino: In function ‘void req_api()’:

    sketch_apr02b:99:10: error: ‘class WiFiClientSecure’ has no member named ‘setInsecure’

    client.setInsecure(); //the magic line, use with caution

    ^

    sketch_apr02b:106:26: error: no matching function for call to ‘HTTPClient::begin(WiFiClientSecure&, String&)’

    https.begin(client, url);

    ^

    C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino:106:26: note: candidates are:

    In file included from C:\Users\PC\AppData\Local\Temp\arduino_modified_sketch_448493\sketch_apr02b.ino:9:0:

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:136:10: note: bool HTTPClient::begin(String)

    bool begin(String url);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:136:10: note: candidate expects 1 argument, 2 provided

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:137:10: note: bool HTTPClient::begin(String, String)

    bool begin(String url, String httpsFingerprint);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:137:10: note: no known conversion for argument 1 from ‘WiFiClientSecure’ to ‘String’

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:138:10: note: bool HTTPClient::begin(String, uint16_t, String)

    bool begin(String host, uint16_t port, String uri = “/”);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:138:10: note: no known conversion for argument 1 from ‘WiFiClientSecure’ to ‘String’

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:139:10: note: bool HTTPClient::begin(String, uint16_t, String, String)

    bool begin(String host, uint16_t port, String uri, String httpsFingerprint);

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:139:10: note: candidate expects 4 arguments, 2 provided

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:141:10: note: bool HTTPClient::begin(String, uint16_t, String, bool, String)

    bool begin(String host, uint16_t port, String uri, bool https, String httpsFingerprint) __attribute__ ((deprecated));

    ^

    C:\Users\PC\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:141:10: note: candidate expects 5 arguments, 2 provided

    sketch_apr02b:110:3: error: ‘DynamicJsonDocument’ was not declared in this scope

    DynamicJsonDocument doc (1024);

    ^

    sketch_apr02b:110:23: error: expected ‘;’ before ‘doc’

    DynamicJsonDocument doc (1024);

    ^

    sketch_apr02b:111:3: error: ‘DeserializationError’ was not declared in this scope

    DeserializationError error = deserializeJson(doc, payload);

    ^

    sketch_apr02b:111:24: error: expected ‘;’ before ‘error’

    DeserializationError error = deserializeJson(doc, payload);

    ^

    sketch_apr02b:112:24: error: ‘doc’ was not declared in this scope

    JsonObject results = doc[“jadwal”][“data”];

    ^

    sketch_apr02b:148:7: error: ‘error’ was not declared in this scope

    if (error) {

    ^

    exit status 1
    ‘class WiFiClientSecure’ has no member named ‘setInsecure’

    mohon di bantu mas ????

    Reply
  3. Kunto H. Baiquni

    Syukur alhamdulillah…

    Akhirnya jalan juga, setelah dioprek bbrp menit…

    Terima kasih, sangat berguna, karena waktunya selalu sinkron dengan NTP server…

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *