Terminal Display Widget Problem or my coding on NodeMCU

• Hardware model + communication type : Dummy Vending Machine Controller ( Keypad, arduino, 7 segment led display) and NodeMCU
• Smartphone OS (iOS or Android) + version : Samsung galaxy s9+
• Widget on blynk : terminal

#define BLYNK_PRINT Serial

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

int pinState = 0;
//#include <ESP8266WiFi.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "***";
char ssid[] = "levi";
char pass[] = "*****";

int inPin1 = D0;    // connected to digital pin D0
int val1 = 0;      // variable to store the read value
 
int inPin2 = D1;    // 
int val2 = 0;      // 

int inPin3 = D2;    // 
int val3 = 0;      // 

int inPin4 = D3;    // 
int val4 = 0;      // 
 
int inPin5 = D4;    // 
int val5 = 0;      // 

int inPin6 = D5;
int val6 = 0;      // 

int inPin7 = D6;    // 
int val7 = 0;      // 

// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(V1);

// You can send commands from Terminal to your hardware. Just use
// the same Virtual Pin as your Terminal Widget
BLYNK_WRITE(V1)
{

  if (digitalRead(inPin1) == LOW && digitalRead(inPin2) == LOW && digitalRead(inPin3) == LOW && digitalRead(inPin4) == LOW && digitalRead(inPin5) == LOW && digitalRead(inPin6)== LOW && digitalRead(inPin7) == LOW)
  
  {
    terminal.println("led number : 8") ;
  } 
  else if (digitalRead(inPin1) == LOW && digitalRead(inPin2) == LOW && digitalRead(inPin3) == HIGH && digitalRead(inPin4) == LOW && digitalRead(inPin5) == LOW && digitalRead(inPin6)== LOW && digitalRead(inPin7) == LOW)
  {
    // Send it back
    terminal.print("led number : 0");
    //terminal.write(param.getBuffer(), param.getLength());
    terminal.println();
  }
  else 
  {
    // Send it back
    terminal.print("press keypad");
    //terminal.write(param.getBuffer(), param.getLength());
    terminal.println();
  }
  // Ensure everything is sent
  terminal.flush();
}

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

  pinMode(inPin1, INPUT);
  pinMode(inPin2, INPUT);  
  pinMode(inPin3, INPUT);  
  pinMode(inPin4, INPUT);   
  pinMode(inPin5, INPUT);  
  pinMode(inPin6, INPUT);
  pinMode(inPin7, INPUT);  
  // Clear the terminal content
  terminal.clear();

  
  // 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(F("-------------"));
  terminal.println(F("Press the keypad"));
  terminal.flush();
}

void loop()
{
  Blynk.run();
}`Preformatted text`

I do not have any error in compiling, but my project is supposed to be, when I press my keypad, the number will be displayed on the 7 segment display and the terminal widget on my Blynk app will display the same number displayed on my 7 segment display.

But with this coding, nothing pops up on the terminal widget screen on my blynk app.
Please help me :sob: :sob:

Well, first of all I don’t see an Ethernet adapter anywhere in your photo, or in your description.

Secondly, what is the purpose of having two MCU’s in this project (the Uno and the NodeMCU)?

Thirdly, which MCU is this code being uploaded to?

Where have you dreamt-up this Blynk.begin syntax from?
The correct syntax is:

  Blynk.begin(auth, ssid, pass);

What do you see in the serial monitor of whichever MCU you are uploading this code to?

Pete.

helo pete,

thank you for replying.
I used both
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
because it was in the examples for codings on blynk using terminal when you go to https://examples.blynk.cc/

I used two MCU as my project is making an iot monitoring for vending machines (where you could check the stocks of vending machines from your phone through the Blnyk app), therefore the arduino uno is for the replica of the real vending machine controller which I dont have, that’s why i made a dummy vmc.

The code is being uploaded to NodeMCU.

I actually used this

Blynk.begin(auth, ssid, pass);

at first, but the error

invalid conversion from 'char’ to ‘uint16_t {aka short unsigned int}’ [-fpermissive] arduino ide*

kept showing, but when I seperated it into 3, it can compile.

The errors shown on my serial monitor are “[368] DHCP Failed!” but when I pressed the keypad, weird numbers mixed with letters kept showing up in the terminal widget of blynk

I’m sorry for being very poor at all these coding but I have to get through this to pass my semester :sob:

yasmin,

The Sketch Builder that you linked to allows you to choose many different board types and connection types, depending on your hardware you are using. As you are looking for a sketch to upload to your NodeMCU…

Then that is the board type you should choose. You then have two connection methods:
ESP8266 WIFI
ESP8266WIFI(SSL)

Depending on which connection method you choose (and you should choose ESP8266 WIFI) then the included Blynk library files are ESP8266WiFi.h and either BlynkSimpleEsp8266.h or BlynkSimpleEsp8266_SSL.h

The compilation errors that you are seeing are because you are trying to pass WiFi credentials to the Ethernet library. Obviously WiFi SSID and Password mean nothing when connecting via a wired Ethernet connection.

Use the correct libraries for your connection method and the correct connection syntax for those libraries and you’'ll be one step closer to getting this to work.

Pete.