esp32 tone

gemforce
Posts: 1
Joined: Mon Jan 08, 2018 5:01 pm

esp32 tone

Postby gemforce » Mon Jan 08, 2018 5:06 pm

Hi why not working tone in esp32 ?

sample :

tone(SOUND_PIN, 1000, 1000);
delay(1000);
noTone(SOUND_PIN)

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

Re: esp32 tone

Postby ESP_Sprite » Tue Jan 09, 2018 10:54 pm

Move news > Arduino

Cellie
Posts: 42
Joined: Sat Feb 27, 2016 9:47 pm

Re: esp32 tone

Postby Cellie » Thu Jan 11, 2018 11:31 am

You can use:

Code: Select all

    ledcWriteTone(uint8_t channel, double freq);
Remember to first setup pwm:

Code: Select all

ledcSetup(uint8_t channel, double freq, uint8_t resolution_bits);
See:
https://github.com/espressif/arduino-es ... hal-ledc.h

Example:
https://github.com/espressif/arduino-es ... reFade.ino

More clear example:
https://techtutorialsx.com/2017/07/01/e ... -with-pwm/

Who is online

Users browsing this forum: No registered users and 76 guests