ridencww / cww_MorseTx

CWW Morse Code Transmit Library
MIT License
5 stars 3 forks source link

Won't compile on ESP32 #1

Closed W4KRL closed 3 years ago

W4KRL commented 3 years ago

Here is the error message for the morseSend.ino example. I get a similar message when I try to use the library in my own program:

Arduino: 1.8.13 (Windows 10), Board: "ESP32 Wrover Module, Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS), QIO, 80MHz, 921600, None"

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\examples\morseSend\morseSend.ino: In function 'void loop()':

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\examples\morseSend\morseSend.ino:32:30: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

   morse.send("CQ DE W1AW");
                          ^

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\cww_MorseTx.cpp: In member function 'void cww_MorseTx::dot()':

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\cww_MorseTx.cpp:97:24: error: 'tone' was not declared in this scope

 tone(_sndpin, _freq);   
                    ^

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\cww_MorseTx.cpp:105:19: error: 'noTone' was not declared in this scope

 noTone(_sndpin);
               ^

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\cww_MorseTx.cpp: In member function 'void cww_MorseTx::dash()':

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\cww_MorseTx.cpp:113:24: error: 'tone' was not declared in this scope

 tone(_sndpin, _freq);   
                    ^

C:\Users\KarlB\OneDrive\Arduino\libraries\CWW_Morse_Transmit\cww_MorseTx.cpp:121:19: error: 'noTone' was not declared in this scope

 noTone(_sndpin);
               ^

exit status 1

Error compiling for board ESP32 Wrover Module.

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

ridencww commented 3 years ago

Thank you for pointing this out, Karl. I've only used this library with the Arduino Nano and Wemos D1 Mini (ESP-8266). The ESP32 platform does not yet support the Arduino tone() and notone() functions. However, PWM (used to generate the tones) is supported via the ledcWriteTone function.

I have modified the library to implement the tone() and notone() functions when the target device is an ESP32. I have tested this with an ESP32 WRover module, which is what I believe you are running.

The updated library (v1.1.0) should be available from the library manager or it can be downloaded directly from this repo.

W4KRL commented 3 years ago

Ralph,

Thanks for the quick response. It now compiles without objection.

I have an app the uses only the LED output so can't speak to tone()/notone().

I'm developing an energy monitor for my ebike. Originally it used an LCD display but that became redundant when all the data could be displayed on a cellphone app. The LED sends a few two-letter codes to indicate if the WiFi and Bluetooth connections were successful. https://w4krl.com/e-bike-logger/

Thanks for making this library available. 73 Karl W4KRL

On Sat, Oct 10, 2020 at 5:28 PM Ralph Iden notifications@github.com wrote:

Thank you for pointing this out, Karl. I've only used this library with the Arduino Nano and Wemos D1 Mini (ESP-8266). The ESP32 platform does not yet support the Arduino tone() and notone() functions. However, PWM (used to generate the tones) is supported via the ledcWriteTone function.

I have modified the library to implement the tone() and notone() functions when the target device is an ESP32. I have tested this with an ESP32 WRover module, which is what I believe you are running.

The updated library (v1.1.0) should be available from the library manager or it can be downloaded directly from this repo.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ridencww/cww_MorseTx/issues/1#issuecomment-706613994, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHJF5KUE4TLIBNUEPQGQCLSKDGYVANCNFSM4SI7G6MQ .

ridencww commented 3 years ago

I took a quick peek at your site to look at the project and noticed your IoT kits. Last year, I did a talk for our local amateur radio club and I put together a take home kit of a D1 Mini, various shields, and a handful of components (breadboard, LEDs, resistors, etc.) I created this library as one example of what could be done with these inexpensive boards.

Good luck on your projects. I'm glad others are using the library. I'm closing this issue now, but feel free to open a new one if you encounter any issues.

Ralph WB9ICF - email good on qrz