openwch / arduino_core_ch32

Core library for CH32duino
266 stars 51 forks source link

error: 'tone' was not declared in this scope #24

Closed MangyCat closed 5 months ago

MangyCat commented 1 year ago

I tried compiling the tonemelody example from the arduino examples sketchbook so i can play melodies from my ch32v003 and i got these errors. I have selected CH32V00x in the board selecting options. I have not changed any configuration myself.

C:\Users\etore\AppData\Local\Temp\.arduinoIDE-unsaved202389-4580-s8bhqs.pch6l\toneMelody\toneMelody.ino: In function 'void setup()':
C:\Users\etore\AppData\Local\Temp\.arduinoIDE-unsaved202389-4580-s8bhqs.pch6l\toneMelody\toneMelody.ino:37:5: error: 'tone' was not declared in this scope
     tone(8, melody[thisNote], noteDuration);
     ^~~~
C:\Users\etore\AppData\Local\Temp\.arduinoIDE-unsaved202389-4580-s8bhqs.pch6l\toneMelody\toneMelody.ino:37:5: note: suggested alternative: 'tanh'
     tone(8, melody[thisNote], noteDuration);
     ^~~~
     tanh
C:\Users\etore\AppData\Local\Temp\.arduinoIDE-unsaved202389-4580-s8bhqs.pch6l\toneMelody\toneMelody.ino:44:5: error: 'noTone' was not declared in this scope
     noTone(8);
     ^~~~~~

exit status 1

Compilation error: 'tone' was not declared in this scope

I tried installing external tone library by Brett Hagman but it said it wasnt supported and compiling also failed due to some timers not being declared in scope.

TianpeiLee commented 5 months ago

I've updated the core library and now the feature should work fine, I tested it on both 203 and 003 image