BS2 functions - freqout
I have the propeller kit (PE), and I've done the labs.
When I try to use the BS2 functions object for the freqout command there is no response.
I've written two simple programs:
·- one that turns on an LED when a button is press (without BS2 object written in)
·- other that does the same as above as well as send a frequency signal to a piezo (with BS2 object written in)
When I run the second program there is no sound from piezo and the LED does not turn on.
The only way to get the LED to turn on (in the second program) is if I comment out any reference to the BS2 function.
I've tested the piezo separately and added a transistor to the piezo to apply 5V instead of 3.3V.
Also, I made sure the object file is in the same folder as the main program and the directory has both files referenced.
After narrowing the problem down (as far as my expertise would allow - very limited) the program would stop working if I included the BS2.start (31,30) method - see attached files.
Any suggestions would help.
Thanks,
Shmow.
When I try to use the BS2 functions object for the freqout command there is no response.
I've written two simple programs:
·- one that turns on an LED when a button is press (without BS2 object written in)
·- other that does the same as above as well as send a frequency signal to a piezo (with BS2 object written in)
When I run the second program there is no sound from piezo and the LED does not turn on.
The only way to get the LED to turn on (in the second program) is if I comment out any reference to the BS2 function.
I've tested the piezo separately and added a transistor to the piezo to apply 5V instead of 3.3V.
Also, I made sure the object file is in the same folder as the main program and the directory has both files referenced.
After narrowing the problem down (as far as my expertise would allow - very limited) the program would stop working if I included the BS2.start (31,30) method - see attached files.
Any suggestions would help.
Thanks,
Shmow.

Comments
- Your program is small enough you could have copied it into your posting (using [noparse][[/noparse] code ] ...[noparse][[/noparse] /code ] of course!) This will generally speed up responses...
-Please don't use spaces in your file names. I decided once to no longer look into files that contain blanks in their names....
But no rule without exception...
- How should the Propeller know that you want BTN_LED executed? It just executes the FIRST routine and then stops.
Okay, I changed things according to your advice - thanks.·
And I got it to work...yeah!
Here's the revised program and this time with just ONE public method (one section of code).
'' -- input P23 turns on LED on pin P4 '' -- if LED is on then P 10 sends signal to PIEZO '' {{LED Pushbutton Piezo ────────────────── ────────────────── ────────────────── 3.3V 5V 100 Ω LED   P 4 ───────┐ │ P 10 ─  ┤Pushbutton │ GND │ + │ [noparse][[/noparse]PIEZO] P 23 ─┫ - │ │  10 kΩ   GND GND }} CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ BS2 : "BS2_Functions" ' Create BS2 Object PUB Btn_LED dira[noparse][[/noparse]4] := 1 ' make the pin an output repeat outa[noparse][[/noparse]4] := ina[noparse][[/noparse]23] ' output state equals input state if outa[noparse][[/noparse]4] BS2.start (31,30) BS2.FREQOUT(10,1000,2500) ' sends 1 sec. pulse of 2500 Hz on pin 10I have a pretty good handle on the·stamp but with the prop & spin - I'm taking baby steps.
Thanks for your help.
Cheers,
Shmow·