1

I have a problem in sending numbers from blynk terminal to arduino serial monitor. When I send any number from blynk terminal the arduino always getting 1. How can I get any number please help me. Thank you.

Here's my code

BLYNK_WRITE(V0){
  int pinValue = param.asInt(); // Int Value
  String i = param.asStr(); //String Value
  Serial.println(pinValue);
 
 if(i == "A"){
      Serial.println("Ready to enroll a fingerprint!");
      Serial.println("Please type in the ID # (from 1 to 127) you want to delete...");
      
      Blynk.virtualWrite(V0, "Ready to enroll a fingerprint!");
      Blynk.virtualWrite(V0, "Please type in the ID # (from 1 to 127) you want to save this finger 
      as..."); 

      uint8_t num = 0;
        
        while (num == 0) {
          while (! Serial.available());
          num = Serial.parseInt();
        }
      Serial.print("Enrolling ID #");
      Serial.print(num);
 }
}

The value output of num is always 1 even I sent a different number.

4
  • the number is sent as string. so use param.asStr(), then convert it to number
    – Juraj
    Commented Sep 25, 2020 at 7:22
  • I already know that, but the actual problem was any value that was sent to arduino serial monitor becomes 1
    – Time Gold
    Commented Sep 25, 2020 at 10:09
  • how do you know?. you don't print it. you print the int value
    – Juraj
    Commented Sep 25, 2020 at 10:52
  • 1
    I tried it earlier, the value always get 1. please help
    – Time Gold
    Commented Sep 25, 2020 at 13:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.