Arduino “having11” Guy
Published © GPL3+

Introduction to Particle Mesh

Use Particle Mesh boards to collect data from all over a house. The data is then aggregated into the Particle Cloud.

EasyFull instructions provided2 hours258
Introduction to Particle Mesh

Things used in this project

Hardware components

Argon
Particle Argon
×1
Xenon
Particle Xenon
×2
Elegoo 37 in 1 Sensor Kit v2
×1

Software apps and online services

Particle Online IDE

Story

Read more

Schematics

Networked Circuits

Dsc 9005 sv6xofwfxd

Code

Mesh Argon

C/C++
void distance_handler(const char *event, const char *data){
    String new_data = String(data);
    int data_int = new_data.toInt();
    if(data_int < 5){
        digitalWrite(D2,1);
        digitalWrite(D3,0);   
    }
    else{
        digitalWrite(D2,0);
        digitalWrite(D3,1);   
    }
}

void setup() {
    pinMode(D2,OUTPUT); //Red
    pinMode(D3,OUTPUT); //Green
    Mesh.subscribe("distance",distance_handler);
    digitalWrite(D2,0);
    digitalWrite(D3,1);
}

void loop() {
    
}

Mesh Xenon 1

C/C++
void setup() {
    pinMode(3,OUTPUT);
    pinMode(2,INPUT);
}

void loop() {
    ping();
    delay(100);
}

void ping(){
    long duration, distance;
    digitalWrite(3,LOW);
    delayMicroseconds(2);
    digitalWrite(3,HIGH);
    delayMicroseconds(10);
    digitalWrite(3,LOW);
    duration = pulseIn(2,HIGH);
    distance = (duration/2) / 29.1;
    Mesh.publish("distance",String(distance));
    //Particle.publish("distance",String(distance));
}

Mesh Xenon 2

C/C++
void handler(const char *event, const char *data){
    analogWrite(2,(String(data).toInt())*30);
}

void setup() {
    pinMode(2,OUTPUT);
    Mesh.subscribe("distance",handler);
}

void loop() {
    
}

Credits

Arduino “having11” Guy

Arduino “having11” Guy

34 projects • 233 followers
IoT, Arduino, and Raspberry Pi. I can create designs, code, and build projects for only $22/hr. Just message me with your project request.

Comments

Add projectSign up / Login