RaspyRFM/lacrosse.py

37 lines
839 B
Python
Raw Normal View History

2017-03-05 22:42:34 +01:00
#!/usr/bin/env python2.7
from __future__ import print_function
2017-03-05 22:42:34 +01:00
from rfm69 import Rfm69
import rfm69
import sensors
from sensors import rawsensor
import sys
import time
2018-04-24 00:15:14 +02:00
if Rfm69.Test(1):
rfm = Rfm69(1, 24) #when using the RaspyRFM twin
elif Rfm69.Test(0):
rfm = Rfm69() #when using a single single 868 MHz RaspyRFM
else:
print("No RFM69 module found!")
2018-04-24 00:15:14 +02:00
exit()
2017-03-05 22:42:34 +01:00
rfm.SetParams(
2018-02-08 00:06:11 +01:00
Freq = 868.312, #MHz center frequency
2017-03-05 22:42:34 +01:00
Datarate = 9.579, #17.241, #kbit/s baudrate
ModulationType = rfm69.FSK, #modulation
Deviation = 90, #90 kHz frequency deviation
2017-03-05 22:42:34 +01:00
SyncPattern = [0x2d, 0xd4], #syncword
Bandwidth = 200, #kHz bandwidth
RssiThresh = -100 #-100 dB RSSI threshold
2017-03-05 22:42:34 +01:00
)
data = []
print("Waiting for sensors...")
2017-03-05 22:42:34 +01:00
while 1:
data = rfm.ReceivePacket(7)
obj = rawsensor.CreateSensor(data)
print(str(obj))