Double Clicking and Neopixels

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
bubblebobble
 
Posts: 8
Joined: Thu Jun 26, 2014 7:38 pm

Double Clicking and Neopixels

Post by bubblebobble »

Hi,

I'm using the "One Button" library shown here - http://www.mathertel.de/Arduino/OneButtonLibrary.aspx

I have the arduino recognizing double clicks.

I would like to use multiple double clicks as a sort of menu system.

First double click - do this
Second double click - do that
Third double click do - do something else
etc etc

How would a hacker like me go about this?

Current code example for 1st double click:

void doubleclick() {
strip.begin();
strip.setPixelColor(0, 255, 255, 255);
strip.show();
}

Thank you! =)

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Double Clicking and Neopixels

Post by Franklin97355 »

You would write code that would keep track of how many times doubleclick has been called. Then you could use a case statement to execute your code. Or you could use a state machine so that if doubleclick and state=1 then state = 2; do something else.

bubblebobble
 
Posts: 8
Joined: Thu Jun 26, 2014 7:38 pm

Re: Double Clicking and Neopixels

Post by bubblebobble »

Thank you for the info Franklin.

I'm pretty much new to coding but that will send me in the right direction. =)

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”