Buzzer on ESP8266 (NodeMCU Amica)

Posted on
  • Hello,

    Does anyone have working examples with passive buzzer?
    Because when I try this:

    analogWrite(A0, 0.5, { freq: 1000 } );
    
    

    I have such message:

    >Uncaught ReferenceError: "A0" is not defined
     at line 1 col 13
    analogWrite(A0, 0.5, { freq: 1000 } );
    

    I've also tried digital pins, but no sound in result(and no error).

    Could anyone show working example? (https://www.espruino.com/Making+Music doesn't work for me)

    Thanks

  • A0 is the analog input. Use a D pin like NodeMCU.D3, but do not expect to much, because pwm is poor on ESP8266 - check #914

    Make sure you not blow it by draining to much current from a Pin, max is 12 mA.

  • Thanks, it helps) now need some time to pick some normal melody)

  • [SPAM]

  • What does that have to do with Espruino? That looks like arduino C.

  • deleted - looks like spam to me (in the code comments)...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Buzzer on ESP8266 (NodeMCU Amica)

Posted by Avatar for Hansi @Hansi

Actions