def getNewCoords(Coords, ListenFlag):
    temp = BLE.listen()
    temp = temp.replace('_', '')
    print(temp)
    positions = encoder.decodeMessage(temp)
    #Work on this
    for i in range(len(positions)):
        if myID is positions[i][0]:
            myCoords = positions[i]
            Coords = (myCoords[1], myCoords[2])
            ListenFlag = 0
            f = open("settings.csv", "w")
            f.write(f"L,X,Y\n{ListenFlag},{Coords[0]},{Coords[1]}")
            f.close()
    return Coords
Пример #2
0
def getNewCoords(Coords):
    global ListenFlag
    #Gets f****d up / in some type of infinite loop on the next line
    temp = BLE.listen()
    #End f*****g up
    temp = temp.replace('_', '')
    print(temp)
    positions = encoder.decodeMessage(temp)
    #Work on this
    for i in range(len(positions)):
        if myID is positions[i][0]:
            myCoords = positions[i]
            Coords = (myCoords[1], myCoords[2])
            ListenFlag = 0
            f = open(settings_address, "w")
            f.write(f"L,X,Y,ID\n{ListenFlag},{Coords[0]},{Coords[1]},{myID}")
            f.close()
    return Coords
Пример #3
0
	def receiveMessages():
		if self.device_type == 0:
			msg = BLE.listen()
Пример #4
0
import BLE

device_type = 0

# Rx Messages
# def listen(UUID = "ABC4", maxNumMessages = 5)
if device_type == 0:
	message = BLE.listen()

#Tx Messages
# def broadcast_setup()
# def broadcast(data, UUID = "ABC4", Number_of_Broadcast_Cycles = 3, Time_Between_Transmissions = 15)
if device_type:
	message = "Hello!"
	broadcast_setup() # Only need to call this once after boot (or after using listen function)
	broadcast(message)
Пример #5
0
import BLE
BLE.listen()