/* Comment this out to disable prints and save space */#define BLYNK_PRINT Serial#include #include byte inByte[] = {0x00, 0x00};// You should get Auth Token in the Blynk App.// Go to the Project Settings (nut icon).char auth[] = "*********";//inkomende dataString inData = "";//LEDSint ledGroen = 16;int ledGeel = 14;int ledRood = 12;// Your WiFi credentials.// Set password to "" for open networks.char ssid[] = "*******";char pass[] = "*******";void setup() {  pinMode(ledGroen, OUTPUT);  pinMode(ledGeel, OUTPUT);  pinMode(ledRood, OUTPUT);  // Debug console  Serial.begin(1200, SERIAL_8N2);  Blynk.begin(auth, ssid, pass);  while (!Blynk.connected())   {    digitalWrite(ledGeel, HIGH);    delay(500);    digitalWrite(ledGeel, LOW);    delay(500);  }  if (Blynk.connected())   {    digitalWrite(ledGeel, LOW);    digitalWrite(ledRood, LOW);    digitalWrite(ledGroen, HIGH);  } else {    digitalWrite(ledRood, HIGH);    digitalWrite(ledGroen, LOW);    digitalWrite(ledGeel, LOW);  }  // You can also specify server:  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);}void loop() {  Blynk.run();}//Zet de kachel aan of uitBLYNK_WRITE(V1) {}//Lees de ingestelde kracht van de kachelBLYNK_WRITE(V2) {  // lees de huidige status  int huidigeStatus = 99;  huidigeStatus = readStatus();  String huidgeStatusString = "Fout";  switch (huidigeStatus) {    case 0:      huidgeStatusString = "De kachel staat uit";      break;    case 1:      huidgeStatusString = "De kachel start";      break;    case 2:      huidgeStatusString = "Pellets worden geladen";      break;    case 3:      huidgeStatusString = "Ontsteking gestart";      break;    case 4:      huidgeStatusString = "De kachel is werkende";      break;    case 5:      huidgeStatusString = "Cleaning";      break;    case 6:      huidgeStatusString = "onduidelijke status";      break;    case 7:      huidgeStatusString = "cleaning final";      break;    default:      huidgeStatusString = "onduidelijke status";      break;  }  Blynk.virtualWrite(V30, huidgeStatusString);  Blynk.virtualWrite(V31, readStatus());  delay(1000);}//Lees de current kracht van de kachelBLYNK_WRITE(V3) {  Blynk.virtualWrite(V30, "Test 0");  delay(1000);  Blynk.virtualWrite(V30, readSetPower());  delay(1000);}//Stel de kracht van de kachel inBLYNK_WRITE(V4) {  // receive the step value as param.asInt() and then use switch to run different code  setPower1(param.asInt());}BLYNK_WRITE(V30) {}void setStatus() {  //kachel aan: zet uit  //kachel uit: zet aan  //andere status: zet uit  /*    if getCurrentStatus == UIT -> zet aan ...ELSE -> zet uit  */}void setPower1(int i) {  switch (i) {    case 1:      {        //Zet kachel op stand 1        byte message1A[] = {0x80, 0x37, 0x19, 0xd0};        byte message1B[] = {0x00, 0x60, 0x19, 0x19};        Blynk.virtualWrite(V2, 1);        Serial.write(message1A, sizeof(message1A));        delay(200);        Serial.write(message1B, sizeof(message1B));        delay(200);      }      break;    case 2:      {        //Zet kachel op stand 2        byte message2A[] = {0x80, 0x37, 0x1a, 0xd1};        byte message2B[] = {0x00, 0x60, 0x1a, 0x1a};        Blynk.virtualWrite(V2, 2);        Serial.write(message2A, sizeof(message2A));        delay(200);        Serial.write(message2B, sizeof(message2B));        delay(200);      }      break;    case 3:      {        //Zet kachel op stand 3        byte message3A[] = {0x80, 0x37, 0x1b, 0xd2};        byte message3B[] = {0x00, 0x60, 0x1b, 0x1b};        Blynk.virtualWrite(V2, 3);        Serial.write(message3A, sizeof(message3A));        delay(200);        Serial.write(message3B, sizeof(message3B));        delay(200);      }      break;    case 4:      {        //Zet kachel op stand 4        byte message4A[] = {0x80, 0x37, 0x1c, 0xd3};        byte message4B[] = {0x00, 0x60, 0x1c, 0x1c};        Blynk.virtualWrite(V2, 4);        Serial.write(message4A, sizeof(message4A));        delay(200);        Serial.write(message4B, sizeof(message4B));        delay(200);      }      break;  }}int readSetPower() {  byte message1B[] = {0x00, 0x37};  Serial.write(message1B, sizeof(message1B));    while (!Serial.available());Blynk.virtualWrite(V30, "na While");    delay(200);        if (Serial.available() > 1) {      Blynk.virtualWrite(V30, "in IF");      delay(600);    int currentPower = 98;    // get incoming byte:    for (int i = 0; i < 2 ; i++) {      inByte[i] = Serial.read();    }    Blynk.virtualWrite(V30, "Test1");    delay(1000);    Blynk.virtualWrite(V30, inByte[0]);    delay(1000);    Blynk.virtualWrite(V30, "Test2");    delay(1000);    Blynk.virtualWrite(V30, inByte[1]);    delay(1000);        currentPower = inByte[1];    return currentPower;  }}int readStatus() {  byte message1B[] = {0x00, 0x21};  Serial.write(message1B, sizeof(message1B));  //Serial.println("Verzonden");  delay(200);  if (Serial.available() > 1) {    int currentStatus = 99;    // get incoming byte:    for (int i = 0; i < 2 ; i++) {      Serial.print("Gelezen: ");      Serial.println(Serial.peek());      inByte[i] = Serial.read();    }    currentStatus = inByte[1];    return currentStatus + 1;  }}int readCurrentWaterTemp() {}int readSetWaterTemp() {}void setWaterTemp(int i){}