Easton KimLee MeltonCarter Hedrick
Published

SOS Flasher on Particle Argon

The purpose of this project is to create a simple communication network between three particle Argon systems that flashes SOS in Morse code.

BeginnerWork in progress38
SOS Flasher on Particle Argon

Things used in this project

Hardware components

Argon
Particle Argon
×3
ELEGOO 37-in-1 Sensor Module Kit V1.0
ELEGOO 37-in-1 Sensor Module Kit V1.0
×3
Breadboard (generic)
Breadboard (generic)
×3
Resistor 220 ohm
Resistor 220 ohm
×3

Story

Read more

Schematics

Schematic of Circuit Layout

Code

Two Way Communication Between Multiple Devices Broadcasting SOS

C/C++
This is the code used to broadcast the SOS signal between multiple devices to convey distress from one individual device. As many devices can be connected as desired, there is no limit to the number of devices that can be connected.
int led1 = D7;
int led2 = A0;
int button = A1;
int count1 = 0;

void setup() {
    
  pinMode(led2, OUTPUT);
  pinMode(led1, OUTPUT);
  pinMode(button, INPUT);
  Particle.subscribe("S.O.S.", SOS, MY_DEVICES);
  }

void SOS(const char *event, const char *data) {
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(500);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(750);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(750);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(750);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(500);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
}

void loop() {
    int stateButton = digitalRead(button); //read the state of the button
    if(stateButton == 0) 
    {
    count1++;
    }
    else
    {}

        if(count1>1)
                { 
                    Particle.publish("S.O.S.","Help!", PRIVATE);
                    
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(500);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(750);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(750);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(750);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(500);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    delay(250);
                    digitalWrite(led1,HIGH);
                    digitalWrite(led2,HIGH);
                    delay(250);
                    digitalWrite(led1,LOW);
                    digitalWrite(led2,LOW);
                    
                    count1++;
                }
            else
            {}
        
        if(count1 > 3)
                {
                    count1 =0;
                }
            else
            {}

delay(500);
}

Credits

Easton Kim

Easton Kim

1 project • 1 follower
Lee Melton

Lee Melton

1 project • 1 follower
Carter Hedrick

Carter Hedrick

1 project • 1 follower

Comments

Add projectSign up / Login