Problem when AdafruitIO library is used with TimeClient.h
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problem when AdafruitIO library is used with TimeClient.h

by foglie0p on Sun Feb 24, 2019 4:47 am

Hi all,

I worked out that the TimeClient.h library does not work when it is used with the AdafruitIO library and ESP32 board. The fault reported by the IDE is as below.

Any help would be greatly appreciated.

C:\Users\PASCAL\Documents\Arduino\libraries\ESP8266_Weather_Station\src\AerisForecasts.cpp: In member function 'void AerisForecasts::doUpdate(AerisForecastData*, String, uint8_t)':

C:\Users\PASCAL\Documents\Arduino\libraries\ESP8266_Weather_Station\src\AerisForecasts.cpp:47:3: error: 'HTTPClient' was not declared in this scope

HTTPClient http;


C:\Users\PASCAL\Documents\Arduino\libraries\ESP8266_Weather_Station\src\AerisForecasts.cpp:49:3: error: 'http' was not declared in this scope



Code: Select all | TOGGLE FULL SIZE
#include "config.h"
#include <TimeClient.h>
/************************ Example Starts Here *******************************/

// default PWM pins for ESP8266.
// you should change these to match PWM pins on other platforms.
#define RED_PIN   4
#define GREEN_PIN 5
#define BLUE_PIN  2

// set up the 'color' feed
AdafruitIO_Feed *color = io.feed("color");

void setup() {

  // start the serial connection

  // wait for serial monitor to open
  while(! Serial);

  #if defined(ARDUINO_ARCH_ESP32) // ESP32 pinMode
    // assign rgb pins to channels
    ledcAttachPin(RED_PIN, 1);
    ledcAttachPin(GREEN_PIN, 2);
    ledcAttachPin(BLUE_PIN, 3);
    // init. channels
    ledcSetup(1, 12000, 8);
    ledcSetup(2, 12000, 8);
    ledcSetup(3, 12000, 8);
    pinMode(RED_PIN, OUTPUT);
    pinMode(GREEN_PIN, OUTPUT);
    pinMode(BLUE_PIN, OUTPUT);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");

  // set up a message handler for the 'color' feed.
  // the handleMessage function (defined below)
  // will be called whenever a message is
  // received from adafruit io.

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {

  // we are connected

  // set analogWrite range for ESP8266
  #ifdef ESP8266


void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.


// this function is called whenever a 'color' message
// is received from Adafruit IO. it was attached to
// the color feed in the setup() function above.
void handleMessage(AdafruitIO_Data *data) {

  // print RGB values and hex value
  Serial.print("  - R: ");
  Serial.print("  - G: ");
  Serial.print("  - B: ");
  Serial.print("  - HEX: ");

  // invert RGB values for common anode LEDs
  #if defined(ARDUINO_ARCH_ESP32) // ESP32 analogWrite
    ledcWrite(1, 255 - data->toRed());
    ledcWrite(2, 255 - data->toGreen());
    ledcWrite(3, 255 - data->toBlue());
    analogWrite(RED_PIN, 255 - data->toRed());
    analogWrite(GREEN_PIN, 255 - data->toGreen());
    analogWrite(BLUE_PIN, 255 - data->toBlue());

Posts: 4
Joined: Thu Dec 08, 2011 1:46 am

Re: Problem when AdafruitIO library is used with TimeClient.

by brubell on Mon Feb 25, 2019 2:26 pm

It looks like it's having an issue with HTTPClient, not TimeClient?

Can you include the source, or a link to TimeClient.h?

Posts: 282
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.