FREQOUT
 
Syntax


#include <FREQOUT.bas>

SUB FREQOUT ( pin, milliseconds, freq1, freq2)  ' declared in FREQOUT.bas

Description


Generate a sine-wave signal on pin for milliseconds.
A single frequency or mixed dual frequncy tone may be generated.  Set freq2 to 0 for a single frequency.
The IO direction of the pin will be set to output.
The output pin might be connected to a speaker or audio amplifier.

The sine wave signal is generated using pulse width modulation, for more details see that link

A sample filter to make this signal compatible with an audio amp would be similar to that below

Example

#include <FREQOUT.bas>

'Generate a soothing dual frequency tone on pin 4 for 8 seconds
'using frequncies 2500 and 6000 Hz

FREQOUT (4, 8000, 2500, 6000)



Differences from other BASICs

See also