Topic: Error compiling sketch on PlatformIO while compiling ok on Arduino IDE
Hi,
I'm learning PlatformIO which help with bigger sketches.
I have a small sketch working on Arduino IDE, but I got this error compiling the same sketch on PlatformIO. Error is related with RemoteXY library. Ant idea how to fix that ?
Errors message :
In file included from .pio\libdeps\d1_mini\RemoteXY\src/RemoteXY.h:156,
from src\main.cpp:38:
.pio\libdeps\d1_mini\RemoteXY\src/RemoteXYComm_WiFi.h: In member function 'virtual uint8_t CRemoteXYServer_WiFi::available(CRemoteXYClient*)':
.pio\libdeps\d1_mini\RemoteXY\src/RemoteXYComm_WiFi.h:95:29: error: 'class WiFiServer' has no member named 'available'
95 | WiFiClient cl = server->available ();
The sketch is :
#include <Arduino.h>
// DS18B20 sensor definitions and helpers
#include <OneWire.h>
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS D3
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
#include <DallasTemperature.h>
DallasTemperature sensors(&oneWire);
// Define temp variable
double insideTemp = DEVICE_DISCONNECTED_C;
const unsigned long DS18B20_READING_DELAY = 1000;
const unsigned long DS18B20prevReading = 0;
// Heating relay output definitions and helpers
#include <PID_v1.h>
#define HEATINGPIN D5
#define BUILTIN_LED D4
// bool heatingPermission = false;
double heatingSetpoint = 5; // °C
double insideTempHL = 7; // °C, high temperature cutoff
double heatingOutput = 0; // PWM signal to the relay
double Kp = 2, Ki = 5, Kd = 1;
PID heatingPID(&insideTemp, &heatingOutput, &heatingSetpoint, Kp, Ki, Kd, DIRECT);
// GUI definitions and helpers
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_CLOUD
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "SSID"
#define REMOTEXY_WIFI_PASSWORD "PASSWORD"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "TOKEN"
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] = // 246 bytes
{255, 9, 0, 12, 0, 239, 0, 16, 24, 1, 3, 130, 37, 48, 18, 10, 2, 26, 67, 4,
34, 13, 20, 5, 2, 26, 11, 129, 0, 38, 60, 16, 3, 17, 79, 70, 70, 32, 47, 32,
65, 85, 84, 79, 0, 66, 129, 34, 34, 20, 7, 1, 26, 129, 0, 3, 35, 25, 5, 17,
80, 73, 68, 32, 79, 117, 116, 112, 117, 116, 0, 129, 0, 55, 13, 5, 5, 17, 194, 176,
67, 0, 129, 0, 3, 13, 29, 5, 17, 73, 110, 105, 115, 105, 100, 101, 32, 84, 101, 109,
112, 0, 129, 0, 3, 3, 56, 5, 17, 67, 104, 105, 99, 107, 101, 110, 32, 67, 111, 111,
112, 32, 67, 111, 110, 116, 114, 111, 108, 101, 114, 0, 129, 0, 55, 20, 5, 5, 17, 194,
176, 67, 0, 129, 0, 3, 20, 21, 5, 17, 83, 101, 116, 32, 80, 111, 105, 110, 116, 0,
129, 0, 3, 27, 22, 5, 17, 72, 84, 32, 67, 117, 116, 111, 102, 102, 0, 7, 44, 34,
20, 20, 5, 2, 26, 2, 2, 7, 44, 34, 27, 20, 5, 2, 26, 2, 2, 129, 0, 55,
27, 5, 5, 17, 194, 176, 67, 0, 129, 0, 55, 35, 4, 5, 17, 37, 0, 130, 1, 2,
10, 59, 1, 17, 130, 1, 2, 44, 59, 1, 17, 129, 0, 3, 51, 26, 6, 17, 72, 69,
65, 84, 73, 78, 71, 0};
// this structure defines all the variables and events of your control interface
struct
{
// input variables
uint8_t heatingSelect; // =0 if select position A, =1 if position B, =2 if position C, ...
float heatingSetpoint;
float insideTempHL;
// output variables
char insideTemp[11]; // string UTF8 end zero
int8_t PIDoutput; // =0..100 level position
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
void setup()
{
Serial.begin(9600);
// Heating relay setup
pinMode(HEATINGPIN, OUTPUT);
digitalWrite(HEATINGPIN, LOW); // put relay off at start
pinMode(BUILTIN_LED, OUTPUT);
heatingPID.SetMode(AUTOMATIC); // turn the PID on
// GUI setup
RemoteXY_Init();
RemoteXY.heatingSetpoint = 5; // °C
RemoteXY.insideTempHL = 7; // °C
RemoteXY.heatingSelect = 1; // AUTO
// Inside temperature setup
sensors.begin(); // DS18B20 sensor
sensors.requestTemperatures(); // Send the request for a new value
}
void loop()
{
// GUI handler
RemoteXY_Handler();
if (millis() - DS18B20prevReading > DS18B20_READING_DELAY) // DS18B20 needs a delay between request and getting value
{
insideTemp = sensors.getTempCByIndex(0); // Get DS18B20 temperature
dtostrf(insideTemp, 0, 1, RemoteXY.insideTemp);
sensors.requestTemperatures(); // Send the request for the next new value
// Check if inside temperature reading was successful, or hight temp cutoff, or heating's off
if ((insideTemp == DEVICE_DISCONNECTED_C) || (insideTemp > insideTempHL) || (RemoteXY.heatingSelect == 0))
{
digitalWrite(HEATINGPIN, LOW);
RemoteXY.PIDoutput = 0;
digitalWrite(BUILTIN_LED, HIGH); // HIGH is off
if (insideTemp == DEVICE_DISCONNECTED_C)
{
Serial.println("Device not connected...");
}
else if (insideTemp > insideTempHL)
{
Serial.print("High Temp cut off : ");
Serial.print(insideTemp);
Serial.print(" / ");
Serial.println(insideTempHL);
}
else
{
Serial.print("Heating is OFF !");
}
}
else
{
heatingPID.Compute();
analogWrite(HEATINGPIN, heatingOutput);
RemoteXY.PIDoutput = heatingOutput / 255;
analogWrite(BUILTIN_LED, 255 - heatingOutput);
Serial.print(insideTemp);
Serial.print(" / ");
Serial.print(insideTempHL);
Serial.println(" °C");
Serial.println(heatingOutput);
}
}
}