Alex Glow
Published

The Creativity Button

Switch on your brain's creative potential with this hacked Dash button – a timer that keeps you in the hypnagogic state.

BeginnerFull instructions provided1 hour2,989
The Creativity Button

Things used in this project

Hardware components

AWS IoT Button
Amazon Web Services AWS IoT Button
×1
LightBlue Bean
Punch Through LightBlue Bean
×1
SparkFun Haptic vibration feedback motor
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1

Story

Read more

Schematics

Schematic (image)

Schematic (Fritzing)

Code

Bean code

C/C++
Paste this into the Bean Loader app and upload it to your LightBlue Bean.
// PinChangeInt handles pin change interrupts
#include <PinChangeInt.h> 

int hypno = 0;

void setup() {
   pinMode(0, INPUT_PULLUP);
   pinMode(1, OUTPUT);
    
   Bean.setLed(0, 0, 0);
   digitalWrite(1, LOW);
   // run pinChanged when something changes on D0 
   // This is an external library, so you don't need the prefix "Bean"
   attachPinChangeInterrupt(0, pinChanged, CHANGE);
}

void loop() { 
  // Sleep all the time when not handling an interrupt
  if (hypno == 1) {
   Bean.setLed(255, 0, 0);
   digitalWrite(1, HIGH);
   delay(500);
   Bean.setLed(0, 0, 0);
   digitalWrite(1, LOW);
   delay(600000);
   Bean.setLed(255, 0, 0);
   digitalWrite(1, HIGH);
   delay(500);
   Bean.setLed(0, 0, 0);
   digitalWrite(1, LOW);
   hypno = 0;
   }
   
  Bean.sleep(0xFFFFFFFF);
}

// Interrupt service routine (ISR) needs to return void and accept no arguments
void pinChanged() {
   hypno = 1;
}

Credits

Alex Glow

Alex Glow

21 projects • 1494 followers
The Hackster team's resident Hardware Nerd. I like robots, music, EEG, wearables, and languages. FIRST Robotics kid.

Comments

Add projectSign up / Login