def main(): if getKey('LEFT'): M.MoveL(2130) stuur(1) M.MoveF(28) elif getKey('RIGHT'): M.MoveR(1690) stuur(3) M.MoveF(28) elif getKey('DOWN'): M.MoveB(50) else: M.Stop() stuur(2) M.MoveF(24)
def main(): if getKey('LEFT'): M.MoveL(2130) elif getKey('RIGHT'): M.MoveR(1690) elif getKey('UP'): M.MoveF(35) elif getKey('DOWN'): M.MoveB(50) else: M.Stop()
stringData = data.tostring() s.sendall((str(len(stringData))).encode().ljust(16) + stringData) recvData = s.recv(512).decode('utf-8') # print(recvData) if recvData == 'S': motor.Forward(13) print('Driving Slow') pre_data = 'S' elif recvData == 'R': motor.Forward(25) print('Normal Driving') pre_data = '' elif recvData == 'T': motor.Stop() print('Redlight Stop') elif recvData == 'G': motor.Stop() print('Stop sign Stop') pre_data = 'G' elif pre_data == 'G' and recvData == 'N': motor.Forward(25) print('Normal Driving') pre_data = '' if pre_data == 'S': dist = choeumpa.distance() if dist <= 7: print('Force Stop!!') motor.Stop()
###################################################################### #snelheid = s, s configureren/fine_tunen naar keuze, s = 23 standaard# s = 30 ###################################################################### if sensor <= 20: # Als auto binnen bepaale afstand wat ziet dan stop M.Stop2() print("stop") else: if top == 1: #links M.MoveL(2130) print("links") M.MoveF(s + 2) elif top == 3: #rechts M.MoveR(1690) print("rechts") M.MoveF(s + 2) elif top == 2: #rechtdoor M.Stop() print("rechtdoor") M.MoveF(s) ### OPLETTEN MET SCRIPT STOPPEN: AUTO KNALT DOOR