raspberry V0.3

pull/2/head
ouki-wang 6 years ago
parent cff3ef2a56
commit ee544ff756
  1. 4
      RaspberryPi/Python/DFRobot_AS3935_Lib.py
  2. 1
      RaspberryPi/Python/example/DFRobot_AS3935_detailed.py
  3. 1
      RaspberryPi/Python/example/DFRobot_AS3935_ordinary.py

@ -77,9 +77,9 @@ class DFRobot_AS3935:
newRegData = (self.register[0] & ~dataMask)|(regData & dataMask) newRegData = (self.register[0] & ~dataMask)|(regData & dataMask)
#finally, write the data to the register #finally, write the data to the register
self.writeByte(regAdd, newRegData) self.writeByte(regAdd, newRegData)
print('wrt: %02x'%newRegData) #print('wrt: %02x'%newRegData)
self.singRegRead(regAdd) self.singRegRead(regAdd)
print('Act: %02x'%self.register[0]) #print('Act: %02x'%self.register[0])
def singRegRead(self,regAdd): def singRegRead(self,regAdd):
self.readData(regAdd) self.readData(regAdd)

@ -97,6 +97,7 @@ def callback_handle(channel):
GPIO.setup(IRQ_PIN, GPIO.IN) GPIO.setup(IRQ_PIN, GPIO.IN)
#Set the interrupt pin, the interrupt function, rising along the trigger #Set the interrupt pin, the interrupt function, rising along the trigger
GPIO.add_event_detect(IRQ_PIN, GPIO.RISING, callback = callback_handle) GPIO.add_event_detect(IRQ_PIN, GPIO.RISING, callback = callback_handle)
print("start lightning detect.")
while True: while True:
time.sleep(1.0) time.sleep(1.0)

@ -77,6 +77,7 @@ def callback_handle(channel):
GPIO.setup(IRQ_PIN, GPIO.IN) GPIO.setup(IRQ_PIN, GPIO.IN)
#Set the interrupt pin, the interrupt function, rising along the trigger #Set the interrupt pin, the interrupt function, rising along the trigger
GPIO.add_event_detect(IRQ_PIN, GPIO.RISING, callback = callback_handle) GPIO.add_event_detect(IRQ_PIN, GPIO.RISING, callback = callback_handle)
print("start lightning detect.")
while True: while True:
time.sleep(1.0) time.sleep(1.0)

Loading…
Cancel
Save