thank you for your replay!
i dont think your code will help because i want him to enter some loop with the terminal and then enter new data…
my entire code:
`/**************************************************************
- This example runs directly on ESP8266 chip.
-
- You need to install this for ESP8266 development:
- https://github.com/esp8266/Arduino
-
- Please be sure to select hte right ESP8266 module
- in the Tools -> Board menu!
-
- Change WiFi ssid, pass, and Blynk auth token to run
-
**************************************************************/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “xxxxxxxxxxxxxxxxx”;
int led = 13;
int state = 0;
int past_state = 1;
String mypassword = “0000”;
uint16_t node_address = 02;
String tmp = “7”;
String tmp1 = “9”;
// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(V1);
void setup()
{
pinMode(led,OUTPUT);
digitalWrite(led,HIGH);
delay(2000);
digitalWrite(led,LOW);
Serial.begin(9600);
Blynk.begin(auth, “shtainer”, “yoav1234”);
while (Blynk.connect() == false) {
// Wait until connected
}
// This will print Blynk Software version to the Terminal Widget when
// your hardware gets connected to Blynk Server
terminal.println(F(“Blynk v” BLYNK_VERSION “: Device started”));
terminal.println("-------------");
//terminal.println(“Type ‘Marco’ and get a reply, or type”);
//terminal.println(“anything else and get it printed back.”);
terminal.flush();
}
// You can send commands from Terminal to your hardware. Just use
// the same Virtual Pin as your Terminal Widget
BLYNK_WRITE(V1)
{
// // if you type “Marco” into Terminal Widget - it will respond: “Polo:”
// if (String(“Marco”) == param.asStr()) {
// terminal.println(“You said: ‘Marco’”) ;
// terminal.println(“I said: ‘Polo’”) ;
// } else {
//
// // Send it back
// terminal.print(“You said:”);
// terminal.write(param.getBuffer(), param.getLength());
// terminal.println();
// }
if(mypassword == param.asStr())
{
mypassword="";
char c;
for(int i=0;i<8;i++)
{
c = char(random(120));
mypassword+=c;
}
terminal.println("my new password is: "+mypassword);
Serial.println("my new password is: "+mypassword);
}
if(String(“node”) == param.asStr()){
terminal.println("please enter my new node_address: ");
delay(5000);
// Ensure everything is sent
terminal.flush();
tmp1 = param.asStr();
Serial.println(“my tmp1:”);
Serial.println(tmp1);
node_address = (uint16_t) tmp1.toInt();
Serial.println(“my node_address:”);
Serial.println(node_address);
}
// Ensure everything is sent
terminal.flush();
}
void loop()
{
Blynk.run();
state = digitalRead(led);
if(mypassword==“0000”){
terminal.println("please enter my password: ");delay(500);}
if(state!=past_state)
{
if(state==1)
Serial.println(“1”);
else
Serial.println(“0”);
past_state = state;
}
}
`