cotestatnt / a6esp32 Goto Github PK
View Code? Open in Web Editor NEWESP32 Hardware Serial A6 GSM module
License: GNU General Public License v3.0
ESP32 Hardware Serial A6 GSM module
License: GNU General Public License v3.0
Hi, i need some help...
I'm trying to use the A6 gsm module to receive SMS and show them on an LCD screen, but i cant connect to the A6 module using your library. The board i'm using is the HW-549. I have connected the regulator enable pin as my "power switch", since there is no reset pin available to the user (without soldering to the chip itself). The module is connected to the UART2 port of the ESP-WROOM-32. Here is my code:
#include <stdio.h>
#include <Arduino.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
#include <A6ESP32.h>
#define A6pow 4
#define RX 16
#define TX 17
#define UART 2
LiquidCrystal_PCF8574 lcd(0x27); // Clase del LCD con parametros para 16x2
A6ESP32 A6l(UART);
void lcdSetup();
void welcome();
void a6Setup();
void a6Fail();
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
lcdSetup();
welcome();
a6Setup();
}
void loop() {
// put your main code here, to run repeatedly:
}
void lcdSetup(){
char error = 0;
Wire.begin();
Wire.beginTransmission(0x27);
error = Wire.endTransmission();
Serial.printf("Error: %d", error);
if (error == 0) {
Serial.println(": LCD found.");
lcd.begin(16, 2); // initialize the lcd
} else {
Serial.println(": LCD not found.");
}
}
void welcome(){
lcd.clear();
lcd.home();
lcd.setBacklight(255);
lcd.print(" INIC. CENTRAL");
lcd.setCursor(0, 1);
lcd.print(" ESPERE");
}
void a6Setup(){
Serial.println("INICIANDO MODULO A6");
A6l.powerCycle(A6pow);
if(A6l.begin(115200, RX, TX) != A6_OK){
a6Fail();
}
Serial.println("MODULO A6 INICIADO");
Serial.printf("RSSI: %s\n\r", A6l.getSignalStrength());
}
void a6Fail(){
Serial.println("FALLA MODULO A6");
while(1){
lcd.setCursor(0,1);
lcd.print("FALLA MODULO A6");
delay(1000);
lcd.setCursor(0,1);
lcd.print(" ");
delay(1000);
}
}
I've enabled the debug define to see if i could get any useful information:
Error: 0: LCD found.
INICIANDO MODULO A6
Power-cycling module...
Done, waiting for the module to initialize...
Done.
Command:
AT
Timed out.Command:
AT
Reply in 2000 ms: AT
Timed out.FALLA MODULO A6
And I also had to add this to the .h file:
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
otherwise it would give me errors at compile time:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp: In member function 'void A6ESP32::setVol(byte)':
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:303:29: error: no matching function for call to 'max(byte&, int)'
level = min(max(level, 5), 8);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)'
max(initializer_list<_Tp> __l, _Compare __comp)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:303:29: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
level = min(max(level, 5), 8);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: candidate: 'template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)'
max(initializer_list<_Tp> __l)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:303:29: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
level = min(max(level, 5), 8);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:303:29: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'int')
level = min(max(level, 5), 8);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
max(const _Tp& __a, const _Tp& __b)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:303:29: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'int')
level = min(max(level, 5), 8);
^
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp: In member function 'void A6ESP32::enableSpeaker(byte)':
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:315:31: error: no matching function for call to 'max(byte&, int)'
enable = min(max(enable, 0), 1);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)'
max(initializer_list<_Tp> __l, _Compare __comp)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:315:31: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
enable = min(max(enable, 0), 1);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: candidate: 'template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)'
max(initializer_list<_Tp> __l)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:315:31: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
enable = min(max(enable, 0), 1);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:315:31: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'int')
enable = min(max(enable, 0), 1);
^
In file included from d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61,
from D:\Users\ffpp2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\cores\esp32/Arduino.h:172,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.h:4,
from D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:1:
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
max(const _Tp& __a, const _Tp& __b)
^~~
d:\users\ffpp2\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: template argument deduction/substitution failed:
D:\Users\ffpp2\Documents\Arduino\libraries\A6ESP32\src\A6ESP32.cpp:315:31: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'int')
enable = min(max(enable, 0), 1);
^
exit status 1
Compilation error: exit status 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.