Axa remote script with softserial

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
remko2000
Posts: 182
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Axa remote script with softserial

Post by remko2000 »

I control my window opener (axa remote) with this script:

Code: Select all

/*
* This sketch reads a command through a http connection
* depending on the text received it will send open, stop or close
* commands to the Esp8266. the ESP8266 is connected to the Axa Remote 2.0 electric window opener
*/

#include <ESP8266WiFi.h>
const char* ssid = "xxx";
const char* password = "xxxx";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
Serial.begin(19200,SERIAL_8N1);
delay(10); 
// Connect to WiFi network 
WiFi.begin(ssid, password); 
while (WiFi.status() != WL_CONNECTED) {
delay(500);
} 
// Start the server
server.begin();
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil('\r');
client.flush();
// Match the request
int val;
if (req.indexOf("/open") != -1)
open_axa();
else 
if (req.indexOf("/close") != -1)
close_axa();
else if (req.indexOf("/stop") != -1)
stop_axa();
else {
Serial.println("invalid request");
client.stop();
return;
}
}
void open_axa() {
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.print("E");
delay(20);
Serial.print("N");
delay(20);
Serial.println("\r");
delay(200);
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.print("E");
delay(20);
Serial.print("N");
delay(20);
Serial.println("\r");
delay(200);
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.print("E");
delay(20);
Serial.print("N");
delay(20);
Serial.println("\r");
delay(2000);
}

void close_axa() {
Serial.print("C");
delay(20);
Serial.print("L");
delay(20);
Serial.print("O");
delay(20);
Serial.print("S");
delay(20);
Serial.print("E");
delay(20);
Serial.println("\r");
delay(2000);
Serial.print("C");
delay(20);
Serial.print("L");
delay(20);
Serial.print("O");
delay(20);
Serial.print("S");
delay(20);
Serial.print("E");
delay(20);
Serial.println("\r");
delay(2000);
Serial.print("C");
delay(20);
Serial.print("L");
delay(20);
Serial.print("O");
delay(20);
Serial.print("S");
delay(20);
Serial.print("E");
delay(20);
Serial.println("\r");
delay(2000);
}
void stop_axa() {
Serial.print("S");
delay(20);
Serial.print("T");
delay(20);
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.println("\r");
Serial.print("S");
delay(20);
Serial.print("T");
delay(20);
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.println("\r");
Serial.print("S");
delay(20);
Serial.print("T");
delay(20);
Serial.print("O");
delay(20);
Serial.print("P");
delay(20);
Serial.println("\r");
}
But because of a change in my hardware I want to use the softwareserial. So I change my script to:

Code: Select all

/*
* This sketch reads a command through a http connection
* depending on the text received it will send open, stop or close
* commands to the Esp8266. the ESP8266 is connected to the Axa Remote 2.0 electric window opener
*/
#include <SoftwareSerial.h> // For Swapping TX/RX
#define rxPin 1
#define txPin 3
#define MAX_MSG_LEN (128) // maximum MQTT recieved message length
const byte numChars = 128; // maximum SERIAL recieved message length
char receivedChars[numChars]; // an array to store the received message
const byte numCode = 4; // maximum SERIAL recieved message length
char receivedCode[numCode]; // an array to store the received code
boolean newData = false;
SoftwareSerial SoftSerial(rxPin, txPin);  // Software serial
 
#include <ESP8266WiFi.h>
const char* ssid = "xxx";
const char* password = "xxxx";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  SoftSerial.begin(19200,SWSERIAL_8N1);
delay(10);
// Connect to WiFi network
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
// Start the server
server.begin();
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil('\r');
client.flush();
// Match the request
int val;
if (req.indexOf("/open") != -1)
open_axa();
else
if (req.indexOf("/close") != -1)
close_axa();
else if (req.indexOf("/stop") != -1)
stop_axa();
else {
SoftSerial.println("invalid request");
client.stop();
return;
}
}
void open_axa() {
Softserial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.print("N");
delay(20);
SoftSerial.println("\r");
delay(200);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.print("N");
delay(20);
SoftSerial.println("\r");
delay(200);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.print("N");
delay(20);
SoftSerial.println("\r");
delay(2000);
}
 
