Deck of Cards Habit Tracker

Ever thought of a deck of cards as a calendar? It makes complete sense..

It takes approximately 2 months to form a habit. There are 52 cards in a deck. Taking the deck of cards as our guide, I created this visual calendar using Arduino to track new healthy habits I am trying to implement in my life.

Supplies:

Deck of cards
Acrylic sheet
Wood for frame
Perma Proto Breadboard
Standalone Momentary Capacitative Touch Sensor Breakout
Adafruit Real Time Clock

Cap Touch Sensor Video: https://drive.google.com/file/d/1sqG9ilx-aOI2dxPOMynkdXx-m0YSK6YU/view?usp=share_link

Strand Test Video:https://drive.google.com/file/d/12BuDFgrp0XulKO5ud0Zilnmp-M-sI1jH/view?usp=share_link


#include <Adafruit_NeoPixel.h>


// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#define LED_PIN    6
// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 200
// this constant won't change:
const int  buttonPin = 2;    // the pin that the pushbutton is attached to

// Variables will change:
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button


// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)

void setup () {
  Serial.begin(57600);
   strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
    // initialize the button pin as a input:
  pinMode(buttonPin, INPUT);


#ifndef ESP8266
  while (!Serial); // wait for serial port to connect. Needed for native USB
#endif

}

void loop () {

// read the pushbutton input pin:
  buttonState = digitalRead(buttonPin);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH ) {
      // if the current state is HIGH then the button went from off to on:
      
      Serial.println("on");
      Serial.print("number of button pushes: ");
      Serial.println("count"+buttonPushCounter);
      
        strip.setPixelColor(buttonPushCounter, strip.Color(255,   0,   203));
        strip.setPixelColor(buttonPushCounter+1, strip.Color(255,   0,   203));         //  Set pixel's color (in RAM)
        //strip.setPixelColor(buttonPushCounter+1, strip.Color(255,   255,   0));         //  Set pixel's color (in RAM)
        strip.show();                          //  Update strip to match
      buttonPushCounter=buttonPushCounter+2;
      Serial.println(buttonPushCounter);
      lastButtonState++;
      Serial.println(lastButtonState);
    } else {
      // if the current state is LOW then the button went from on to off:
      //Serial.println("off");
    }
    // Delay a little bit to avoid bouncing
    delay(50);
  }
  lastButtonState = buttonState;
  delay(300);
}

Thank you:

Becky Stern
Col Lindemuth
Rishita Mehta
Rohitha
Ria
Heba
Brydon
Cyntia
Nigel
Patrick
Sama

AND MORE

Instructables: https://www.instructables.com/Deck-of-Cards-Habit-Tracker/

%d