Hi @felmue and thanks. This helps a lot.
Latest posts made by EricR
-
RE: Cant compile M5ez.h
Hi @felmue and thank for you're quick respond
I was wondering about the framework. To the best of my understanding do I use the 1.8.19 framework. It is what the upper left corner tells at least. Should M5ez not work for me?
Do I have to reinstall Arduino IDE to "downgrade" to a framework that works?
Thanks again for you're time
-
Cant compile M5ez.h
Hi, I am a relative beginner to arduino, M5Stack and M5ez. I was trying to use M5ez in a test project however if I use #include <M5ez.h> then the sketch won't compile. Even the basic Hellow_World example included with the M5ez won't compile for me.
I have follow all steps in https://github.com/M5ez/M5ez
and installed both M5ez and ezTime library
I have selected the correct board.Now, I turn to you, the masters of M5ez. What did I do wrong?
---------------------------------------------- I get the following error ------------------------------------
Arduino:1.8.19 (Windows 10), Kort:"M5Stack-Core-ESP32, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None"C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In lambda function:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1133:38: error: 'union arduino_event_info_t' has no member named 'disconnected'; did you mean 'eth_connected'?
if(WIFI_REASON_ASSOC_FAIL == info.disconnected.reason) { ^~~~~~~~~~~~ eth_connected
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In static member function 'static void ezWifi::begin()':
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1139:19: error: 'SYSTEM_EVENT_STA_DISCONNECTED' is not a member of 'arduino_event_id_t'
}, WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In static member function 'static bool ezWifi::_connection(ezMenu*)':
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1410:13: error: 'struct esp_wps_config_t' has no member named 'crypto_funcs'
config.crypto_funcs = &g_wifi_default_wps_crypto_funcs; ^~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1410:29: error: 'g_wifi_default_wps_crypto_funcs' was not declared in this scope
config.crypto_funcs = &g_wifi_default_wps_crypto_funcs; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1410:29: note: suggested alternative: 'g_wifi_default_wpa_crypto_funcs'
config.crypto_funcs = &g_wifi_default_wps_crypto_funcs; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ g_wifi_default_wpa_crypto_funcs
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1420:29: error: no matching function for call to 'onEvent(void (&)(arduino_event_id_t, system_event_info_t))'
WiFi.onEvent(_WPShelper); ^
In file included from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiSTA.h:28,
from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFi.h:32, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src/M5ez.h:36, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1:
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:159:21: note: candidate: 'wifi_event_id_t WiFiGenericClass::onEvent(WiFiEventCb, arduino_event_id_t)' <near match>
wifi_event_id_t onEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); ^~~~~~~
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:159:21: note: conversion of argument 1 would be ill-formed:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1420:29: error: invalid conversion from 'void ()(arduino_event_id_t, system_event_info_t)' to 'WiFiEventCb' {aka 'void ()(arduino_event_id_t)'} [-fpermissive]
WiFi.onEvent(_WPShelper); ^
In file included from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiSTA.h:28,
from C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFi.h:32, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src/M5ez.h:36, from C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1:
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:161:21: note: candidate: 'wifi_event_id_t WiFiGenericClass::onEvent(WiFiEventSysCb, arduino_event_id_t)' <near match>
wifi_event_id_t onEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX); ^~~~~~~
C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi\src/WiFiGeneric.h:161:21: note: conversion of argument 1 would be ill-formed:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1420:29: error: invalid conversion from 'void ()(arduino_event_id_t, system_event_info_t)' to 'WiFiEventSysCb' {aka 'void ()(arduino_event_t*)'} [-fpermissive]
WiFi.onEvent(_WPShelper); ^
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: In static member function 'static void ezWifi::_WPShelper(arduino_event_id_t, system_event_info_t)':
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:1467:17: warning: comparison between 'enum arduino_event_id_t' and 'enum system_event_id_t' [-Wenum-compare]
if (event == SYSTEM_EVENT_STA_WPS_ER_PIN) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp: At global scope:
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:2238:2: warning: unknown escape sequence: '|'
"KB14|!?:;\#$^&#SP#KB15|*()_-+=|#Del#KB0|More#LCK:SYM|Lock#KB16|'"`@%\/#KB17|<>{}#Done", //KB13
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ERRA\Documents\Arduino\libraries\M5ez\src\M5ez.cpp:2241:2: warning: unknown escape sequence: '#'
"'#"#`#@#%#/###Back", //KB16
^~~~~~~~~~~~~~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Använd: C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\WiFi
Oanvänd: C:\Program Files (x86)\Arduino\libraries\WiFi
Multiple libraries were found for "SD.h"
Använd: C:\Users\ERRA\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.4\libraries\SD
Oanvänd: C:\Program Files (x86)\Arduino\libraries\SD
exit status 1
Error compiling for board M5Stack-Core-ESP32.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.--------------------------------- End -----------------------------------------------------
-
RE: Stange interaction between clock and temprature sensor setup
Hi @felmue and thanks for the help. I changed GPIO and it works now. Strange as input port 2 worked when the temperature sensor were implemented separably.
However I have spend enough time trying to make it work. So I will not conplain now that it is working.
Thanks again
-
Stange interaction between clock and temprature sensor setup
Hi and thanks for you're time
I am a relative beginner to M5Stack and have made 2 test programs. One that displays weekday, date and time and one that use a Dallas 18B2D temperature sensor to display the room temperature. Both works interdependent.
However a strange interaction between the two setups occur when I try to implement them both on the same time.
If the sensor is connected to M5Stack during start up, then the internet setup won't connect, resulting in the weekday, date and time not working but the sensor value is displayed correctly.
If the sensor is disconnected from M5Stack during start up, then the internet setup will connect and weekday, date and time displays... But the sensor will not setup correctly and the sensor value is not displayed correctly.
I can't find the reason why the internet setup wont work when an analog input is connected to my M5Stack. Do you, masters of the M5Stack have any idea what could be the cause?
---------------------------------------------------- Copy of my code ---------------------------------------------------------------------------------
#include <M5Stack.h>
#include <WiFi.h>
#include <GParser.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "time.h"// Set the name and password of the wifi to be connected.
const char* ssid = "####WIFI#####";
const char* password = "##Stuff##";// Setup for NTP server and GMT offset as well as if daylight savings
const char* ntpServer = "se.pool.ntp.org"; // Set the connect NTP server.
const long gmtOffset_sec = 3600;
const int daylightOffset_sec = 3600;// Setup and declaration of therometer sensor
#define ONE_WIRE_BUS 2 // Data wire is plugged into port 2 on the Arduino
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
DeviceAddress insideThermometer; // arrays to hold device addressvoid printLocalTime() {
struct tm timeinfo;
if (!getLocalTime(&timeinfo)) { // Return 1 when the time is successfully obtained.
M5.Lcd.println("Failed to obtain time. \nPlease restart");
return;
}
// Wright weekday
M5.Lcd.setTextSize(5); // Set the font size.
M5.Lcd.setCursor(40, 10); // Set cursor
M5.Lcd.println(&timeinfo, "%A");// Wright date, month and year M5.Lcd.setTextSize(3); // Set the font size. M5.Lcd.setCursor(10, 64); // Set cursor M5.Lcd.println(&timeinfo, "%d %B %Y"); // Wright time of day M5.Lcd.setTextSize(5); // Set the font size. M5.Lcd.setCursor(40, 100); // Set cursor M5.Lcd.println(&timeinfo, "%H:%M:%S");
}
// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
for (uint8_t i = 0; i < 8; i++)
{
if (deviceAddress[i] < 16) M5.Lcd.print("0");
M5.Lcd.print(deviceAddress[i], HEX);
}
}// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
M5.Lcd.setCursor(20, 170);
M5.Lcd.setTextSize(3); // Set the font size.
M5.Lcd.print("Temp C: ");
M5.Lcd.print(sensors.getTempC(deviceAddress));
}void setup() {
M5.begin(); // Init M5Core.
M5.Power.begin(); // Init power
M5.Lcd.setTextSize(2); // Set the font size to 2// Therometer setup information Serial.begin(9600); // start serial port M5.Lcd.print("Parasite power is: "); // report parasite power requirements if (sensors.isParasitePowerMode()) M5.Lcd.print("ON"); else M5.Lcd.print("OFF");; M5.Lcd.println(); if (!sensors.getAddress(insideThermometer, 0)) M5.Lcd.println("Unable to find address for Device 0"); M5.Lcd.print("Device 0 Address: ");// show the addresses we found on the bus printAddress(insideThermometer); M5.Lcd.println(); sensors.setResolution(insideThermometer, 9); // set the resolution to 9 bit M5.Lcd.print("Device 0 Resolution: "); M5.Lcd.print(sensors.getResolution(insideThermometer), DEC); M5.Lcd.println(); // Internet comunication information M5.Lcd.printf("\nConnecting to %s", ssid); WiFi.begin(ssid, password); // Connect wifi and return connection status. while (WiFi.status() != WL_CONNECTED) { // If the wifi connection fails. delay(500); // delay 0.5s. M5.Lcd.print("."); } M5.Lcd.println("\nCONNECTED!"); configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); // init and get the time. printLocalTime(); WiFi.disconnect(true); // Disconnect wifi. WiFi.mode(WIFI_OFF); // Set the wifi mode to off. delay(20); // Clear all setup text M5.Lcd.clear();
}
void loop() {
printLocalTime();
sensors.requestTemperatures(); // Send the command to get temperatures
printTemperature(insideThermometer);
}