Shop OBEX P1 Docs P2 Docs Learn Events
Pulse out to speaker -- How??? — Parallax Forums

Pulse out to speaker -- How???

MovieMakerMovieMaker Posts: 502
edited 2008-09-06 15:28 in Propeller 1
If I want to send a frequency or audio tone out to a speaker on a certain pin, how would I word this in Boebasic?

I know how to use outa[noparse][[/noparse]pin]=1 or 0 to turn the state on and off. But, if I need to say a frequency or a duration, how is this worded?

And, I am wondering how to use the BS2 object.· How do I load it? How do I use it?

Thanks Guys!!

tongue.gif·

Comments

  • Erik FriesenErik Friesen Posts: 1,071
    edited 2008-09-06 14:26
    How about giving freqency synth a try? It is real easy to use and is in the stock propeller files. To stop it just do

    Freq.Synth("A",24, 0)

    and create the freqency of your choice by

    Freq.Synth("A",24, freqency)
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 14:38
    Thanks Erik.



    Does this work with boebot basic? that what I am using.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-06 15:19
    This doesn't work in BoeBotBasic. The best you could do there is to toggle the I/O pin on and off in a loop with a short delay like
    100 for i = 1 to 100
    110 outa[noparse][[/noparse] 5 ] = i :   rem  I is alternately odd / even
    120 next i
    


    I'm not sure what tone you would get. BoeBotBasic is quite slow since it's an interpreter written in an interpreted language (Spin) and each level of interpretation slows things down by a large factor. It is possible to add a statement to BoeBotBasic for making tones that would call the frequency synthesis object, but I haven't done that. Several people have modified BoeBotBasic themselves to add functionality for their own projects, but frequency synthesis hasn't been one of the functions added.
  • MovieMakerMovieMaker Posts: 502
    edited 2008-09-06 15:28
    Thanks Mike.

    I just wanted to test my speaker system. So, I used the freq.synth object. but, sooner or later, I want to combine all of the individual items together. In order to do that, I need one system that will do them all. I guess Spin is the answer. But, everything is working now indiviually except my IR. And the IRemitters work fine. I am waiting to get some IRdet to replace the ones that burned up. After I get this working, I am going to go for the whole enchilda! This has been a learning experience and you have clarified much of this. I have a DENSE head. I don't mean to be, but this is the way I am. I have ADD and have a hard time concentrating. But, thanks for being kind and understanding with me.
Sign In or Register to comment.