Hi, Im really newbie to this Blynk and IoT industry. I need help to figure out a solution for my project.
About my project
Im doing a smart neck support for my final year degree project. so here im using tilt sensor to detect humans neck extension and alert them using buzzer. My progress for this project is I have managed to do all circuit connection.
Problem
My problem is now how to make Blynk to record the count of neck extension. Whenever the person extend their neck posture the count should increase. and Im dont know how to code for this.
Please help me with this. Please correct me if there is any mistake in the code.
code
#define BLYNK_TEMPLATE_ID "TMPL98FVyW-b"
#define BLYNK_DEVICE_NAME "SMART NECK SUPPORT"
#define BLYNK_AUTH_TOKEN "8Laj1DCzlu6X7De8IN4peS-s6Hy6nvwu"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define EXTENSION D2
#define LED D8
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "HUAWEI nova 5T";
char pass[] = "gnasegaran";
int extension_count = 0;
void setup()
{
Serial.begin(9600);
pinMode(EXTENSION, INPUT);
pinMode(LED,OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
int EXTENSION_SENSED = digitalRead(EXTENSION);
if( EXTENSION_SENSED ==HIGH)
{
digitalWrite(LED,HIGH);
Serial.println("EXTENSION COUNT");
extension_count++;
}else{
digitalWrite(LED,LOW);
}
delay(1000);
}