コード例 #1
0
ファイル: rcs1000.py プロジェクト: difu/RaspyRFM
ch = ord(sys.argv[2][0]) - ord('1')
for i in range(4):
    if i == ch:
        str += '0'
    else:
        str += 'F'

str += 'FF'

if sys.argv[3] == 'on':
    str += 'F'
else:
    str += '0'

print "Sending", str

data = xx2262.MakeFrame(str, 8)

if not Rfm69.Test(0):
    print "RFM69 not found!"
    exit()

rfm = Rfm69()
rfm.SetParams(Freq=433.92,
              Datarate=2.666666,
              TXPower=13,
              ModulationType=rfm69.OOK,
              SyncPattern=[])
rfm.SendPacket(data)
コード例 #2
0
#!/usr/bin/env python2.7

from rfm69 import Rfm69
import rfm69
import sensors
import sys
import time

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!"
    exit()

rfm.SetParams(
    Freq = 868.350,
    Datarate = 5.0,
    TXPower = -10,
    ModulationType = rfm69.OOK,
    SyncPattern = [0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x38],
    Preamble = 0
    )

data = []
bitcnt = 0

def AddBit(bit):
    global data
    global bitcnt