Как программировать кодирование Arduino с помощью приложений Blynk

Теперь я пытаюсь подключить Arduino uno+ESP 8266+Apps Blynk... и теперь я уже сделал программирование для части Arduino, но затем я пытаюсь связать Arduino с помощью esp 8266 с приложениями Blynk... Я просто хочу приложения Blynk отображают мой результат в приложениях Blynk... результат, который я хочу отобразить, - это датчик pH, датчик уровня воды, измеритель TDS,DHT11

вывод для всех датчиков уже был сделан, осталось только как подключить и как поставить кодировку этой кодировки в приложениях blynk

int sensorPin = A1;// input pin A1 for the water level sensor module
int sensorValue = 0;
int solenoidinPin = 4;// select the pin for the solenoid valve in
int solenoidoutPin = 5;// select the pin for the solenoid valveout
int dosingPumpAc = 11;// select the pin for the dosing pump high
int dosingPumpAl = 12;// select the pin for the dosing pump low
int speakerPin = 9;// select the pin for the buzzer

#define SensorPin A0// the pH meter Analog output is connected with the Arduino’s Analog 
unsigned long int avgValue;  //Store the average value of the sensor feedback
float b;
float phValue;
int buf[10],temp;

#include <dht11.h>           // Libary DHT 11 sensor
#define DHT11PIN A2          // the pH meter Analog output is connected with the Arduino’s Analog 

dht11 DHT11;

void setup() {

Serial.begin(9600);// initialize serial communications at 9600 bps

pinMode(sensorPin, INPUT);       // declare the sensorPin as an INPUT (WATER LEVEL )
pinMode(solenoidinPin,OUTPUT);   // declare the solenoiindPin as an OUTPUT (WATER LEVEL )
pinMode(solenoidoutPin,OUTPUT);  // declare the solenoidoutPin as an OUTPUT (WATER LEVEL )
pinMode(speakerPin, OUTPUT);     // declare the speakerPin as an OUTPUT (WATER LEVEL )

pinMode(dosingPumpAc, OUTPUT);   // declare the dosing pump high as an OUTPUT (Ph)
pinMode(dosingPumpAl, OUTPUT);   // declare the dosing pump low as an OUTPUT (Ph)
}
void loop() {

///////////////////////////////////////// Water Level    ////////////////////////////////////////

sensorValue = analogRead(sensorPin); // read the value from the sensor  // send the message about water level to serial monitor

 if (sensorValue <= 0) {
 Serial.println("Water level: 50mm - Low water level");
 digitalWrite(speakerPin, LOW);     // turn the speaker off
 digitalWrite(solenoidoutPin, LOW); // turn the solenoid valve outlet off
 digitalWrite(solenoidinPin, HIGH); // turn the solenoid valve inlet on

 }
 else if (sensorValue > 0 && sensorValue <= 223) { 

 digitalWrite(speakerPin, LOW);     // turn the speaker off
 digitalWrite(solenoidoutPin, LOW); // turn the solenoid valve outlet off
 digitalWrite(solenoidinPin, LOW); // turn the solenoid valve inlet on

 }
 else if (sensorValue > 323) {
Serial.println("Water lvl: 220mm - Warning ! Water high level");
digitalWrite(speakerPin, HIGH);     // turn the speaker on
digitalWrite(solenoidoutPin,HIGH);  // turn the solenoid valve outlet on
digitalWrite(solenoidinPin, LOW);   // turn the solenoid valve inlet off

 }

////////////////////////////////////////// Ph Sensor ////////////////////////////////////////
for(int i=0;i<10;i++)       //Get 10 sample value from the sensor for smooth the value
for(int i=0;i<9;i++)        //sort the analog from small to large
{
for(int j=i+1;j<10;j++)
{
  if(buf[i]>buf[j])
  {
    temp=buf[i];
    buf[i]=buf[j];
    buf[j]=temp;
  }
}
 }

 avgValue=0;
for(int i=2;i<8;i++)                      //take the average value of 6 center sample
avgValue+=buf[i];
float phValue=(float)avgValue*5.0/1024/6; //convert the analog into millivolt
phValue=3.5*phValue;                      //convert the millivolt into pH value
Serial.print("    pH:");  
Serial.print(phValue,2);
Serial.println(" ");

if(phValue<6)                             //Ph value below 5                       
{
digitalWrite(dosingPumpAc,LOW);        // turn off dosing pump for Alcali
digitalWrite(dosingPumpAl,HIGH);       // turn on dosing pump for Acid
}

else if(phValue>6 && phValue <6.5)          //Ph value between 6 and 7
{
digitalWrite(dosingPumpAc,LOW);        // turn off dosing pump for Alcali
digitalWrite(dosingPumpAl,LOW);        // turn off dosing pump for Acid
}
 else if(phValue>6.5)                        //Ph value above 7  
 {
 digitalWrite(dosingPumpAc,HIGH);       // turn on dosing pump for Alcali
 digitalWrite(dosingPumpAl,LOW);        // turn off dosing pump for Acid
 }
////////////////////////////////////////// DHT 11    ////////////////////////////////////////
Serial.println();
int chk = DHT11.read(DHT11PIN);

Serial.print("Humidity (%): ");
Serial.println((float)DHT11.humidity, 2);
Serial.print("Temperature (C): ");
Serial.println((float)DHT11.temperature, 2);
delay(1000);  // delay 1 second
}

для этой кодировки я уже сделал датчик pH, датчик уровня воды,DHT11

0 ответов

Другие вопросы по тегам