Before creating the topic
- Search forum for similar topics
- Check http://docs.blynk.cc and http://help.blynk.cc/
- Add details :
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
• Smartphone OS (iOS or Android) + version
• Blynk server or local server
• Blynk Library version
• Add your sketch code.Code should be formatted as example below.
Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.
#include "HX711.h"
HX711 scale(3, 2); //HX711 scale(6, 5);
float calibration_factor = -91.5;
float units;
float ounces;
void setup()
{
Serial.begin(9600);
Serial.println("HX711 weighing");
scale.set_scale(calibration_factor);
scale.tare();
Serial.println("Readings:");
}
void loop()
{
Serial.print("Reading:");
units = scale.get_units(),10;
if (units < 0)
{
units = 0.00;
}
ounces = units * 0.035274 ;
Serial.print(units);
Serial.println(" grams");
Blynk.virtualWrite(V6, gram);
delay(1000);
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define TRIGGER 8
#define ECHO 9
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "527c917fa6a143d88dbc2e3d8fce392d";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Virus";
char pass[] = "billa3006";
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(11,10); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);
void setup()
{
// Debug console
Serial.begin(9600);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
pinMode(TRIGGER, OUTPUT);
pinMode(ECHO, INPUT);
}
void loop()
{
Blynk.run();
long duration, distance;
digitalWrite(TRIGGER, LOW);
delayMicroseconds(2);
digitalWrite(TRIGGER, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGGER, LOW);
duration = pulseIn(ECHO, HIGH);
distance = (duration/2) / 29.1;
if (distance <= 150) {
Blynk.virtualWrite(V0, 255);
}
else {
Blynk.virtualWrite(V0, 0);
}
if (distance <= 100) {
Blynk.virtualWrite(V1, 255);
}
else {
Blynk.virtualWrite(V1, 0);
}
if (distance <= 80) {
Blynk.virtualWrite(V2, 255);
}
else {
Blynk.virtualWrite(V2, 0);
}
if (distance <= 40) {
Blynk.virtualWrite(V3, 255);
}
else {
Blynk.virtualWrite(V3, 0);
}
if (distance <= 20) {
Blynk.virtualWrite(V4, 255);
}
else {
Blynk.virtualWrite(V4, 0);
}
Serial.print(distance);
Serial.println("Centimeter:");
Blynk.virtualWrite(V5, distance);
delay(200);
Blynk.run();
}