I connected a multimeter to the D5 and GND legs, and it shows zero!
To make sure the multimeter is not broken, I did the same with the V3.3 leg, and it showed the correct voltage. Also, it’s showing some voltage in an original arduino I have using the same setup.
I used the above steps to make sure the problem is not in my piezo, multimeter, jumpers, and such.
On the Github issue located here, I incorrectly stated tone works on D4-D7. I’ve edited that post and provide a sample application for you here that works.
The pins you can use for tone() / noTone() are: D0, D1, A0, A1, A4, A5, A6, A7, RX, TX
Resurrecting this topic for Photon: What about A6 (dac) and A7 (wkp)? Cannot get tone() working on A6, haven’t yet checked A7. The pin-description docs are somewhat ambiguous; am I to presume that tone() is only available on a PWM-capable pin? If so, then A6/DAC is definitely not compatible moving from Core to Photon. Can you clarify, @BDub?
@johnshifflett, @BDub is the guy but I can tell you that Tone is a variation of PWM and both are tied to hardware timers. I don’t believe that A6 & A7 are tied to timers so they would not support Tone or PWM.
The still state the full list of pins. I can also confirm that A6 is not working, which is a little unfortunate. Now I am using two pins to play waves and beeps.
I aslo switched from Core to Photon with a buzzer. A0 and A1 didn’t work. I switched to A4 and it did. Unless my Photon is faulty, the documentation of the tone() function seems incorrect.
@gdeflaux, you are correct about the documentation. The Photon analogWrite() docs say:
On the Photon and Electron, this function works on pins D0, D1, D2, D3, A4, A5, WKP, RX and TX with a caveat: PWM timer peripheral is duplicated on two pins (A5/D2) and (A4/D3) for 7 total independent PWM outputs. For example: PWM may be used on A5 while D2 is used as a GPIO, or D2 as a PWM while A5 is used as an analog input. However A5 and D2 cannot be used as independently controlled PWM outputs at the same time.
So unlike the Core, the Photon A0 and A1 don't support PWM and hence Tone.
HI All
I'm not having any luck trying to play a tone from my Photon. I've got 2 typical piezo buzzers that work on an RPi and an Arduino, so I don't think it's them. I hooked them up to D0 and execute
tone(D0, 2000, 500);
and get nothing, same for D1. Is there something special that I am missing? In the end it read like D0 and D1 were in fact working pins for tone().
Well I decided to just reboot the effort and it’s working. I must’ve always had something missing at each stage, but when I just used D1 and all connections are correct, tone works as expected.