• 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