Esempio n. 1
0
sample_map = collections.OrderedDict((
    ('316', 1570 + 855),
    ('OREAS 74a', 1570 + 640),
    ('6063', 1570 + 420),
    ('NIST 2710a', 1570 + 222),
    ('PVC High', 1570),
    ('Gold Plating', 1570 - 230),
    ('PVC Low', 1570 - 450),
    ('304', 1570 - 670),
    ('Pure Gold', 1570 - 878)
))

connection = SerialManager(device='/dev/ttyUSB0')
a = ArduinoApi(connection=connection)
servo = Servo(3)
servo.writeMicroseconds(1570 + 855)

host = "0.0.0.0"
port = 7777

s = socket(AF_INET, SOCK_STREAM)
s.bind((host, port))
s.listen(5)
print("Sample Changer ready")

while True:
    print("Waiting for client...")
    q, addr = s.accept()

    print("Connected client: %s" % (addr, ))
    while True:
Esempio n. 2
0
from nanpy import (ArduinoApi, SerialManager)
from time import sleep

connection = SerialManager()
a = ArduinoApi(connection=connection)

from nanpy import Servo

MIN_PULSE_LENGTH = 1000
MAX_PULSE_LENGTH = 2000
motA = Servo(4)
motA.attached()
motA.writeMicroseconds(0)
val = input("Enter your value: ")


def min_throttle():
    print("Sending minimum throttle")
    motA.writeMicroseconds(MIN_PULSE_LENGTH)


def max_throttle():
    print("Sending maximum throttle")
    motA.writeMicroseconds(MAX_PULSE_LENGTH)


def test_run():
    print("Running test in 3 \n")
    sleep(1)
    print(" 2\n")
    sleep(1)
Esempio n. 3
0
a = ArduinoApi(connection=connection)
wire = Wire(connection=connection)

MIN_PULSE_LENGTH = 1000
MAX_PULSE_LENGTH = 2000
motA = Servo(0)
motB = Servo(0)
motC = Servo(0)
motD = Servo(0)

motA.attached()
motB.attached()
motC.attached()
motD.attached()

motA.writeMicroseconds(0)
motB.writeMicroseconds(0)
motC.writeMicroseconds(0)
motD.writeMicroseconds(0)

sleep(1)  # /*Give some delay, 7s, to have time to connect


def pid_loop(new_error_list):
    print("Error values :" + str(new_error_list))
    rad_to_deg = 180 / math.pi
    # """
    # ////////////////////////////////////////////////////////////////////////////////////
    # //PID gain and limit settings
    # ////////////////////////////////////////////////////////////////////////////////////
    # """