Error compiling for board Generic ESP8266 Module

Hi experts, I am doing a project to send the sensor data to email using Arduino with ESP8266-01 module. However, I couldn't compile the code for the ESP8266. The error message is as below:

Arduino: 1.8.13 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"





















C:\Program Files (x86)\Arduino\libraries\SerialTransfer-master\src\SPITransfer.cpp: In member function 'uint8_t SPITransfer::available()':

C:\Program Files (x86)\Arduino\libraries\SerialTransfer-master\src\SPITransfer.cpp:111:29: error: 'SPDR' was not declared in this scope

  volatile uint8_t recChar = SPDR;

                             ^

exit status 1

Error compiling for board Generic ESP8266 Module.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Please post your full sketch.

If possible, you should always post code directly in the forum thread as text using code tags:

  • Do an Auto Format (Tools > Auto Format[/b) on your code. This will make it easier for you to spot bugs and make it easier for us to read.[/li]
  • - Edit > Copy for Forum*
  • - In a forum reply here, click on the reply field.*
    - Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • - Press "Ctrl + V". This will paste the sketch between the code tags.*
  • - Move the cursor outside of the code tags before you add any additional text to your reply.*
  • - Repeat the above process if your sketch has multiple tabs.*
  • [/list]*
  • This will make it easy for anyone to look at it, which will increase the likelihood of you getting help.*
  • If the sketch is longer than the 9000 characters maximum allowed by the forum, then it's OK to add it as an attachment. After clicking the "Reply" button, you will see an "Attachments and other settings" link that will allow you to make the attachment.*
    When your code requires a library that's not included with the Arduino IDE please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.
#define BLYNK_MAX_SENDBYTES 500
#define BLYNK_PRINT Serial
#include <SerialTransfer.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

SerialTransfer myTransfer;
SimpleTimer timer;

char auth[] = "G7tx25TVGw0nUKEhC5ibnI-c4MPzuxr2";
char ssid[] = "PGTMSB";
char pass[] = "*************";

String myString;
int rdata;

int firstVal;

void sendWeight(){
  int sdata1 = firstVal;
  String str = "Average weight is " + String(sdata1) + "g";
    Blynk.email("wewewe6969@outlook.com", "Insufficient Weight!", str);
    Blynk.notify("ESP8266 Alert - Weight less than 500g!");
    Blynk.virtualWrite(V3, sdata1);
  }

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  myTransfer.begin(Serial);
  Blynk.begin(auth, ssid, pass);
 
    timer.setInterval(1000L,sendWeight); 
}

void loop() {
  // put your main code here, to run repeatedly:
  if (myTransfer.available()) 
   {
    Blynk.run();
    timer.run(); // Initiates BlynkTimer
    myTransfer.rxObj(rdata,sizeof(rdata));
    firstVal = rdata;  
    rdata=0;
   }
 
  else if(myTransfer.status < 0)
  {
    Serial.print("ERROR: ");
    Serial.println(myTransfer.status);
  }

    }

This is my code for the ESP8266-01. I am using SerialTransfer.h to receive the value from the Arduino.
This is the link for Blynk library: GitHub - blynkkk/blynk-library: Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
And this is the link for SerialTransfer library: GitHub - PowerBroker2/SerialTransfer: Arduino library to transfer dynamic, packetized data fast and reliably via Serial, I2C, or SPI

The error message is as below:

Well that is not the error message but just the status.

You are using the Arduino IDE ?
How have you connected the ESP-01 to the PC running the IDE ?

6v6gt:
You are using the Arduino IDE ?
How have you connected the ESP-01 to the PC running the IDE ?

Thanks for your reply. I saw from the website which says using the ESP01 Programmer UART to upload the sketch. But I haven't buy the components yet, will buy it if succeed in my coding.
The website link is here: jobs.html_title

Deva_Rishi:
Well that is not the error message but just the status.

I see something related to the SerialTransfer library in the error message. But I'm not sure about that becasue it is my first time doing IoT projects which involves using SerialTransfer.

zack6912:
I see something related to the SerialTransfer library in the error message. But I'm not sure about that becasue it is my first time doing IoT projects which involves using SerialTransfer.

You have to include the full error message, but some libraries e.g. here #include <SerialTransfer.h>
may not be included in the IDE as standard, so you have to down load these in the library manager.

6v6gt:
You have to include the full error message, but some libraries e.g. here #include <SerialTransfer.h>
may not be included in the IDE as standard, so you have to down load these in the library manager.

I did include the whole error message in my first post but maybe you didn't scroll down. I did downloaded the libraries in my code and I attached the link of the libraries also in my second post.

zack6912:
This is the link for Blynk library: GitHub - blynkkk/blynk-library: Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
And this is the link for SerialTransfer library: GitHub - PowerBroker2/SerialTransfer: Arduino library to transfer dynamic, packetized data fast and reliably via Serial, I2C, or SPI

The documentation for the SerialTransfer library stresses that it is for use with Arduino boards as follows

SPITransfer.h and it's associated features are not supported for the Arduino Nano 33 BLE or DUE and other boards.

The ESP8266 is not an Arduino board and presumably does not have an SPDR register

The library appears to have been written by a member here, Power_Broker, so a PM to him/her might be a good idea

zack6912:
I did include the whole error message in my first post but maybe you didn't scroll down. . . .

Sorry. Indeed you are correct. I was tricked by all the white space.

I was tricked by all the white space.

So was I