Comments (4)
Hello, @myAlterX .
Please show me the version of the library you are using and the source code you have tried.
from m5unified.
Hi!
I'm including:
#include <M5AtomDisplay.h>
#include <M5Unified.h>
then in setup:
auto cfg = M5.config();
// external display setting. (Pre-include required)
cfg.external_display.module_display = false; // default=true. use ModuleDisplay
cfg.external_display.atom_display = true; // default=true. use AtomDisplay
cfg.external_display.unit_glass = false; // default=true. use UnitGLASS
cfg.external_display.unit_glass2 = false; // default=true. use UnitGLASS2
cfg.external_display.unit_oled = false; // default=true. use UnitOLED
cfg.external_display.unit_mini_oled = false; // default=true. use UnitMiniOLED
cfg.external_display.unit_lcd = false; // default=true. use UnitLCD
cfg.external_display.unit_rca = false; // default=true. use UnitRCA VideoOutput
cfg.external_display.module_rca = false; // default=true. use ModuleRCA VideoOutput
M5.begin(cfg);
in loop somewhere I test for:
if (M5.BtnA.wasPressed() || M5.BtnB.wasPressed() || M5.BtnC.wasPressed() || M5.BtnEXT.wasPressed())
because this doesn't seem to work, I just read the digital pin for now:
int val = digitalRead(BTN_PIN);
// Handle button press
if (M5.BtnA.wasPressed() || M5.BtnB.wasPressed() || M5.BtnC.wasPressed() || M5.BtnEXT.wasPressed() || val == LOW)
which I have set at the top to 41 thanks to your clever labeling!
const int BTN_PIN = GPIO_NUM_41;
I took a peek at the lib and found this comment:
```cpp
/*
/// List of available buttons:
M5Stack BASIC/GRAY/GO/FIRE: BtnA,BtnB,BtnC
M5Stack Core2: BtnA,BtnB,BtnC,BtnPWR
M5Stick C/CPlus: BtnA,BtnB, BtnPWR
M5Stick CoreInk: BtnA,BtnB,BtnC,BtnPWR,BtnEXT
M5Paper: BtnA,BtnB,BtnC
M5Station: BtnA,BtnB,BtnC,BtnPWR
M5Tough: BtnPWR
M5ATOM: BtnA
*/
Which doesn't seem to have any mention of the AtomS3. Don't know if constants are defined. If they are, it doesn't work for me.
Thanks for your quick reply!
from m5unified.
Are you using M5.update
?
You must run M5.update
before reading the button.
#include <M5Unified.h>
void setup(void)
{
M5.begin();
}
void loop(void)
{
M5.delay(1);
M5.update();
if (M5.BtnA.wasPressed()) {
M5_LOGE("wasPressed");
}
}
from m5unified.
No I was not!
After updating, BtnA does the job.
Thanks very much for your help!
M5.update();
if (M5.BtnA.wasPressed()) {
// works
}
You may close the issue!
from m5unified.
Related Issues (20)
- Cracking sound on speaker using the "M5CoreS3-Esphome/voice-assistant" HOT 2
- M5Core2 Power LED HOT 8
- Customised buttons HOT 1
- M5Capsule cannot be detected corretly HOT 2
- Setting text color on LCD prevents breaks text output HOT 1
- M5 Core2 v1.1 power LED HOT 1
- changing font HOT 2
- What does it do? AXP2101_Class::setReg0x20Bit0(bool flg) HOT 2
- How to use StickC Plus beeper buzzer HOT 2
- getVBUSVoltage not working with Core2 v1.1 HOT 3
- speaker on core 2 HOT 1
- M5Unified and Arduino 3.0 on Core2 HOT 2
- ADC cannot be used with M5Unified and Arduino3.0.4 HOT 1
- M5unified and boot/flash encryption HOT 2
- IDF 5.1/Arduino 3.0 support: legacy adc driver migration missing causing a boot crash if an ADC input is used HOT 4
- IDF 5.1/Arduino 3.0 support: M5.Speaker methods, camera input broken (CoreS3)
- M5Paper wakes too soon from deep sleep when touch wakeup is enabled - with solution HOT 2
- Minimalist configuration using M5Unified and BluetoothA2DPSink HOT 3
- M5CoreS3 speaker issue HOT 2
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 m5unified.