diff --git a/GW-custom/PingPong/.DS_Store b/GW-custom/PingPong/.DS_Store index 9979d8b0454d3736f0b32db838e44ebf21bc0481..82a3fe5c31d0b2de64ad0864b9d6679cb1c01770 100644 Binary files a/GW-custom/PingPong/.DS_Store and b/GW-custom/PingPong/.DS_Store differ diff --git a/GW-custom/PingPong/Ping/boot.py b/GW-custom/PingPong/Ping/boot.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/GW-custom/PingPong/Pong/Pong.code-workspace b/GW-custom/PingPong/Pong/Pong.code-workspace new file mode 100644 index 0000000000000000000000000000000000000000..35ce7ebf62d7884f6eaa4043a94466270a15f4b9 --- /dev/null +++ b/GW-custom/PingPong/Pong/Pong.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "name": "Pong", + "path": "." + } + ] +} \ No newline at end of file diff --git a/GW-custom/PingPong/Pong/boot.py b/GW-custom/PingPong/Pong/boot.py new file mode 100644 index 0000000000000000000000000000000000000000..b8e7bb0948e95d8d7e45ecd78640aa95d841f6d3 --- /dev/null +++ b/GW-custom/PingPong/Pong/boot.py @@ -0,0 +1 @@ +# boot.py -- run on boot-up diff --git a/GW-custom/PingPong/Pong/main.py b/GW-custom/PingPong/Pong/main.py new file mode 100644 index 0000000000000000000000000000000000000000..ea6e27c8f448236fd9f9d9c88d9a7a9f001a1ee2 --- /dev/null +++ b/GW-custom/PingPong/Pong/main.py @@ -0,0 +1,41 @@ +# main.py -- put your code here! +from network import LoRa +import socket +import time + +# Please pick the region that matches where you are using the device + +lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868, adr=False) +print('Coding rate {}'.format(lora.coding_rate())) + +#lora.sf(12) +print('SF {}'.format(lora.sf())) + +s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) + +s.setblocking(False) + +# Code pour le Pong ; réception puis émission +i = 0 +while True: + if s.recv(64) == b'Ping': + print('je recois Ping du Node A') + print(lora.stats()) + #print(lora.coding_rate()) + s.send('Pong') + print('Pong {}'.format(i)) + i = i+1 + time.sleep(5) + +# Code pour le Ping ; uniquement émission +# msg = 'Ping' +# #msg = 'Ping hello i m devui' + (ubinascii.hexlify(lora.mac()).decode('ascii')) +# #print(msg) +# i = 0 +# while True: +# s.send(msg) +# print('Ping {}'.format(i)) +# print(lora.stats()) +# i= i+1 +# time.sleep(5) + diff --git a/GW-custom/PingPong/Pong/pymakr.conf b/GW-custom/PingPong/Pong/pymakr.conf new file mode 100644 index 0000000000000000000000000000000000000000..682b5b91d487d5237886383c899ae07e860ea4cf --- /dev/null +++ b/GW-custom/PingPong/Pong/pymakr.conf @@ -0,0 +1,11 @@ +{ + "py_ignore": [ + ".vscode", + ".gitignore", + ".git", + "env", + "venv", + "Pong.code-workspace" + ], + "name": "Pong" +} \ No newline at end of file