Compilation error - Yield function

WingNut
Posts: 2
Joined: Thu Sep 06, 2018 2:06 am

Compilation error - Yield function

Postby WingNut » Thu Sep 06, 2018 2:21 am

Hi Everyone,

I'm playing with/learning load cells. Wrote some come code that works on an Arduino Uno, but not the ESP32.

Code: Select all

#include "HX711.h"
#define DOUT  3
#define CLK  2
float seed = -385.95;

HX711 scale(DOUT, CLK);

void setup() {
  Serial.begin(9600);

  scale.set_scale(seed);

  scale.tare();
}

void loop() {
  scale.set_scale(seed);

  if (Serial.available()) {
    char z = Serial.read();

    if (z == '-') seed -= 0.1;
    if (z == '+') seed += 0.1;
  }

  Serial.print("Seed value: ");
  Serial.print(seed);
  Serial.print("\tWeight:\t");
  Serial.println(scale.get_units(10), 1);
  Serial.print("\tWeight:\t");
  Serial.println((scale.get_units(10), 1)/453.0f);
  Serial.println("\t lbs.");
}
When I try to compile for the ESP32 I get this:
C:\Users\LAB_BE~1\AppData\Local\Temp\arduino_build_878347/arduino.ar(esp32-hal-misc.c.o): In function `yield':

C:\Users\Lab_Bench\Documents\Arduino\hardware\espressif\esp32\cores\esp32/esp32-hal-misc.c:38: multiple definition of `yield'

libraries\HX711-master\HX711.cpp.o:C:\Users\Lab_Bench\Documents\Arduino\libraries\HX711-master/HX711.cpp:7: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board ESP32 Dev Module.
I not even using the 'yield' function, that I'm aware of.

Any enlightenment will be greatly appreciated.

Thanks

ESP_Sprite
Posts: 9725
Joined: Thu Nov 26, 2015 4:08 am

Re: Compilation error - Yield function

Postby ESP_Sprite » Thu Sep 06, 2018 3:10 am

That's this library? https://github.com/bogde/HX711/blob/master/HX711.cpp I think it doesn't detect the Arduino version correctly. You can try editing this file and removing the #ifdef/#endif lines and everything in between on line 4 to 8.

WingNut
Posts: 2
Joined: Thu Sep 06, 2018 2:06 am

Re: Compilation error - Yield function

Postby WingNut » Sat Sep 08, 2018 2:17 am

I was thinking about those same statements while at work. Removed them, and it compiled just fine.

Thanks!

Who is online

Users browsing this forum: No registered users and 44 guests