Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sweep_cd():
- samples = 3000
- threshold = 0.995
- chan_high = 0b1
- hf_pll = 0b01
- SPI.open(1, 0)
- try:
- set_stand_by()
- for chan_low in range(0b00000000, 0b11111111):
- SPI.xfer2([0b00000000, chan_low, 0b00001100, 0b01000100, 0b01000100, 0b00000100, myAddr[0], myAddr[1], myAddr[2], myAddr[3], 0b11011111])
- set_rx()
- presence = 0.0
- for sample in range(0, samples):
- if GPIO.input("P9_12"): presence = presence+1
- sys.stdout.write ( '\033[94m'+"[+]"+'\033[0m'+"Carrier found at "+str((422+(float(chan_low)/10))*(1))+"Mhz; stability "+str(presence/samples)+".\n" if (presence/samples)>threshold else "")
- for chan_low in range(0b00000000, 0b11111111):
- SPI.xfer2([0b00000000, chan_low, 0b00001100|chan_high, 0b01000100, 0b01000100, 0b00000100, myAddr[0], myAddr[1], myAddr[2], myAddr[3], 0b11011111])
- set_rx()
- presence = 0.0
- for sample in range(0, int(samples)):
- if GPIO.input("P9_12"): presence = presence+1
- sys.stdout.write( '\033[94m'+"[+]"+'\033[0m'+"Carrier found at "+str((422+(float(chan_low|0b100000000)/10))*(1))+"Mhz; Stability "+str(presence/samples)+".\n" if (presence/samples)>threshold else "")
- for chan_low in range(0b00000000, 0b11111111):
- SPI.xfer2([0b00000000, chan_low, 0b00001100|hf_pll, 0b01000100, 0b01000100, 0b00000100, myAddr[0], myAddr[1], myAddr[2], myAddr[3], 0b11011111])
- set_rx()
- presence = 0.0
- for sample in range(0, int(samples)):
- if GPIO.input("P9_12"): presence = presence+1
- sys.stdout.write( '\033[94m'+"[+]"+'\033[0m'+"Carrier found at "+str((422+(float(chan_low)/10))*(2))+"Mhz; stability "+str(presence/samples)+".\n" if (presence/samples)>threshold else "")
- for chan_low in range(0b00000000, 0b11111111):
- SPI.xfer2([0b00000000, chan_low, 0b00001100|chan_high|hf_pll, 0b01000100, 0b01000100, 0b00000100, myAddr[0], myAddr[1], myAddr[2], myAddr[3], 0b11011111])
- set_rx()
- presence = 0.0
- for sample in range(0, int(samples)):
- if GPIO.input("P9_12"): presence = presence+1
- sys.stdout.write( '\033[94m'+"[+]"+'\033[0m'+"Carrier found at "+str((422+(float(chan_low|0b100000000)/10))*(2))+"Mhz; stability "+str(presence/samples)+".\n" if (presence/samples)>threshold else "")
- finally:
- SPI.close()
Advertisement
Add Comment
Please, Sign In to add comment