Xinyuan-LilyGO / TTGO_TWatch_Library

MIT License
890 stars 284 forks source link

Question - making a beep sound without relying on the mail loop #165

Open mm108 opened 2 years ago

mm108 commented 2 years ago

Just a quick question - is there a simple way to get the TTGO T-Watch 2020 V1 to make a beep sound? I have been able to play audio using the ESP8266Audio but what I need is something that can just make a "beep" sound without having to rely on the loop() or something?

I am not too familiar with the I2S used for audio on this board. All I need is to be able to make a beep sound. In the current program it isn't possible to add the wav.loop() / mp3->isRunning() to the main loop as the main loop is fairly complicated and it cannot be modified.

I am using PlatformIO / Arduino framework.

Thanks.

timeylies commented 1 year ago

leave the audio part in the main loop but put everything else In a task like this:

`//In setup xTaskCreate( everythingExceptAudioTask, / Task function. / "everythingExceptAudioTask", / String with name of task. / 10000, / Stack size in bytes. / NULL, / Parameter passed as input of the task / 1, / Priority of the task. / NULL); / Task handle. /

void everythingExceptAudioTask( void * parameter ) { //ur code here }`