void close_axa() {
SoftSerial.print("C");
delay(20);
SoftSerial.print("L");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("S");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.println("\r");
delay(2000);
SoftSerial.print("C");
delay(20);
SoftSerial.print("L");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("S");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.println("\r");
delay(2000);
SoftSerial.print("C");
delay(20);
SoftSerial.print("L");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("S");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.println("\r");
delay(2000);
}
void stop_axa() {
SoftSerial.print("S");
delay(20);
SoftSerial.print("T");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.println("\r");
SoftSerial.print("S");
delay(20);
SoftSerial.print("T");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.println("\r");
SoftSerial.print("S");
delay(20);
SoftSerial.print("T");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.println("\r");
}
I get an error when compiling in the arduino IDE:
Softserial' was not declared in this scope
What do I change in the second script? I add:

Code: Select all

#include <SoftwareSerial.h> // For Swapping TX/RX
#define rxPin 1
#define txPin 3
#define MAX_MSG_LEN (128) // maximum MQTT recieved message length
const byte numChars = 128; // maximum SERIAL recieved message length
char receivedChars[numChars]; // an array to store the received message
const byte numCode = 4; // maximum SERIAL recieved message length
char receivedCode[numCode]; // an array to store the received code
boolean newData = false;
SoftwareSerial SoftSerial(rxPin, txPin);  // Software serial
and I changed everywhere serial to softserial. I am not very good at programming so I don't see what the problem here is. Can someone get me on the right track?
User avatar
erem
Posts: 230
Joined: Tuesday 27 March 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Amsterdam/netherlands
Contact:

Re: Axa remote script with softserial

Post by erem »

you declare
SoftwareSerial SoftSerial

you use
Softserial.print("O");

mind your capitalization.
Regards,

Rob
remko2000
Posts: 182
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: Axa remote script with softserial

Post by remko2000 »

Thx a bit sloppy indeed. I change it. Now I get a bunch of errors

Code: Select all

