Page 1 of 1
is it possible to slave 2 arduino in raspberry pi 3 in serial port using nanpy
Posted: Sat Mar 10, 2018 7:05 am
by arvin
it's possible to slave 2 arduino in raspberry pi 3 in serial port using nanpy ?? if not please recommend another way to solve my problem. thanks in advanced
Re: is it possible to slave 2 arduino in raspberry pi 3 in serial port using nanpy
Posted: Sat Mar 10, 2018 3:22 pm
by mahjongg
What actually IS your "problem"?
Re: is it possible to slave 2 arduino in raspberry pi 3 in serial port using nanpy
Posted: Sat Mar 10, 2018 3:30 pm
by KLL
from
doc
Nanpy autodetects the serial port for you, anyway you can manually specify another serial port:
from nanpy import SerialManager
connection = SerialManager(device='/dev/ttyACM1')
so you can manually connect to 2 ( USB connected ) arduinos
after you find the "ttyACM1 / 2"... info )
Re: is it possible to slave 2 arduino in raspberry pi 3 in serial port using nanpy
Posted: Sun Mar 11, 2018 11:23 am
by arvin
so you can manually connect to 2 ( USB connected ) arduinos
after you find the "ttyACM1 / 2"... info )
im using this code. i want output is on/off 1 LED in every arduino . but the problem is one arduino only to on led i want both
Code: Select all
from nanpy import SerialManager
from time import sleep
from nanpy import ArduinoApi
connection = SerialManager(device='/dev/ttyUSB0')
connection = SerialManager(device='/dev/ttyUSB1')
a = ArduinoApi(connection=connection)
b = ArduinoApi(connection=connection)
a.pinMode(7, a.OUTPUT)
b.pinMode(7, b.OUTPUT)
a.digitalWrite(7, a.HIGH)
b.digitalWrite(7, b.HIGH)
print"LED ON"
sleep(3)
a.digitalWrite(7, a.LOW)
Re: is it possible to slave 2 arduino in raspberry pi 3 in serial port using nanpy
Posted: Sun Mar 11, 2018 12:31 pm
by KLL
pls use code tags
should it be like
Code: Select all
connection1 = SerialManager(device='/dev/ttyUSB0') # Arduino 1
a = ArduinoApi(connection=connection1)
connection2 = SerialManager(device='/dev/ttyUSB1') # Arduino 2
b = ArduinoApi(connection=connection2)
your code is overwriting its variable ( link ) so only the second ( line) could work.
are that connections / ports already tested by a serial monitor tool ( like arduino ide... ) means verified?
Re: is it possible to slave 2 arduino in raspberry pi 3 in serial port using nanpy
Posted: Sun Mar 11, 2018 12:51 pm
by mahjongg
added code tags, but there are no indentations in this code, so it was not necessary.