Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error: AnalogWrite.h: No such file or directory #24

Open
sjhitchner opened this issue Dec 14, 2023 · 2 comments
Open

Compilation error: AnalogWrite.h: No such file or directory #24

sjhitchner opened this issue Dec 14, 2023 · 2 comments

Comments

@sjhitchner
Copy link

Not sure this project is still supported. I discovered ConfigurableFirmata from Gobots.io.

I attempted to use the Firmata Builder today with the following configuration:

  • ESP8266 device
  • WIFI with WPA
  • TCP Client
  • DigitalInputFirmata
  • DigitalOutputFirmata
  • AnalogInputFirmata
  • AnalogOutputFirmata

I have installed version 3.2.0 of the ConfigurableFirmata library.

Here is the generated Sketch:

/*
 * firmata_simple.ino generated by FirmataBuilder
 * Wed Dec 13 2023 19:59:07 GMT-0500 (EST)
 */

#include <ConfigurableFirmata.h>

// uncomment to enable debugging over Serial (9600 baud)
//#define SERIAL_DEBUG
#include "utility/firmataDebug.h"

#include <ESP8266WiFi.h>
#include "utility/WiFiClientStream.h"
#include "utility/WiFiServerStream.h"
#include "secrets.h"

#define WIFI_MAX_CONN_ATTEMPTS 20

#if defined(ESP8266) && defined(SERIAL_DEBUG)
#define IS_IGNORE_PIN(p)  ((p) == 1)
#endif

// IP address of remote server
#define REMOTE_SERVER_IP 10, 0, 0, 53

#define NETWORK_PORT 3030

char ssid[] = SECRET_SSID;
char wpa_passphrase[] = SECRET_PASS;

WiFiClientStream stream(IPAddress(REMOTE_SERVER_IP), NETWORK_PORT);

int connectionAttempts = 0;
bool streamConnected = false;

#include <DigitalInputFirmata.h>
DigitalInputFirmata digitalInput;

#include <DigitalOutputFirmata.h>
DigitalOutputFirmata digitalOutput;

#include <AnalogInputFirmata.h>
AnalogInputFirmata analogInput;

#include <AnalogOutputFirmata.h>
AnalogOutputFirmata analogOutput;

#include <Wire.h>
#include <I2CFirmata.h>
I2CFirmata i2c;

#include <FirmataExt.h>
FirmataExt firmataExt;

#include <AnalogWrite.h>

#include <FirmataReporting.h>
FirmataReporting reporting;

void systemResetCallback()
{
  for (byte i = 0; i < TOTAL_PINS; i++) {
    if (IS_PIN_ANALOG(i)) {
      Firmata.setPinMode(i, ANALOG);
    } else if (IS_PIN_DIGITAL(i)) {
      Firmata.setPinMode(i, OUTPUT);
    }
  }
  firmataExt.reset();
}

void hostConnectionCallback(byte state)
{
  switch (state) {
    case HOST_CONNECTION_CONNECTED:
      DEBUG_PRINTLN("TCP connection established");
      break;
    case HOST_CONNECTION_DISCONNECTED:
      DEBUG_PRINTLN("TCP connection disconnected");
      break;
  }
}

void printWiFiStatus()
{
  if (WiFi.status() != WL_CONNECTED) {
    DEBUG_PRINT("WiFi connection failed. Status value: ");
    DEBUG_PRINTLN(WiFi.status());
  } else {
    DEBUG_PRINTLN("Board configured as a TCP client");
    DEBUG_PRINT("Remote TCP server address: ");
    DEBUG_PRINTLN("10, 0, 0, 53");

    DEBUG_PRINT("SSID: ");
    DEBUG_PRINTLN(WiFi.SSID());

    DEBUG_PRINT("Local IP Address: ");
    IPAddress ip = WiFi.localIP();
    DEBUG_PRINTLN(ip);

    DEBUG_PRINT("Signal strength (RSSI): ");
    long rssi = WiFi.RSSI();
    DEBUG_PRINT(rssi);
    DEBUG_PRINTLN(" dBm");
  }
}

void ignorePins()
{
#ifdef IS_IGNORE_PIN
  // ignore pins used for WiFi controller or Firmata will overwrite their modes
  for (byte i = 0; i < TOTAL_PINS; i++) {
    if (IS_IGNORE_PIN(i)) {
      Firmata.setPinMode(i, PIN_MODE_IGNORE);
    }
  }
#endif
}

void initTransport()
{
  // IMPORTANT: if SERIAL_DEBUG is enabled, program execution will stop
  // at DEBUG_BEGIN until a Serial conneciton is established
  DEBUG_BEGIN(9600);
  DEBUG_PRINTLN("Attempting a WiFi connection using the ESP8266 WiFi library.");

  DEBUG_PRINTLN("IP will be requested from DHCP ...");

  stream.attach(hostConnectionCallback);

  DEBUG_PRINT("Attempting to connect to WPA SSID: ");
  DEBUG_PRINTLN(ssid);
  stream.begin(ssid, wpa_passphrase);

  DEBUG_PRINTLN("WiFi setup done.");

  while(WiFi.status() != WL_CONNECTED && ++connectionAttempts <= WIFI_MAX_CONN_ATTEMPTS) {
    delay(500);
    DEBUG_PRINT(".");
  }

  printWiFiStatus();

  ignorePins();

  Firmata.begin(stream);
}

void initFirmata()
{
  Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);

  firmataExt.addFeature(digitalInput);
  firmataExt.addFeature(digitalOutput);
  firmataExt.addFeature(analogInput);
  firmataExt.addFeature(analogOutput);
  firmataExt.addFeature(i2c);
  firmataExt.addFeature(reporting);

  Firmata.attach(SYSTEM_RESET, systemResetCallback);
}

