Need help with amazon echo esp8266 control with natural speech commands

Hi how are you!
I can’t compile the esp8266 code, I’m having an error.
Would you help me?

What’s the error?

Thank you for your attention, this error below.

Arduino: 1.8.4 (Windows 10), Placa:“NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”

C:\Users\lucia\OneDrive\Documentos\Arduino\ESP_Portao\ESP_Portao.ino:23:32: fatal error: BlynkSimpleEsp8266.h: No such file or directory

#include <BlynkSimpleEsp8266.h>

                            ^

compilation terminated.

Foram encontradas múltiplas bibliotecas para “ArduinoOTA.h”
Usado: C:\Users\lucia\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ArduinoOTA
Não usado: C:\Users\lucia\OneDrive\Documentos\Arduino\libraries\ArduinoOTA
exit status 1
Erro compilando para a placa NodeMCU 1.0 (ESP-12E Module)

Este relatório teria mais informações com
“Mostrar a saida detalhada durante a compilação”
opção pode ser ativada em “Arquivo → Preferências”

Have you installed the Blynk library?

Pete.

Always a solid start. :slight_smile:

1 Like

Thank you very much, Pete! you are always helping me.

I went after this code because I’m trying to include RFID 522 with Alexa commanding the button, to open my gate with voice command.
I already have the Blynk code controlling RFID 522 at the gate, I need to include the Alexa code, can you help me?

I’m afraid not. I use Alexa and Blynk with Node-Red and MQTT to do that sort of stuff.

Pete.

I went after this code because I’m trying to include RFID 522 with Alexa commanding the button, to open my gate with voice command.
I already have the Blynk code controlling RFID 522 at the gate, I need to include the Alexa code, can you help me?

I need to control only the button by voice command, not the card.

I don’t understand what that means.

Pete.

Possibly. Let me ask a few questions…

  1. Are you using the most recent version (scroll to my August of 2018 post)?
  2. Are trying to compile my code as-is, or with modifications?
  3. If it’s not modified, do you have all of the necessary libraries installed?
  4. If it is modified, you’re going to have to post the code.

I didn’t modify your code, I managed to compile it.
But I need Alexa Amazon to control the button for this code below.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SPI.h>
#include <MFRC522.h>
#include <EEPROM.h>

#define SS_PIN D8
#define RST_PIN D4
#define BTN_PIN D1
#define SLN_PIN D2

MFRC522 mfrc522(SS_PIN, RST_PIN);
unsigned long uidDec, uidDecTemp;
int ARRAYindexUIDcard;
int EEPROMstartAddr;
long adminID = 1122539531;
bool beginCard = 0;
bool addCard = 1;
bool skipCard = 0;
int LockSwitch;
unsigned long CardUIDeEPROMread[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int PiezoPin = D3;

char auth[] = "Token";
char ssid[] = "ssid";
char pass[] = "passw0rd";

WidgetLCD lcd(V0);

void setup() {
  Serial.begin(115200);
  pinMode(SLN_PIN, OUTPUT); digitalWrite(SLN_PIN, LOW);
  pinMode(BTN_PIN, INPUT_PULLUP);
  pinMode(PiezoPin, OUTPUT);

  SPI.begin();
  mfrc522.PCD_Init();

  Blynk.begin(auth, ssid, pass);
  lcd.clear(); //Use it to clear the LCD Widget
  EEPROM.begin(512);
  DisplayWAiT_CARD();
  EEPROMreadUIDcard();

  digitalWrite(PiezoPin, HIGH), delay(100), digitalWrite(PiezoPin, LOW);

}

void loop() {

  digitalWrite(SLN_PIN, LOW);

  if (digitalRead(BTN_PIN) == LOW) {
    digitalWrite(SLN_PIN, HIGH); //unlock
    lcd.print(0, 0, " BUTTON UNLOCK ");
    lcd.print(0, 1, "   DOOR OPEN   ");
    digitalWrite(PiezoPin, HIGH), delay(200), digitalWrite(PiezoPin, LOW);
    delay(2000);
    DisplayWAiT_CARD();
  }

  if (beginCard == 0) {
    if ( ! mfrc522.PICC_IsNewCardPresent()) {  //Look for new cards.
      Blynk.run();
      return;
    }

    if ( ! mfrc522.PICC_ReadCardSerial()) {  //Select one of the cards.
      Blynk.run();
      return;
    }
  }

  //Read "UID".
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    uidDecTemp = mfrc522.uid.uidByte[i];
    uidDec = uidDec * 256 + uidDecTemp;
  }

  if (beginCard == 1 || LockSwitch > 0)EEPROMwriteUIDcard();  //uidDec == adminID

  if (LockSwitch == 0) {
    //CardUIDeEPROMread.
    for (ARRAYindexUIDcard = 0; ARRAYindexUIDcard <= 9; ARRAYindexUIDcard++) {
      if (CardUIDeEPROMread[ARRAYindexUIDcard] > 0) {
        if (CardUIDeEPROMread[ARRAYindexUIDcard] == uidDec) {
          lcd.print(0, 0, "CARD ACCESS OPEN");
          lcd.print(3, 1, uidDec);
          digitalWrite(SLN_PIN, HIGH); //unlock
          digitalWrite(PiezoPin, HIGH), delay(200), digitalWrite(PiezoPin, LOW);
          delay(2000);
          break;
        }
      }
    }

    if (ARRAYindexUIDcard == 10) {
      lcd.print(0, 0, " Card not Found ");
      lcd.print(0, 1, "                ");
      lcd.print(0, 1, "ID : ");
      lcd.print(5, 1, uidDec);
      for (int i = 0; i <= 2; i++)delay(100), digitalWrite(PiezoPin, HIGH), delay(100), digitalWrite(PiezoPin, LOW);
      digitalWrite(SLN_PIN, LOW);  //lock();
      delay(2000);
    }

    ARRAYindexUIDcard = 0;
    DisplayWAiT_CARD();
  }

  Blynk.run();
}

