David Conlin
Published

Long Distance Couple Communication Device

A communication device that allows couples to communicate with each other over long distances using LEDs.

BeginnerFull instructions provided2 hours509
Long Distance Couple Communication Device

Things used in this project

Hardware components

Argon
Particle Argon
×2
Breadboard (generic)
Breadboard (generic)
×2
LED (generic)
LED (generic)
×6
Gravity:Digital Push Button (Yellow)
DFRobot Gravity:Digital Push Button (Yellow)
×2
Resistor 221 ohm
Resistor 221 ohm
×4

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Schematics

IOT Project Circuit Diagram

Code

First IOT Lamp code

C/C++
int led1 = A5; 
int led2 = A4;
int led3 = A3;
int led7 = D7;
int button = D6;
int digitalValue;
void setup() {
    Particle.subscribe("on3", function);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(button, INPUT);
  delay(1000);
}
void loop() {
 
 digitalValue = digitalRead(button);
 
 if (digitalValue == 1) {
    Particle.publish("on4");
    delay(5000);
  }  else{
    analogWrite(led1, LOW);
    delay(500);
    analogWrite(led2, LOW);
    delay(500);
    analogWrite(led3, LOW);
    delay(500);
    analogWrite(led7, LOW);
    delay(500);
 }
 
}
int function(const char *on, const char *data){
    analogWrite(led1, HIGH);
    delay(500);
    analogWrite(led1, LOW);
    analogWrite(led2, HIGH);
    delay(500);
    analogWrite(led2, LOW);
    analogWrite(led3, HIGH);
    delay(500);
    analogWrite(led3, LOW);
    analogWrite(led7, HIGH);
    delay(500);
    analogWrite(led7, LOW);
    delay(500);

}

Second IOT Lamp Code

C/C++
int led1 = A5; 
int led2 = A4;
int led3 = A3;
int led7 = D7;
int button = D6;
int digitalValue;
void setup() {
    Particle.subscribe("on4", function);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(button, INPUT);
  delay(1000);
}

void loop() {
 
 digitalValue = digitalRead(button);
 
 if (digitalValue == 1) {
    Particle.publish("on3");
    delay(5000);
  }  else{
    analogWrite(led1, LOW);
    delay(500);
    analogWrite(led2, LOW);
    delay(500);
    analogWrite(led3, LOW);
    delay(500);
    analogWrite(led7, LOW);
    delay(500);
 }
 
}
int function(const char *on, const char *data){
    analogWrite(led1, HIGH);
    delay(500);
    analogWrite(led1, LOW);
    analogWrite(led2, HIGH);
    delay(500);
    analogWrite(led2, LOW);
    analogWrite(led3, HIGH);
    delay(500);
    analogWrite(led3, LOW);
    analogWrite(led7, HIGH);
    delay(500);
    analogWrite(led7, LOW);
    delay(500);

}

Credits

David Conlin

David Conlin

1 project • 1 follower
UNCC Mechanical Engineering MEGR 3171

Comments