Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - andri36

Pages: [1]
Software / Multi click on button and power optimization
« on: April 04, 2015, 03:24:03 AM »
Hi to all,
I'm working on a project that requires 2 buttons with multiple state (click, double click and click+hold). I try to use ClickButton.h lib ( and it works well. My problem is that if I set a
Code: [Select]
RFduino_pinWake(buttonOnePin, HIGH); to the first pin or second, in the
Code: [Select]
loop() statement RFduino wake up and the power consumption raise. I'll try to use
Code: [Select]
RFduino_pinWoke() method and
Code: [Select]
RFduino_resetPinWake() method to send RFduino in ULP mode. But in this case the ClickButton.h lib stop to works correctly. My sketch is:

Code: [Select]
#include <RFduinoBLE.h>
#include "ClickButton.h"

int upButtonPin = 6;
ClickButton upButton(upButtonPin, HIGH, CLICKBTN_PULLUP);
int downButtonPin = 5;
ClickButton downButton(downButtonPin, HIGH, CLICKBTN_PULLUP);

void setup() {
  RFduinoBLE.deviceName = "RFduino";
  RFduinoBLE.advertisementData = "adv";
  pinMode(upButtonPin, INPUT);
  RFduino_pinWake(upButtonPin, HIGH);
  pinMode(downButtonPin, INPUT);
  RFduino_pinWake(downButtonPin, HIGH);


void loop() {
  RFduino_ULPDelay( INFINITE );
  if(RFduino_pinWoke(upButtonPin)) {
    Serial.print("Wake: ");

    if (upButton.clicks != 0) { Serial.println(upButton.clicks); RFduinoBLE.sendInt(upButton.clicks); }


When RFduino wake up and read the buttons state the clicks is always 0. But if I remove the
Code: [Select]
RFduino_pinWoke() method and
Code: [Select]
RFduino_resetPinWake() method the buttons state read and send works well.

Thanks in advance to all.

Pages: [1]