sp00n
Supporters
- Mar 27, 2013
- 2,210
- 874
Finished the code on my Arduino
*small sample*
#include <Bounce.h>
#define BTN_PIN 12
#define LED 13
Bounce btn_bounce = Bounce(BTN_PIN, 5);
boolean sequence_activated = false;
int time_before = 0;
byte Flag=0;
void setup() {
pinMode(BTN_PIN, INPUT);
pinMode(LED, OUTPUT);
//Serial.begin(9600);
}
void loop() {
// Update the debouncer
btn_bounce.update();
// If the button is not pressed zero millis with time_before:
if(btn_bounce.read() == LOW) {
time_before = millis();
}
// if the sequence has not happened before
if(Flag==0) {
// Current time - time before button press is equal or greater than 2 sec:
if(millis() - time_before >= 2000) {
This is by no means complete ... and is missing the end part (don't want to give all my surprises away)
*small sample*
#include <Bounce.h>
#define BTN_PIN 12
#define LED 13
Bounce btn_bounce = Bounce(BTN_PIN, 5);
boolean sequence_activated = false;
int time_before = 0;
byte Flag=0;
void setup() {
pinMode(BTN_PIN, INPUT);
pinMode(LED, OUTPUT);
//Serial.begin(9600);
}
void loop() {
// Update the debouncer
btn_bounce.update();
// If the button is not pressed zero millis with time_before:
if(btn_bounce.read() == LOW) {
time_before = millis();
}
// if the sequence has not happened before
if(Flag==0) {
// Current time - time before button press is equal or greater than 2 sec:
if(millis() - time_before >= 2000) {
This is by no means complete ... and is missing the end part (don't want to give all my surprises away)