BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Please help me!

i have a code blynk with my project but teacher of me want to convert this code to freertos. I was attempted to multiple but failed. please help me ! thank so much everyone !

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "0c445a273df34fe49da99bb9d4f65bab";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Vnpt";
char pass[] = "11115555";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

#define DHTPIN 7          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}



void setup()
{
  // Debug console
  Serial.begin(9600);

  delay(10);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
  dht.begin();
  timer.setInterval(1000L, sendSensor);


 }

void loop()
{
  Blynk.run();
  timer.run();
  
  }

Oh where to start :stuck_out_tongue:

First… read the community polices… particularly the parts about how to search before asking, and how to properly format any code you post here (I have fixed that part for you)

As for your needs… Sorry, but we can NOT convert your code for you, or really help you convert it. We do NOT do your schoolwork for you. We really do not even teach programming… That is all up to you.

We are here to help you learn about Blynk by providing guidance to the relevant documentation and assistance with understanding commands and processes as you progress.

If you want to learn how to use Blynk, then let us know, otherwise you are on your own for your teachers requests.

1 Like

thank you ! i will remember !