void setup()
{
  initFirmata();

  initTransport();

  Firmata.parse(SYSTEM_RESET);
}

void loop()
{
  digitalInput.report();

  while(Firmata.available()) {
    Firmata.processInput();
  }

  if (reporting.elapsed()) {
    analogInput.report();
    i2c.report();
  }

  stream.maintain();
}
FQBN: esp8266:esp8266:generic
Using board 'generic' from platform in folder: /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2
Using core 'esp8266' from platform in folder: /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2

/Users/user/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 -I /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/mkbuildoptglobals.py "/Applications/Arduino IDE.app/Contents/Resources/app/lib/backend/resources" 10607 /private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846 /private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core/build.opt /Users/user/src/personal/OmnicronHomelinkHub/firmata/firmata_simple/firmata_simple.ino.globals.h /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/cores/esp8266/CommonHFile.h
default_encoding:       UTF-8
Assume aggressive 'core.a' caching enabled.
Note: optional global include file '/Users/user/src/personal/OmnicronHomelinkHub/firmata/firmata_simple/firmata_simple.ino.globals.h' does not exist.
  Read more at https://arduino-esp8266.readthedocs.io/en/latest/faq/a06-global-build-options.html
Detecting libraries used...
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE -DESP8266 @/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core/build.opt -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/lwip2/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/libc/xtensa-lx106-elf/include -I/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core -c @/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/warnings/none-cppflags -Os -g -free -fipa-pta -Werror=return-type -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10607 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_GENERIC" -DARDUINO_BOARD_ID="generic" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/cores/esp8266 -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/variants/generic /private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/sketch/firmata_simple.ino.cpp -o /dev/null
Alternatives for ConfigurableFirmata.h: [[email protected]]
ResolveLibrary(ConfigurableFirmata.h)
  -> candidates: [[email protected]]
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE -DESP8266 @/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core/build.opt -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/lwip2/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/libc/xtensa-lx106-elf/include -I/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core -c @/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/warnings/none-cppflags -Os -g -free -fipa-pta -Werror=return-type -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10607 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_GENERIC" -DARDUINO_BOARD_ID="generic" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/cores/esp8266 -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/variants/generic -I/Users/user/Documents/Arduino/libraries/ConfigurableFirmata/src /private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/sketch/firmata_simple.ino.cpp -o /dev/null
Alternatives for ESP8266WiFi.h: [[email protected]]
ResolveLibrary(ESP8266WiFi.h)
  -> candidates: [[email protected]]
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE -DESP8266 @/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core/build.opt -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/lwip2/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/libc/xtensa-lx106-elf/include -I/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core -c @/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/warnings/none-cppflags -Os -g -free -fipa-pta -Werror=return-type -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10607 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_GENERIC" -DARDUINO_BOARD_ID="generic" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/cores/esp8266 -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/variants/generic -I/Users/user/Documents/Arduino/libraries/ConfigurableFirmata/src -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/ESP8266WiFi/src /private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/sketch/firmata_simple.ino.cpp -o /dev/null
Alternatives for Wire.h: [[email protected]]
ResolveLibrary(Wire.h)
  -> candidates: [[email protected]]
/Users/user/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE -DESP8266 @/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core/build.opt -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/lwip2/include -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/libc/xtensa-lx106-elf/include -I/private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/core -c @/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/warnings/none-cppflags -Os -g -free -fipa-pta -Werror=return-type -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10607 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_GENERIC" -DARDUINO_BOARD_ID="generic" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/cores/esp8266 -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/variants/generic -I/Users/user/Documents/Arduino/libraries/ConfigurableFirmata/src -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/ESP8266WiFi/src -I/Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/Wire /private/var/folders/ft/c5x1nn7j5qb5g8w17nd779r80000gn/T/arduino/sketches/A6D9F836FCC3B2090B3261FE9B6B2846/sketch/firmata_simple.ino.cpp -o /dev/null
/Users/user/src/personal/OmnicronHomelinkHub/firmata/firmata_simple/firmata_simple.ino:54:10: fatal error: AnalogWrite.h: No such file or directory
   54 | #include <AnalogWrite.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

Alternatives for AnalogWrite.h: []
ResolveLibrary(AnalogWrite.h)
  -> candidates: []
Using library ConfigurableFirmata at version 3.2.0 in folder: /Users/user/Documents/Arduino/libraries/ConfigurableFirmata 
Using library ESP8266WiFi at version 1.0 in folder: /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/ESP8266WiFi 
Using library Wire at version 1.0 in folder: /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/Wire 
exit status 1

Compilation error: AnalogWrite.h: No such file or directory

Let me know if you need any additional information. Excited to write some Go code for an ESP8266 device!

@pgrawehr
Copy link

Hi @sjhitchner

Yea, unfortunately I have not updated firmatabuilder to support the changes made for ConfigurableFirmata 3.X. But you should be able to get away without it. Just load the example ino at examples/ConfigurableFirmata/ConfigurableFirmata.ino into the Arduino IDE and make the required adjustments to the modules you want (they're all listed at the top of the file). If you've installed the library via the library manager, the example should be available under the "File/Examples" menu of the IDE.

The only thing that might not work out of the box is the Wifi communication, as I've not tested it with ESP8266. It is tested with ESP32, so the adjustments shouldn't be that big. For a quick start, you can test everything with the USB connection as well.

@sjhitchner
Copy link
Author

@pgrawehr

Thanks for your response, I'll try again later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants