Пример #1
0
servo = AngularServo(25,
                     min_angle=-90,
                     max_angle=90,
                     min_pulse_width=0.0006,
                     max_pulse_width=0.0024)


def control(tokens):
    command = int(tokens[0])
    if command == 0:  # 주행모드
        x = int(tokens[1])
        y = int(tokens[2])
    elif command == 1:  #카메라 모드
        angle = int(tokens[1])
        servo.angle = angle


RFADDR = "00:18:91:D7:65:BC"
client_socket = BtSocket(RFCOMM)
client_socket.connect((RFADDR, 1))

try:
    while True:
        line = client_socket.readline()
        print(line)
        control(line.split(','))
except KeyboardInterrupt:
    print("Finished")

client_socket.close()
Пример #2
0
            car.backward(sy)
    elif sy < 0.3 and sx >= 0.3: # 회전
        if x > 0 :
            car.right(sx)
        else: 
            car.left(sx)
    else: # 나머지 영역은 어떻게 해석?
        car.stop()

def control(tokens):
    command = int(tokens[0])
    if command == 0 : # 주행모드
        x = int(tokens[1])
        y = int(tokens[2])
        car_control(x, y)
    elif command == 1 : #카메라 모드
        angle = int(tokens[1])
        # servo.angle = angle

client_socket=BtSocket( RFCOMM ) 
client_socket.connect(("00:18:91:D7:9F:C4", 1)) #접속 

try:
    while True:
        line = client_socket.readline()
        # print(line)
        control(line.split(','))
except KeyboardInterrupt:
    print("Finished")

client_socket.close() 
Пример #3
0
from bluetooth import * 
from btsocket import BtSocket

LINE_END =  "\r\n"

# Create the client socket 
# client_socket=BluetoothSocket( RFCOMM ) 
client_socket=BtSocket( RFCOMM )
client_socket.connect(("00:18:91:D7:67:13", 1))  # 접속 

try:
    while True: 
        msg = input("Send : ") + LINE_END 
        client_socket.send(msg) 	# 전송

        # msg = client_socket.recv(1024)  # 수신
        msg = client_socket.readline()
        print(f"recived message : {msg}")
except KeyboardInterrupt:
    print("Finished")

client_socket.close() 
Пример #4
0
            car.left(sx)
    else:
        car.stop()

def control(tokens):
    command = int(tokens[0])
    if command == 0 : # 주행모드
        x = int(tokens[1])
        y = int(tokens[2])
        # 자동차 제어
        car_contol(x, y)


    elif command == 1 : #카메라 모드
        angle = int(tokens[1])
        # servo.angle = angle

RFADDR = "00:18:91:D7:67:13"
client_socket=BtSocket( RFCOMM ) 
client_socket.connect((RFADDR, 1))  # 접속

try:
    while True:
        line = client_socket.readline()  # 동기 함수
        print(line)
        control(line.split(','))
except KeyboardInterrupt:
    print("Finished")

client_socket.close() 
Пример #5
0
from bluetooth import *
from btsocket import BtSocket

LINE_END = "\r\n"

client_socket = BtSocket(RFCOMM)
client_socket.connect(("00:18:91:D7:65:BC", 1))

try:
    while True:
        # msg = input("Send : ") + LINE_END
        # client_socket.send(msg) 	# 전송

        # msg = client_socket.recv(1024)
        msg = client_socket.readline()
        print(f"recived message : {msg}")

except KeyboardInterrupt:
    print("Finished")

client_socket.close()
Пример #6
0
from bluetooth import *
from btsocket import BtSocket

LINE_END = "\r\n"

#Create the client socket
# client_socket=BluetoothSocket(RFCOMM)
client_socket = BtSocket(RFCOMM)
client_socket.connect(("00:18:91:D7:9F:C4", 1))

try:
    while True:
        msg = input(S)
    msg = client_socket.recv(1024)  # 수신
    print(f"recived message : {msg}")

except KeyboardInterrupt:
    print("Finished")

client_socket.close()