Comments (12)
Hi,
My guess is that HIGH
is not defined by hardware/arduino/avr/cores/arduino/Arduino.h
, because it's defined to be 0x1
on my Arduino Nano (non-Every), and it works fine.
I don't have a Nano Every board. Can you create a short program to just print out your HIGH
value? Basically, something like:
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.print("HIGH: ");
Serial.println(HIGH);
}
from acebutton.
Sure, I tried that already. It prints
HIGH: 1
and
LOW: 0
respectively. Which made me google this and I found that location on stack overflow.
from acebutton.
I just realized that I can compile without actually owning one of these boards, so I installed the "Arduino megaAVR Boards 1.8.1" core, and discovered it in hardware/megaavr/1.8.1/cores/arduino/api/Common.h
:
typedef enum {
LOW = 0,
HIGH = 1,
CHANGE = 2,
FALLING = 3,
RISING = 4,
} PinStatus;
This is unfortunate, because that means that HIGH
is not a C prepropcessor macro but is an enum value. This also explains the compiler warnings that you should be seeing:
/home/brian/dev/arduino-1.8.9/portable/packages/arduino/hardware/megaavr/1.8.1/cores/arduino/api/Common.h:104:6: note: initializing argument 2 of 'void digitalWrite(pin_size_t, PinStatus)'
void digitalWrite(pin_size_t pinNumber, PinStatus status);
^~~~~~~~~~~~
/home/brian/dev/AceButton/examples/HelloButton/HelloButton.ino:51:36: warning: invalid conversion from 'int' to 'PinStatus' [-fpermissive]
digitalWrite(LED_PIN, LED_OFF);
I'm not sure what the solution is. Let me think about this...
from acebutton.
Related info at arduino/ArduinoCore-API#25
from acebutton.
Allright thank you. For the time being I'll swap my regular Nano back in my circuit. 😉 I have a couple more libraries not working in my project, so I guess this board is just too new. I mean it was literally shipped by Arduino this week...
If you need me to test anything or need more sample code actually run etc., please let me know. I am happy to help.
from acebutton.
Changing the signature of digitalWrite()
to use a PinStatus
enum seems like a really bad idea. But AceButton should be able to support this, since the semantics of HIGH
did not change. I'll look into it.
from acebutton.
Hi,
I'm driving blind here, since I don't have this board to test on. Can you try changing in AceButton.h
, line 80:
static const uint8_t kButtonStateUnknown = 2;
to
static const uint8_t kButtonStateUnknown = 5
and see if that works? You'll have to comment out the #error
of course. (And when you wrote "does not work" above, what did you mean more precisely?)
from acebutton.
Hi Brian,
there was some evidence discovered in the the last hours that there - in addition to the PinStatus change - is actually a bug in the Arduino megaAVR Boards 1.8.1. I opened an issue [1] there because the simplest things (like digitalRead and digitalWrite) did not work at all on the analog pins (my current project uses A0-A2 for button inputs). On the digital pins both worked fine. I have been told that this is known and will be fixed sometime next week. They gave me a beta of 1.8.2 and I went ahead and tested AceButton with that one.
Good news: It appears everything works as expected in AceButton - when i comment out the #error
of course. I built a small setup on a breadboard, just one button and the SingleButton example works fine.
So in summary, the only thing you need to check is how to deal with the changes you mentioned here. The reason why it still did not work after commenting out the #error
was the bug mentioned in [1] and will be fixed soon. A change of kButtonStateUnknown
was not required.
from acebutton.
megaAVR-1.8.2 has been released today.
from acebutton.
Hi Stephan,
Can you test the latest on the develop
branch?
I believe I made this fully compatible with the Nano Every and other megaAVR boards.
from acebutton.
Hi Brian,
I did run a few quick tests (just the Every and one button) on my breadboard - works like charm. Awesome! I did test the SingleButton, HelloButtom and AutoBenchmark examples with no change (except the button pin, I changed that to A0). I will swap the Every into my project this weekend again and see if it works there as well (which I do expect).
If you want me to run specific tests for you, please let me know. Thanks for the quick turnaround!
cheers
Stephan
from acebutton.
Thanks for testing. I just released version 1.3.4 with this fix. Closing. Let me know if you run into any problems.
from acebutton.
Related Issues (20)
- Possible conflict with TC3 library on SAMD21 architecture ?
- can it be used with a SN74HC165 is a 8-Bit Parallel-Load Shift Registers
- arduion libray issues HOT 2
- Code_ESP32_Blynk_Bluetooth_WiFi_Switch_control_8_Relays_02.ino:27:21: error: variable or field 'button1Handler' declared void
- Suggestion for implementing 'setLongReleasedDelay' HOT 1
- use of __FlashStringHelper is ambiguous HOT 7
- invalid use of non-static member function 'void Interface::handleEvent(ace_button::AceButton*, uint8_t, uint8_t)' HOT 2
- call of overloaded AceButton(int) is ambiguous HOT 1
- call of overloaded 'init(int)' is ambiguous HOT 1
- Capacitive button returns release while button is pressed HOT 2
- [OT] featuring AceButton HOT 2
- Public method to supress long kEventLongPressed HOT 10
- Tri-state button example HOT 2
- No longer responding to single click HOT 1
- Examples depend on "using namespace ace_button" in the global namespace
- How can I use it with port extender?
- I want to set setDefaultReleasedState to LOW
- ESP32 Support? HOT 1
- Could we make `isLongPressed()` public?
- Two button both pressed (sample LongPress)
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 acebutton.