HELP NEEDED) wifi microcontroller to servo motor

Hello everyone!

I’m trying to follow this instructable to make an IoT scent dropper:

I have a circuit ready and was modifying the existing code to upload the microcontroller (I have NodeMCU).
But I keep getting this massive amount of errors when uploading it.
And I can’t figure out why.

Can someone kindly look at the error message (attached) and tell me how to fix this?

Thank you so so much!

Best,

Post the full code and the complete error messages AS TEXT like it says in "How to use this forum- please read" at the top of every forum. No-one wants to download huge pictures of text.

Steve

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :)

How are you powering this project. Doesn't seem wise through the USB connector (with a tiny DO-214 diode in series). The setup could draw 1500mA (servo stall) + 480mA (LEDs all on) + 100mA (nodeMCU) = >2Amp. Four times the max rating of that diode. Prepare for the magic smoke if the servo gets stuck. Leo..

Hi, Please read post #2 and the how to use the forum with respect to "code tags".

Thanks... Tom... :)

Hello everyone!

I’m trying to follow this instructable to make an IoT scent dropper:

I have a circuit ready and was modifying the existing code to upload the microcontroller.
(Attached please find an image of the circuit)

I keep getting errors when uploading, and I can’t figure out why.

Can someone kindly look at the error message (below) and tell me how to fix this problem?

Thank you so so much!
Best,

/************************ Adafruit IO Configuration *******************************/

// visit io.adafruit.com if you need to create an account,
// or if you need your Adafruit IO key.
#define IO_USERNAME    "ojy377"
#define IO_KEY         "4f24ab2148424bc99e76b1d6f212e537"

/******************************* WIFI Configuration **************************************/

#define WIFI_SSID       "Sung5G"
#define WIFI_PASS       "Lu101790!"

#include "AdafruitIO_WiFi.h"
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);

/************************ Main Program Starts Here *******************************/
#include <ESP8266WiFi.h>
#include <AdafruitIO.h>
#include <Adafruit_MQTT.h>
#include <ArduinoHttpClient.h>
#include "Servo.h"
#include <Adafruit_NeoPixel.h>

#define SERV1 12 // Pin connected to the Servomotor
Servo s1;

#define BUTTON_PIN 14 // Pin connected to the pushbutton

#define PIXELS_PIN 15   // Pin connected to the NeoPixel data input
#define NUM_LEDS   16   // Number of NeoPixels
#define BRIGHTNESS 30
#define PIXEL_TYPE NEO_GRB + NEO_KHZ800   // Type of the NeoPixels (see strandtest example).

Adafruit_NeoPixel ring = Adafruit_NeoPixel(NUM_LEDS, PIXELS_PIN, PIXEL_TYPE);// + NEO_KHZ800);

AdafruitIO_Feed *command = io.feed("iot-air-freshener-command"); // set up the 'command' feed

void setup() {

  ring.setBrightness(BRIGHTNESS);
  ring.begin();
  ring.show(); // Initialize all pixels to 'off'

  // start the serial connection
  Serial.begin(115200);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();
  
  // set up a message handler for the 'command' feed.
  // the handleMessage function (defined below)
  // will be called whenever a message is
  // received from adafruit io.
  command->onMessage(handleMessage);  

  // wait for a connection
  int i = NUM_LEDS - 1;
  int color = 255;
  // animate LEDs while waiting for connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    ring.setPixelColor(i, 0, 0, color);
    ring.show();
    i = i - 1;
    if (i < 0) {
      if (color == 255) {
        color = 0;
      }
      else {
        color = 255;
      }
      i = NUM_LEDS - 1;
    }
    delay(50);
  }
  lightPixels(ring.Color(0, 0, 0, 0)); // reset all pixels to off when connected

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

  // move servomotor to neutral position
  s1.attach(SERV1);
  s1.write(90);
  delay(400);
  s1.detach();

  // set button pin as an input
  pinMode(BUTTON_PIN, INPUT_PULLUP);

}

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.
  io.run();

  if(digitalRead(BUTTON_PIN) == LOW) {
    command->save("location");
  }

}

