Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

Tone.h is it missing or not needed?

Open Fettkeewl opened this issue 8 years ago • 2 comments

Basic Infos

Hardware

Hardware: ESP-12f Core Version: 2.4.0

Description

Trying to use Tone.h which is written for the esp8266 but I can't include it, I see that there is only a tone.cpp but not a tone.h. How is this then supposed to be used?

Settings in IDE

Module: Generic ESP8266 Module Flash Size: 4MB/ CPU Frequency: 80Mhz Flash Mode: qio Flash Frequency: 40Mhz Upload Using: SERIAL Reset Method: ck

Sketch


#include <Tone.h>

void setup() {

}

void loop() {

}

Debug Messages

20:18: fatal error: Tone.h: No such file or directory

 #include <Tone.h>

Fettkeewl avatar Jan 17 '18 05:01 Fettkeewl

No includes are needed to use tone functions, they're part of the core.

#define TONE_PIN D5

void setup() {
 Serial.begin(115200);
}

void loop() {
 tone(TONE_PIN, 5000, 250); // pin, frequency, duration (msec)
 delay(1000);
}

MarkusAD avatar Jan 20 '18 09:01 MarkusAD

Previous comment is correct. The tone functions are declared in Arduino.h, and Tone.h doesn't exist. Per arduino.cc reference, this looks correct. Closing.

devyte avatar Jan 25 '18 22:01 devyte