Creation - Button Extender

You look at the Gadgeteer socket description as well… https://www.ghielectronics.com/docs/120/gadgeteering-hardware shows this, but you’ll notice that the only guaranteed pin to be interrupt capable is pin3. So then you have to go through the actual pins used on the socket in question and see if they are interrupt capable, and maybe trial-and-error is a simple way…

Brett,

I totally understand that auto-generated is autogenerated and that manually added code will be overwritten.

My question is, how hard is it to write the code for the button-extender so that it is an item in the Toolbox, such that it can be dragged onto the designer and connected to a socket the same way as all the GHI and Seeed modules.

I like being able to look at Program.Gadgeteer to see where all the modules are connected. I don’t like having a separate code page for connecting and initializing the button extender.

Michael

Its easy. Read the module builders guide on http://gadgeteer.codeplex.com/releases

Yess very easy!
It’s the document njbuch mentioned. Especially page 18 “Module Software Template”

Have fun!

Dominik,

Back to the interrupt question – the ButtonPressed and ButtonReleased events never fire.

The timer polling of the button state works fine, but this periodic and I would prefer to fire an event at the moment the material hits the switch, but the events aren’t firing for me.

I was thinking that’s because of the interrupt issue, but I have tried pressing all of the test buttons on the ButtonExtender and none of them fire the ButtonPressed or ButtonReleased events. I would have thought if one pin was interrupt capable, then at least one of the buttons would have fired these events.

I assume these events must work, otherwise why would you have included them in the sample code…

What am I missing in order to get these events to fire?

Michael

You probably have an infinite sleep in your main…

Yes please post your source code.
I tested the module before shipping, so hardware has to be fine, can only be a software issue.
Button0 is connected to interrupt capable Pin3. But I didn’t implement that yet.
Will implement it as soon as I have a little time slot for it!

I am running the code that Dominik sent as the test application for the button extender.

Wich mainboard do you use? And wich socket?
Can you try if it works on another socket?

OK, figured it out.

I hadn’t set the PollTimerInterval.

There is a comment that says it defaults to 25, but if that’s true, it should have worked without being set.

Anyway, working now.

THANKS!

1 Like

Thank you for your bugreport! Fixed it. Initialized the timer with 0 instead of 25. Once you set the PollTimerInterval, the timer interval will be updated.
I’ll fix that in the next release of the driver!

Thank you very much

This a minor thing Dominik, but you should also put a space in the debug print statement in the ButtonPressed event handler in your test application. It currently prints out Button 2 state 1 as Button 21.

I see, fixed that, thanks!

According to this:
I just implemented the interrupt code für Button0 (Pin3 = interrupt capable), but I didn’t get good results for it when I push the button for a very short period. So I won’t implement that code in future releases.

Cheers
Dominik