Arduino:1.8.8 (Mac OS X), Board:"Generic ESP8266 Module, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), ck, 26 MHz, 40MHz, DOUT (compatible), 512K (no SPIFFS), 2, nonos-sdk 2.2.1 (legacy), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from /Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:31:0,
                 from /Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:27,
                 from /Users/remko/Downloads/sketch_dec12e/sketch_dec12e.ino:6:
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:43:17: error: expected initializer before 'vPtrToFunPtrExec'
     R IRAM_ATTR vPtrToFunPtrExec(void* fn, P... args)
                 ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:242:28: error: expected ';' at end of member declaration
             DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:242:62: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
                                                              ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:273:22: error: expected ';' at end of member declaration
             static R IRAM_ATTR vPtrToFunAPtrExec(void* self, P... args)
                      ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:273:22: error: 'R delegate::detail::DelegatePImpl<A, R, P>::IRAM_ATTR' conflicts with a previous declaration
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:242:28: note: previous declaration 'delegate::detail::DelegatePImpl<A, R, P>& delegate::detail::DelegatePImpl<A, R, P>::IRAM_ATTR'
             DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:273:71: error: ISO C++ forbids declaration of 'vPtrToFunAPtrExec' with no type [-fpermissive]
             static R IRAM_ATTR vPtrToFunAPtrExec(void* self, P... args)
                                                                       ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:327:15: error: expected ';' at end of member declaration
             R IRAM_ATTR operator()(P... args) const
               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:327:15: error: redeclaration of 'R delegate::detail::DelegatePImpl<A, R, P>::IRAM_ATTR'
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:242:28: note: previous declaration 'delegate::detail::DelegatePImpl<A, R, P>& delegate::detail::DelegatePImpl<A, R, P>::IRAM_ATTR'
             DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:327:47: error: ISO C++ forbids declaration of 'operator()' with no type [-fpermissive]
             R IRAM_ATTR operator()(P... args) const
                                               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h: In member function 'delegate::detail::DelegatePImpl<A, R, P>::operator delegate::detail::DelegatePImpl<A, R, P>::FunVPPtr() const':
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:284:28: error: 'vPtrToFunPtrExec' was not declared in this scope
                     return vPtrToFunPtrExec<R, P...>;
                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:284:46: error: expected primary-expression before ',' token
                     return vPtrToFunPtrExec<R, P...>;
                                              ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:284:49: error: expected primary-expression before '...' token
                     return vPtrToFunPtrExec<R, P...>;
                                                 ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:284:49: error: expected ';' before '...' token
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:284:49: error: expected primary-expression before '...' token
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:284:49: error: expected ';' before '...' token
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h: At global scope:
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:686:28: error: expected ';' at end of member declaration
             DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:686:62: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
                                                              ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:748:15: error: expected ';' at end of member declaration
             R IRAM_ATTR operator()(P... args) const
               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:748:15: error: redeclaration of 'R delegate::detail::DelegatePImpl<void, R, P ...>::IRAM_ATTR'
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:686:28: note: previous declaration 'delegate::detail::DelegatePImpl<void, R, P ...>& delegate::detail::DelegatePImpl<void, R, P ...>::IRAM_ATTR'
             DelegatePImpl& IRAM_ATTR operator=(std::nullptr_t)
                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:748:47: error: ISO C++ forbids declaration of 'operator()' with no type [-fpermissive]
             R IRAM_ATTR operator()(P... args) const
                                               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h: In member function 'delegate::detail::DelegatePImpl<void, R, P ...>::operator delegate::detail::DelegatePImpl<void, R, P ...>::FunVPPtr() const':
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:713:28: error: 'vPtrToFunPtrExec' was not declared in this scope
                     return vPtrToFunPtrExec<R, P...>;
                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:713:46: error: expected primary-expression before ',' token
                     return vPtrToFunPtrExec<R, P...>;
                                              ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:713:49: error: expected primary-expression before '...' token
                     return vPtrToFunPtrExec<R, P...>;
                                                 ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:713:49: error: expected ';' before '...' token
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:713:49: error: expected primary-expression before '...' token
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:713:49: error: expected ';' before '...' token
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h: At global scope:
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1043:27: error: expected ';' at end of member declaration
             DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
                           ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1043:61: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
                                                             ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1074:22: error: expected ';' at end of member declaration
             static R IRAM_ATTR vPtrToFunAPtrExec(void* self)
                      ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1074:22: error: 'R delegate::detail::DelegateImpl<A, R>::IRAM_ATTR' conflicts with a previous declaration
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1043:27: note: previous declaration 'delegate::detail::DelegateImpl<A, R>& delegate::detail::DelegateImpl<A, R>::IRAM_ATTR'
             DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
                           ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1074:60: error: ISO C++ forbids declaration of 'vPtrToFunAPtrExec' with no type [-fpermissive]
             static R IRAM_ATTR vPtrToFunAPtrExec(void* self)
                                                            ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1127:15: error: expected ';' at end of member declaration
             R IRAM_ATTR operator()() const
               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1127:15: error: redeclaration of 'R delegate::detail::DelegateImpl<A, R>::IRAM_ATTR'
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1043:27: note: previous declaration 'delegate::detail::DelegateImpl<A, R>& delegate::detail::DelegateImpl<A, R>::IRAM_ATTR'
             DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
                           ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1127:38: error: ISO C++ forbids declaration of 'operator()' with no type [-fpermissive]
             R IRAM_ATTR operator()() const
                                      ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1485:27: error: expected ';' at end of member declaration
             DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
                           ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1485:61: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
                                                             ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1547:15: error: expected ';' at end of member declaration
             R IRAM_ATTR operator()() const
               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1547:15: error: redeclaration of 'R delegate::detail::DelegateImpl<void, R>::IRAM_ATTR'
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1485:27: note: previous declaration 'delegate::detail::DelegateImpl<void, R>& delegate::detail::DelegateImpl<void, R>::IRAM_ATTR'
             DelegateImpl& IRAM_ATTR operator=(std::nullptr_t)
                           ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1547:38: error: ISO C++ forbids declaration of 'operator()' with no type [-fpermissive]
             R IRAM_ATTR operator()() const
                                      ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1711:23: error: expected ';' at end of member declaration
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                       ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1711:57: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                         ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1790:23: error: expected ';' at end of member declaration
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                       ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1790:57: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                         ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1846:23: error: expected ';' at end of member declaration
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                       ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1846:57: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                         ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1907:23: error: expected ';' at end of member declaration
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                       ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1907:57: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                         ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1986:23: error: expected ';' at end of member declaration
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                       ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:1986:57: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                         ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:2042:23: error: expected ';' at end of member declaration
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                       ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:2042:57: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
             Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                         ^
