22 lines
470 B
Python
Executable File
22 lines
470 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import socket
|
|
import time
|
|
import struct
|
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
pico_address = ('255.255.255.255', 4243)
|
|
|
|
packet_number = 0
|
|
instruction = 0
|
|
|
|
while True:
|
|
# Créer le message binaire
|
|
message = struct.pack('BB', packet_number, instruction)
|
|
sock.sendto(message, pico_address)
|
|
|
|
packet_number = (packet_number + 1) % 256
|
|
instruction = (instruction + 1) % 256
|
|
print("Sended")
|
|
time.sleep(3.5)
|