Shop OBEX P1 Docs P2 Docs Learn Events
Ping output used as a piezoelectric speaker input? — Parallax Forums

Ping output used as a piezoelectric speaker input?

cmrehmcmrehm Posts: 11
edited 2012-02-21 16:18 in Accessories
I used the kickstart program (p77) for the PING))) ULTRASONIC DISTANCE SENSOR. In the Do Loop I entered Freqout mypin, time constant, x. where x = inDistance.


I was able to get the frequency coming out of the piezoelectric speaker to change as I moved my hand towards and away from the PING))) sensor. The only problem is I could not figure out how to get into the higher frequencies. Through trill and error I figured out that I was in the 200-20 Hz range. I tried to mess with x by adding 2000, but could not get into the higher frequencies. I also tried to mess with the InConstant to see if I could increase the input signal, to the speaker, before it got the inDistance variable. That didn't work either.

Does any one know how I could use the PULSIN as a feedback to an output to the Freqout command and be able to control what the output signal is?

ps I have been able to use an IF statement with an embeded freqout command (inside the Do Loop). where the Freqout command had a numeric value in the hz postition. I think of this like a discrete input I would like to develop something that is analog.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2012-02-21 11:26
    Without seeing your code it sounds like you are using a byte variable where you should be using a word.
  • cmrehmcmrehm Posts: 11
    edited 2012-02-21 16:18
    Quick fix. Guess I had tunnel vision. Thank you
Sign In or Register to comment.