WW47
Created March 26, 2017

Dusty atmosphere alarm

Chinese yellow dust is very bad for our health. This device gives you head up on atmosphere status before you go out.

95
Dusty atmosphere alarm

Things used in this project

Hardware components

Arduino 101
Arduino 101
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic is here

see the attached.

Code

The Code

Arduino
//#define BLYNK_USE_DIRECT_CONNECT

#define BLYNK_PRINT Serial

#include <BlynkSimpleCurieBLE.h>
#include <CurieBLE.h>
#include <Servo.h>

// You should get Auth Token in the Blynk App.

char auth[] = "YourAuthToken";

BLEPeripheral  blePeripheral;

int led = 13;

int reading1;


Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
WidgetLED led1(V5);

WidgetLED led6(V10);
WidgetLED led7(V11);
WidgetLED led8(V12);

BLYNK_WRITE(V1)
{
  reading1 = param.asInt();
}
BLYNK_WRITE(V2)
{
  reading2 = param.asInt();
}
BLYNK_WRITE(V3)


void setup() {
  Serial.begin(9600);
    pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);

  servo1.attach(3);
  servo2.attach(5);
  servo3.attach(6);
  servo4.attach(9);
  
  delay(1000);

  blePeripheral.setLocalName("k");
  blePeripheral.setDeviceName("k");



}

void loop() {
 
  if (reading1 == LOW) {
    servo1.write(92);
    led1.on();
    led5.off();
  } else {
    servo1.write(70);
    led1.off();
    led5.on();
  }
  if (reading2 == LOW) {
    servo2.write(90);
    led2.on();
    led6.off();
  } else {
    servo2.write(74);
    led2.off();

    led8.on();
  }

   Blynk.run();
  blePeripheral.poll();
}

Credits

WW47

WW47

1 project • 0 followers

Comments