// this function is called whenever a message
// is received from Adafruit IO. it was attached to
// the feed in the setup() function above.
void handleMessage(AdafruitIO_Data *data) {
  
  lightPixels(ring.Color(0, 0, 0, 0)); // reset all pixels to off when new info is received

  String commandStr = data->toString(); // store the incoming commands in a string
  
  Serial.print("received <- ");
  Serial.println(commandStr);
  
  // These if statements compare the incoming weather variable to the stored conditions, and control the NeoPixels accordingly.
  
  // if virtual push button was pressed
  if (commandStr.equalsIgnoreCase("button")){
    Serial.println("Virtual push button");
    rotatingPixels(ring.Color(255, 255, 0, 0)); // display animation
    lightPixels(ring.Color(255, 255, 0, 0)); // display animation
    launch(1);
    lightPixels(ring.Color(0, 0, 0, 0)); // reset all pixels to off when new info is received
  }
  
  // if it's time
  if (commandStr.equalsIgnoreCase("timer")){
    Serial.println("it's time");
    rotatingPixels(ring.Color(0, 0, 255, 0)); // display animation
    lightPixels(ring.Color(0, 0, 255, 0)); // display animation
    launch(2);
    lightPixels(ring.Color(0, 0, 0, 0)); // reset all pixels to off when new info is received
  }
  
  // if location reached
  if (commandStr.equalsIgnoreCase("location")){
    Serial.println("welcome home!");
    rotatingPixels(ring.Color(0, 255, 0, 0)); // display animation
    lightPixels(ring.Color(0, 255, 0, 0)); // display animation
    launch(2);
    lightPixels(ring.Color(0, 0, 0, 0)); // reset all pixels to off when new info is received
  }
  
  // if you've got mail
  if (commandStr.equalsIgnoreCase("mail")){
    Serial.println("you've got mail!");
    rotatingPixels(ring.Color(255, 0, 0, 0)); // display animation
    lightPixels(ring.Color(255, 0, 0, 0)); // display animation
    launch(1);
    lightPixels(ring.Color(0, 0, 0, 0)); // reset all pixels to off when new info is received
   }
  } 


// Function to set all the NeoPixels to the specified color.
void lightPixels(uint32_t color) {
  for (int i=0; i<NUM_LEDS; ++i) {
    ring.setPixelColor(i, color);
  }
  ring.show();
}


//Funcion NeoPixels full rotation
void rotatingPixels(uint32_t color) {
  for (int j = 0; j < 3; j++) {
    for (int i=NUM_LEDS-1; i>=0; i--) {
      ring.setPixelColor(i, color);
      ring.show();
      delay(50);
      ring.setPixelColor(i, 0, 0, 0);//ring.Color(0, 0, 0, 255));
      ring.show();
    }
  }
}

//Actuates the servomotor
void launch (int number) {
  s1.attach(SERV1);
  for (int i = 0; i < number; i++) {    
    s1.write(175);
    delay(1000);
    s1.write(90);
    delay(1000);
  }
  s1.detach();
}

I keep getting errors

And they are. . ?

This is the error message from the Arduino

Arduino: 1.8.7 (Mac OS X), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled, ck, 26 MHz, 40MHz, DOUT (compatible), 512K (no SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

/Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/wifi/AdafruitIO_ESP8266.cpp: In constructor 'AdafruitIO_ESP8266::AdafruitIO_ESP8266(const char*, const char*, const char*, const char*)':
/Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/wifi/AdafruitIO_ESP8266.cpp:22:53: error: cannot allocate an object of abstract type 'HttpClient'
  _http = new HttpClient(*_client, _host, _http_port);
                                                    ^
In file included from /Users/Fall2015OH/Documents/Arduino/libraries/ArduinoHttpClient-master/src/ArduinoHttpClient.h:8:0,
                from /Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/AdafruitIO.h:23,
                from /Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/wifi/AdafruitIO_ESP8266.h:18,
                from /Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/wifi/AdafruitIO_ESP8266.cpp:14:
/Users/Fall2015OH/Documents/Arduino/libraries/ArduinoHttpClient-master/src/HttpClient.h:41:7: note:   because the following virtual functions are pure within 'HttpClient':
class HttpClient : public Client
      ^
In file included from /Users/Fall2015OH/Documents/Arduino/libraries/ArduinoHttpClient-master/src/HttpClient.h:10:0,
                from /Users/Fall2015OH/Documents/Arduino/libraries/ArduinoHttpClient-master/src/ArduinoHttpClient.h:8,
                from /Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/AdafruitIO.h:23,
                from /Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/wifi/AdafruitIO_ESP8266.h:18,
                from /Users/Fall2015OH/Documents/Arduino/libraries/Adafruit_IO_Arduino-master/src/wifi/AdafruitIO_ESP8266.cpp:14:
/Users/Fall2015OH/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.0-beta3/cores/esp8266/Client.h:29:21: note: virtual int Client::connect(const IPAddress&, uint16_t)
        virtual int connect(CONST IPAddress& ip, uint16_t port) =0;
                    ^
/Users/Fall2015OH/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.0-beta3/cores/esp8266/Client.h:37:22: note: virtual bool Client::flush(unsigned int)
        virtual bool flush(unsigned int maxWaitMs = 0) = 0;
                     ^
/Users/Fall2015OH/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.0-beta3/cores/esp8266/Client.h:38:22: note: virtual bool Client::stop(unsigned int)
        virtual bool stop(unsigned int maxWaitMs = 0) = 0;
                     ^
Multiple libraries were found for "Servo.h"
Used: /Users/Fall2015OH/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.0-beta3/libraries/Servo
Not used: /Applications/Arduino.app/Contents/Java/libraries/Servo
exit status 1
Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

And don’t forget to also include the complete error listing (in </> code tags).

EDIT: and now I see you’ve chosen to start a new thread instead of updating this one. That’s certainly a good way of wasting people’s time!

Steve

I haven't looked into the issue, but at a glance it looks maybe similar to this one: https://github.com/arduino-libraries/Ethernet/issues/88 Which was caused by the ESP developers breaking compatibility with the standard Arduino API.