Skip to content

Commit

Permalink
Python example RF24Mesh_Example_Master.py rewrited to work as C++ exa…
Browse files Browse the repository at this point in the history
…mple
  • Loading branch information
filipek92 committed Jul 28, 2017
1 parent c783fdb commit e628d65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples_RPi/RF24Mesh_Example_Master.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from RF24Network import *
from RF24Mesh import *

from struct import unpack


# radio setup for RPi B Rev2: CS0=Pin 24
radio = RF24(RPI_V2_GPIO_P1_15, RPI_V2_GPIO_P1_24, BCM2835_SPI_SPEED_8MHZ)
Expand All @@ -20,5 +22,8 @@
mesh.DHCP()

while network.available():
print("Received message")
header, payload = network.read(10)
if chr(header.type) == 'M':
print("Rcv {} from 0{:o}".format(unpack("L",payload)[0], header.from_node))
else:
print("Rcv bad type {} from 0{:o}".format(header.type,header.from_node));

0 comments on commit e628d65

Please sign in to comment.