BLYNK_WRITE(V1) {
  int a = param.asInt();
  if (a == 1) beginCard = 1; else beginCard = 0;
}

BLYNK_WRITE(V2) {
  int a = param.asInt();
  if (a == 1) {
    skipCard = 1;
    if (EEPROMstartAddr / 5 < 10) EEPROMwriteUIDcard();
  } else {
    skipCard = 0;
  }
}

BLYNK_WRITE(V3) {
  int a = param.asInt();
  if (a == 1) {
    digitalWrite(SLN_PIN, HIGH); //unlock
    lcd.print(0, 0, " APP UNLOCK OK ");
    lcd.print(0, 1, "   DOOR OPEN   ");
    digitalWrite(PiezoPin, HIGH), delay(200), digitalWrite(PiezoPin, LOW);
    delay(2000);
    DisplayWAiT_CARD();
  } 
}

void EEPROMwriteUIDcard() {

  if (LockSwitch == 0) {
    lcd.print(0, 0, " START REC CARD ");
    lcd.print(0, 1, "PLEASE TAG CARDS");
    delay(500);
  }

  if (LockSwitch > 0) {
    if (skipCard == 1) {  //uidDec == adminID
      lcd.print(0, 0, "   SKIP RECORD   ");
      lcd.print(0, 1, "                ");
      lcd.print(0, 1, "   label : ");
      lcd.print(11, 1, EEPROMstartAddr / 5);
      EEPROMstartAddr += 5;
      skipCard = 0;
    } else {
      Serial.println("writeCard");
      EEPROM.write(EEPROMstartAddr, uidDec & 0xFF);
      EEPROM.write(EEPROMstartAddr + 1, (uidDec & 0xFF00) >> 8);
      EEPROM.write(EEPROMstartAddr + 2, (uidDec & 0xFF0000) >> 16);
      EEPROM.write(EEPROMstartAddr + 3, (uidDec & 0xFF000000) >> 24);
      EEPROM.commit();
      delay(10);
      lcd.print(0, 1, "                ");
      lcd.print(0, 0, "RECORD OK! IN   ");
      lcd.print(0, 1, "MEMORY : ");
      lcd.print(9, 1, EEPROMstartAddr / 5);
      EEPROMstartAddr += 5;
      delay(500);
    }
  }

  LockSwitch++;

  if (EEPROMstartAddr / 5 == 10) {
    lcd.clear();
    lcd.print(0, 0, "RECORD FINISH");
    delay(2000);
    EEPROMstartAddr = 0;
    uidDec = 0;
    ARRAYindexUIDcard = 0;
    EEPROMreadUIDcard();
  }
}

void EEPROMreadUIDcard() {
  for (int i = 0; i <= 9; i++) {
    byte val = EEPROM.read(EEPROMstartAddr + 3);
    CardUIDeEPROMread[ARRAYindexUIDcard] = (CardUIDeEPROMread[ARRAYindexUIDcard] << 8) | val;
    val = EEPROM.read(EEPROMstartAddr + 2);
    CardUIDeEPROMread[ARRAYindexUIDcard] = (CardUIDeEPROMread[ARRAYindexUIDcard] << 8) | val;
    val = EEPROM.read(EEPROMstartAddr + 1);
    CardUIDeEPROMread[ARRAYindexUIDcard] = (CardUIDeEPROMread[ARRAYindexUIDcard] << 8) | val;
    val = EEPROM.read(EEPROMstartAddr);
    CardUIDeEPROMread[ARRAYindexUIDcard] = (CardUIDeEPROMread[ARRAYindexUIDcard] << 8) | val;

    ARRAYindexUIDcard++;
    EEPROMstartAddr += 5;
  }

  ARRAYindexUIDcard = 0;
  EEPROMstartAddr = 0;
  uidDec = 0;
  LockSwitch = 0;
  DisplayWAiT_CARD();
}

void DisplayWAiT_CARD() {
  lcd.print(0, 0, "   ATTACH THE   ");
  lcd.print(0, 1, "      CARD      ");
}

@luciano0609 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

Replace my “OutputPin” variable with your “BTN_PIN” .

You can use either your method of hard coding blynk and wifi credentials, or mine, using autoconnect and blynk auth. Get rid of the redundant code for whichever you choose not to use.

That should be it.

How do I do that, how to unify the two codes?
I’m a layman in programming.

Start by replacing all instances of my “OutputPin” in my code with “BTN_PIN” . Remove anything in my code that refers to wifi, because you already have the wifi connection handled. Remove the blynk.auth statement, because it’s already handled by the blynk.begin statement in your code. Now you can start combining code.

Add my global variables, libraries and definitions to yours. Delete any duplicates. For example, both sketches contain “#include <BlynkSimpleEsp8266.h>”. You only need to have that line once. Next, append the contents of your setup function with the contents of mine, and delete any duplication. Do the same with the loop function. Finally, append your code with any additional functions from my code.

I can’t load the code on ESp8266, it finishes loading, but it doesn’t save the code on ESP8266.
Restart with the code that was already saved in it, what can it be?

What does the compiler/upload window show in the IDE?

Pete.