Jacob_PridmoreBrynn Douglas
Published

MEGR 3171- The Bill"ion" Dollar Alarm Clock Idea

Do you have trouble waking up? Do normal alarm clocks just not seem to do the trick? Well, we hope you don't "sleep" on our idea.

IntermediateWork in progress3 hours74

Things used in this project

Hardware components

Argon
Particle Argon
×2
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
PTS 645 Series Switch
C&K Switches PTS 645 Series Switch
×1
Resistor 1k ohm
Resistor 1k ohm
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
IFTTT
Google Sheets
Google Sheets

Story

Read more

Schematics

Schematic of Buzzer

Schematic of Button

Code

Buzzer Code

C/C++
Code for connecting the Buzzer
int buzzer = D3;
int led = D7;


void setup()
{                
    pinMode(buzzer, OUTPUT);  // buzzer on pin D3
    pinMode(led, OUTPUT);
    digitalWrite(buzzer, LOW);
    digitalWrite(led, LOW);
   
    Particle.subscribe("WakeUp", Buzz );
    delay(3000);
   
    Particle.subscribe("Button Pushed", AlarmOff );
    delay(3000);
 }    


 void Buzz (const char *event, const char *data)  
 {
    digitalWrite(led,HIGH);
    tone(D3, 6000, 0);
    Particle.publish("AlarmState", "1");
    delay(45000);
     
 }
 
 void AlarmOff (const char *event, const char *data)  
 {
   
    digitalWrite(buzzer,LOW);
    digitalWrite(led, LOW);
    Particle.publish("AlarmState", "0");
    Particle.publish("ButtonState");
    delay(45000);
 }

Button Code

C/C++
Code for connecting the Button
// Our button wired to D0
int button = D0;
int led = D7;

void setup() {
    pinMode(button, INPUT); // sets pin as input
    pinMode(led, OUTPUT);
    digitalWrite(button, LOW);
    digitalWrite(led, LOW);
    delay(4000);
   
    Particle.subscribe("ButtonState", Blink );
    delay(3000);
    Particle.subscribe("AlarmState", BuzzerOFF );
    delay(3000);
}


void loop() {
 
  if( digitalRead(button) == HIGH )  {
    Particle.publish("Button Pushed");
    delay(3000);
  }
}

void Blink (const char *event, const char *data)  {
   digitalWrite(led, HIGH);
 }

void BuzzerOFF (const char *event, const char *data) {
  if (strcmp(data,"0")==0) {
    digitalWrite(led, LOW);
    delay(6000);
  }
    else{
    }
   
 }

Credits

Jacob_Pridmore

Jacob_Pridmore

1 project • 0 followers
Brynn Douglas

Brynn Douglas

1 project • 0 followers

Comments

Add projectSign up / Login