NewPing not compiling for ESP8266

Issue #17 resolved
Former user created an issue

Hi! I'm using IDE 1.6.4 the library doesn't compile if select the NodeMCU board, but it compiles if I select Arduino UNO

I used the "single pin" example to make a test

is there a workaround?

many thanks for your work btw

Javier

Comments (5)

  1. Tim Eckel repo owner

    I'm running NewPing v1.8, Arduino IDE v1.6.13, used the esp8266 by ESP8266 Community v2.3.0 board manager and tried both NodeMCU 0.9 and 1.0 compilers and in all cases it compiled just fine with zero errors.

    I would try upgrading everything first (or verify you're at least up to date with above). Also, if you're still having a problem, please specify exactly which board manager and version you are using as well as the exact error that you're getting when you compile, as I see everything working perfectly.

  2. mocheffendi

    Hi Tim Eckel,

    this is my problem if I used the example NewPingEventTimer

    Arduino: 1.8.1 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

    C:\Users\ZZZ\Documents\Arduino\libraries\NewPing\examples\NewPingEventTimer\NewPingEventTimer.pde: In function 'void loop()':

    NewPingEventTimer:32: error: 'class NewPing' has no member named 'ping_timer'

     sonar.ping_timer(echoCheck); // Send out the ping, calls "echoCheck" function every 24uS where you can check the ping status.
    
           ^
    

    C:\Users\ZZZ\Documents\Arduino\libraries\NewPing\examples\NewPingEventTimer\NewPingEventTimer.pde: In function 'void echoCheck()':

    NewPingEventTimer:39: error: 'class NewPing' has no member named 'check_timer'

    if (sonar.check_timer()) { // This is how you check to see if the ping was received.

             ^
    

    NewPingEventTimer:42: error: 'class NewPing' has no member named 'ping_result'

     Serial.print(sonar.ping_result / US_ROUNDTRIP_CM); // Ping returned, uS result in ping_result, convert to cm with US_ROUNDTRIP_CM.
    
                        ^
    

    exit status 1 'class NewPing' has no member named 'ping_timer'

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

  3. Tim Eckel repo owner

    The problem is the platform you're using, not the library. See the compatibility section of NewPing:

    https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!compatibility

    Basically, non-AVR microcontrollers (which includes the ESP8266) won't work with timer-based methods like ping_timer. That's why you're getting the error that NewPing has no member named ping_timer, as it doesn't exist for non-AVR microcontrollers.

    Please also see that this issue has been marked closed and note the other comments I have made on this.

  4. Log in to comment