In file included from /Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:31:0,
                 from /Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:27,
                 from /Users/remko/Downloads/sketch_dec12e/sketch_dec12e.ino:6:
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:2087:15: error: expected ';' at end of member declaration
     Delegate& IRAM_ATTR operator=(std::nullptr_t) {
               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:2087:49: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
     Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                 ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:2124:15: error: expected ';' at end of member declaration
     Delegate& IRAM_ATTR operator=(std::nullptr_t) {
               ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/Delegate.h:2124:49: error: ISO C++ forbids declaration of 'operator=' with no type [-fpermissive]
     Delegate& IRAM_ATTR operator=(std::nullptr_t) {
                                                 ^
In file included from /Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:27:0,
                 from /Users/remko/Downloads/sketch_dec12e/sketch_dec12e.ino:6:
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:145:8: error: expected ';' at end of member declaration
     T& IRAM_ATTR pushpeek()
        ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:145:27: error: ISO C++ forbids declaration of 'pushpeek' with no type [-fpermissive]
     T& IRAM_ATTR pushpeek()
                           ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:157:10: error: expected ';' at end of member declaration
     bool IRAM_ATTR push();
          ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:157:10: error: redeclaration of 'bool circular_queue<T, ForEachArg>::IRAM_ATTR'
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:145:8: note: previous declaration 'T& circular_queue<T, ForEachArg>::IRAM_ATTR'
     T& IRAM_ATTR pushpeek()
        ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:157:25: error: ISO C++ forbids declaration of 'push' with no type [-fpermissive]
     bool IRAM_ATTR push();
                         ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:164:10: error: expected ';' at end of member declaration
     bool IRAM_ATTR push(T&& val);
          ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:164:10: error: redeclaration of 'bool circular_queue<T, ForEachArg>::IRAM_ATTR'
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:145:8: note: previous declaration 'T& circular_queue<T, ForEachArg>::IRAM_ATTR'
     T& IRAM_ATTR pushpeek()
        ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:164:32: error: ISO C++ forbids declaration of 'push' with no type [-fpermissive]
     bool IRAM_ATTR push(T&& val);
                                ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:171:10: error: expected ';' at end of member declaration
     bool IRAM_ATTR push(const T& val)
          ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:171:10: error: redeclaration of 'bool circular_queue<T, ForEachArg>::IRAM_ATTR'
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:145:8: note: previous declaration 'T& circular_queue<T, ForEachArg>::IRAM_ATTR'
     T& IRAM_ATTR pushpeek()
        ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:171:37: error: ISO C++ forbids declaration of 'push' with no type [-fpermissive]
     bool IRAM_ATTR push(const T& val)
                                     ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:254:16: error: expected initializer before 'circular_queue'
 bool IRAM_ATTR circular_queue<T, ForEachArg>::push()
                ^
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/circular_queue/circular_queue.h:269:16: error: expected initializer before 'circular_queue'
 bool IRAM_ATTR circular_queue<T, ForEachArg>::push(T&& val)
                ^
In file included from /Users/remko/Downloads/sketch_dec12e/sketch_dec12e.ino:6:0:
/Users/remko/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:132:9: error: 'int SoftwareSerial::availableForWrite()' marked override, but does not override
     int availableForWrite() override {
         ^
exit status 1
Fout bij het compileren voor board Generic ESP8266 Module

Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.
Is there a problem with my librarys? Do I need to use another softwareseriallibrary instead of the EspSoftwareSerial?
remko2000
Posts: 182
Joined: Thursday 28 December 2017 14:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Broek op Langedijk
Contact:

Re: Axa remote script with softserial

Post by remko2000 »

To get ride of all the errors I try to start with a fresh arduino surrounding. So I update to the arduino 1.8.12 IDE and followed this instruction (for mac):
https://arduino-esp8266.readthedocs.io/ ... it-version

I understand the library ' softserial' is included in the esp8266 build so no need to add a softseriallibrary manually. So I thought.
Now when I/m trying to compile my code I do get an error '

Code: Select all

SoftwareSerial.h: No such file or directory
To be complete I use this code:

Code: Select all

/*
* This sketch reads a command through a http connection
* depending on the text received it will send open, stop or close
* commands to the Esp8266. the ESP8266 is connected to the Axa Remote 2.0 electric window opener
*/
#include <SoftwareSerial.h> // For Swapping TX/RX
#define rxPin 1
#define txPin 3
#define MAX_MSG_LEN (128) // maximum MQTT recieved message length
const byte numChars = 128; // maximum SERIAL recieved message length
char receivedChars[numChars]; // an array to store the received message
const byte numCode = 4; // maximum SERIAL recieved message length
char receivedCode[numCode]; // an array to store the received code
boolean newData = false;
SoftwareSerial SoftSerial(rxPin, txPin);  // Software serial
 
#include <ESP8266WiFi.h>
const char* ssid = "xxx";
const char* password = "xxx";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  SoftSerial.begin(19200,SWSERIAL_8N1);
delay(10);
// Connect to WiFi network
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
// Start the server
server.begin();
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil('\r');
client.flush();
// Match the request
int val;
if (req.indexOf("/open") != -1)
open_axa();
else
if (req.indexOf("/close") != -1)
close_axa();
else if (req.indexOf("/stop") != -1)
stop_axa();
else {
SoftSerial.println("invalid request");
client.stop();
return;
}
}
void open_axa() {
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.print("N");
delay(20);
SoftSerial.println("\r");
delay(200);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.print("N");
delay(20);
SoftSerial.println("\r");
delay(200);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.print("N");
delay(20);
SoftSerial.println("\r");
delay(2000);
}
 
void close_axa() {
SoftSerial.print("C");
delay(20);
SoftSerial.print("L");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("S");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.println("\r");
delay(2000);
SoftSerial.print("C");
delay(20);
SoftSerial.print("L");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("S");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.println("\r");
delay(2000);
SoftSerial.print("C");
delay(20);
SoftSerial.print("L");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("S");
delay(20);
SoftSerial.print("E");
delay(20);
SoftSerial.println("\r");
delay(2000);
}
void stop_axa() {
SoftSerial.print("S");
delay(20);
SoftSerial.print("T");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.println("\r");
SoftSerial.print("S");
delay(20);
SoftSerial.print("T");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.println("\r");
SoftSerial.print("S");
delay(20);
SoftSerial.print("T");
delay(20);
SoftSerial.print("O");
delay(20);
SoftSerial.print("P");
delay(20);
SoftSerial.println("\r");
}
Do I misunderstand the fact the softserial library is included in the esp8266 build? Do I have to do something else to implant this library?
User avatar
erem
Posts: 230
Joined: Tuesday 27 March 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Amsterdam/netherlands
Contact:

Re: Axa remote script with softserial

Post by erem »

you can check which libraries are installed via arduino-tools-manage libraries.

in your case, i believe you should check for espsoftwareserial and install the latest version if not installed.
mind you, there are significant changes between V4 and V5+, so you may need to adapt your program to V5+
Regards,

Rob
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest