Thank you for your response.
it's not Firmdata, it's Firmata.
The Firmata library implements the Firmata protocol for communicating with software on the host computer. This allows you to write custom firmware without having to create your own protocol and objects for the programming environment that you are using.
There are other moves in board2,
but I removed them because they were not related to the question.
I'll show you the whole code.
from pyfirmata import Arduino, util
import time
import pymysql
conn = pymysql.connect(host='localhost',
user='root',
password='1234',
db='taro',
charset='utf8')
port = '/dev/ttyACM1'
board = Arduino(port)
time.sleep(1)
port2 = '/dev/ttyACM2'
board2 = Arduino(port2)
time.sleep(1)
pin2 = board.get_pin('d:2:o')
pin3 = board.get_pin('d:3:o')
pin4 = board.get_pin('d:4:o')
pin5 = board.get_pin('d:5:o')
pin6 = board.get_pin('d:6:o')
pin7 = board.get_pin('d:7:o')
SERVO = 9
servoPin = board.get_pin('d:9:s')
sensor1 = board.get_pin('a:0:i')
sensor2 = board.get_pin('a:1:i')
robotA_6 = board2.get_pin('d:11:s')
num = 0
i = 0
it = util.Iterator(board)
it.start()
sensor1.enable_reporting()
sensor2.enable_reporting()
print('start')
servoPin.write(142)
pin2.write(1)
pin3.write(0)
pin4.write(1)
pin5.write(0)
pin6.write(1)
pin7.write(0)
while(True):
beam1= sensor1.read()
beam2 = sensor2.read()
if beam1 is None:
print('1:',beam1)
elif num == 0 and beam1 <= 0.1 :
print('A')
print('1:',beam1)
i = i + 1
time.sleep(5)
num = i%2
elif num == 1 and beam1 <= 0.1 :
print('B')
print('1:',beam1)
time.sleep(2)
servoPin.write(45)
time.sleep(6)
servoPin.write(142)
i = i + 1
num = i%2
if beam2 is None:
print('2:',beam2)
elif beam2 <= 0.1 :
print('2:',beam2)
check = check + 1
if check > 0 :
time.sleep(2)
for n in range(20, 70, 1):
robotA_6.write(n)
time.sleep(0.002)
time.sleep(2)
for n in range(70, 20, -1):
robotA_6.write(n)
time.sleep(0.002)
time.sleep(2)
board.exit()
It is not a completed code but it is being tested to get the input value properly.