Comments (6)
Hi Alan,
First of all: You shouldn't put the variable types in there. They are there in the definition of the functions to show what the function expects, but in the actual call to the function you leave them out.
Furthermore the clock is already built into M5ez, so you cannot create a header widget called "clock" (or "title" or "wifi" for that matter). To see the clock, simply get online with your app: the clock should on by default.
from m5ez.
Hi,
Ok yes can see that now.
I have the latest libraries in Arduino and have setup a very basic sketch with a header with my text in it and that loads into the unit and I see the dark blue header with the text I supplied but no clock or Wifi which is up and connected. Please what am I doing wrong here?
#include <M5Stack.h>
#include <M5ez.h>
#include <ezTime.h>
#include <WiFi.h>
const char* ssid = "Y";
const char* password = "***********";
const char* ntpServer = "de.pool.ntp.org";
const long gmtOffset_sec = 3600;
const int daylightOffset_sec = 0;
WiFiClient wifiClient;
void wifiConnect() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
// Serial.print("*");
}
Serial.print("WiFi connected: ");
Serial.println(WiFi.localIP());
}
void setup() {
Serial.begin(115200);
//M5.begin();
ez.begin();
ez.header.show("Sullivan Control");
wifiConnect();
//init and get the time
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
delay(1500);
}
void loop() {
delay(1000);
}
Thanks Alan
from m5ez.
Ok so I have wifi bars in header, but still no clock. Do I need to begin the eztime or something else as the code below does not show a clock in header. :-(
ez.header.show();
ez.header.draw("clock");
ez.header.draw("wifi");
from m5ez.
All sorted as it need a Canvas statement to make the clock appear...
Now to press on with the content.
Keep up the good work as it does make life easier now that I have the basics.
Maybe a small example in the examples section that shows the clock and wifi in the header?
Cheers Alan
from m5ez.
Hi Alan,
Take a look at the M5ez demo program. You'll see it does absolutely nothing special to get clock and wifi in the header: they just work. So no need to provide ntp server, the SSID/password or really anything at all. Note that the delay
function doesn't do enough: If you did it the way you do, you would want to run ez.yield()
. But try this sketch instead:
#include <M5Stack.h>
#include <M5ez.h>
void setup() {
ez.begin();
ezMenu sc("Sullivan Control");
sc.addItem("Settings", ez.settings.menu);
sc.addItem("Something else", something_else);
sc.run();
}
void loop() {
// only here to keep arduino compiler happy:
// program never leaves setup() because sc.run() never exits
}
void something_else() {
ez.msgBox("Something else", "Indeed", "OK");
}
You will mostly want some menu item or something that points to ez.settings.menu
. That way you have access to the settings to get online or change the clock settings or whatever.
from m5ez.
(If you surround your sketch or example code with three backticks ( ``` ) on a line by themselves it will look nicer like in the edited posts above...) Let me know if you get stuck and I'll try to help.
from m5ez.
Related Issues (20)
- Upgraded now wont complile HOT 1
- Trying to stop NTP polling HOT 1
- Hangs - Suggestions on troubleshooting? HOT 1
- Added a few new functions to my branch
- Recieving and Sending Bluetooth Commands
- Reading SD card HOT 2
- up and down autorepeat
- change header title
- Demo sysinfo shows wrong SD card size.
- Two more features needed HOT 1
- crash/reboot in writing to SPI?!
- No need for Serial.begin()
- Errors installing from arduino ide and .zip HOT 2
- buttons automatically scroll up (A btn event without pressing)
- ez.events not running HOT 2
- Events are not executed when screen is off HOT 2
- cannot connect to raw.githubusercontent.com for OTA HOT 5
- port to M5Paper HOT 1
- M5Stack Basic (black) uSD card fails
- COMPILATION ERROR HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m5ez.