Bug? NodeMcu ESP8266 AnalogWrite values

Discussion in 'B4R Bugs & Wishlist' started by derez, Aug 24, 2016.

  1. derez

    derez Expert Licensed User

    Testing the NodeMcu I have found that the max value in AnalogWrite is 1023 (= digitalwrite(true)), not 255.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It sounds like a bug in ESP8266 libraries as Arduino analogWrite command expects values between 0 to 255.
     
  3. janderkan

    janderkan Active Member Licensed User

    On ESP the default PWM range is 0 to 1023.
    And default PWM frequency is 1KHz.
    http://esp8266.github.io/Arduino/versions/2.0.0/doc/reference.html

    These values can be changed.
    Attached is the files.

    Copy rESP8266.xml to folder: C:\Program Files (x86)\Anywhere Software\B4R\Libraries
    Copy rESP8266.h and rESP8266.cpp to: C:\Program Files (x86)\Anywhere Software\B4R\Libraries\rESP8266
    Remember to create a backup copy first !

    I hope the right person will include this in the next version of B4R :)
     

    Attached Files:

    derez likes this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    Which changes have you made?
     
  5. janderkan

    janderkan Active Member Licensed User

    I have added AnalogWriteRange and AnalogWriteFreq.
     
  6. janderkan

    janderkan Active Member Licensed User

    I have agreed with starChild and the functions will be included in his Esp8266Extra library !
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice