Can I write value to the pin through Widget Terminal

Can I write value to the pin through Widget Terminal

What exactly are you trying to achieve?
Perhaps something like this …

WidgetTerminal terminal(V1);


BLYNK_WRITE(V1){

if (String("value") == param.asStr()) {
 \\Do something
}

I presume the OP means this:

WidgetTerminal terminal(V1);

BLYNK_WRITE(V1){
 Blynk.virtualWrite(pin, param.asInt())
}

I want to type a word or number in the terminal to be saved in EEPROM

Thank you problem has been solved

What was your solution?

Read and Write blynk to eeprom

It’s blynk magic

i love blynk


#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <EEPROM.h>



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

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

WidgetTerminal terminal(V1);

  char Command[12]=" ";
  char Menu_1[12]=" ";
 
  bool TEXT = false; 



#define EEPROM_SALT 12664
typedef struct {
  char  textVal[9]  = "No Text";
}

WMSettings;
WMSettings text;




void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);






  EEPROM.begin(512);
  EEPROM.get(0, text);
  EEPROM.end();


}

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








BLYNK_WRITE(V1)
{
  int j=0;


  strcpy(Command,param.asStr()); 
  for(int i = 0; Command[i]; i++){
  Command[i] = tolower(Command[i]);
  }


 
  if ((String("new text") == Command)) {
         terminal.println("Enter New Text\n ");
         j=1;
         strcpy(Menu_1,Command);
         terminal.flush();
         TEXT = true; 


    } 
    if  ((!j) && TEXT == true)  {
         terminal.print("Save New text ");
         terminal.println(Command);
         strcpy(text.textVal, Command);  
          Save();
         j=1;
         strcpy(Menu_1,Command);
         terminal.flush();
         TEXT = false; 
   }
 

  if ((String("my text") == Command)) {
         terminal.print("your text : ");
         terminal.println(text.textVal);
         j=1;
         strcpy(Menu_1,Command);
         terminal.flush();


    } 

    
else if (!j)
{terminal.println("\nInvalid command");
       terminal.flush();
         TEXT = false; 
  
}  
    
}   
    


void Save(){

    EEPROM.begin(512);
    EEPROM.put(0, text);
    EEPROM.commit();
    EEPROM.end();

  

}




1 Like