Raspberry Pi FM radio

http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter

For easy access to configuration change the play_sound definition in PiFm.py to

def play_sound( filename, freq, rate ): 
     call(["./pifm", filename, freq, rate])
     return

Then try a loop (save in infloop.py and type sudo python infloop.py from the bash shell)

import PiFm 
x=100.0 
rate=141100 
while 1: 
     print x,"MHz" 
     PiFm.play_sound("sonar.wav"," "+str(x)," "+str(rate)) 

You can also loop across a range of frequences

import PiFm 
x=0 
while 1: 
     print x,"MHz" 
     rate=141100 
     PiFm.play_sound("sonar.wav"," "+str(x)," "+str(rate)) 
     x=x+0.1 
     if x>250: 
          x=0

 Note: Use only with near-range antenna.

Comments

Popular Posts