PySerial (Python) + Arduino sensors
hey guys,
i'm trying write simple program using pyserial.
i have 2 servos , 2 touch sensors.
i want write when touch each sensor, corresponding servo move.
i've managed set pyserial, , control servo it. main problem reading touch sensors when touched, , discerning touch sensor being touched.
here's python code if you're interested. (this takes in number input , sends arduino. arduino moves servo according number).
would appreciate help. guys.
i'm trying write simple program using pyserial.
i have 2 servos , 2 touch sensors.
i want write when touch each sensor, corresponding servo move.
i've managed set pyserial, , control servo it. main problem reading touch sensors when touched, , discerning touch sensor being touched.
here's python code if you're interested. (this takes in number input , sends arduino. arduino moves servo according number).
code: [select]
import serial serial
def main():
serial = serial.serial('/dev/tty.usbmodem621', 9600)
char = 't'
while char != 'e':
char = raw_input( '> ' )
numb = int( char )
numb_ascii = chr( numb )
char = numb_ascii
if char == 'e':
break;
serial.write( char )
print "->", serial.readline().rstrip( '\r' ).rstrip( '\n' )
serial.close()
if __name__ == '__main__':
main()
would appreciate help. guys.
the python program can't read sensors. arduino can. making python script ask arduino read sensor 1 possible. making python script ask arduino read sensor 2 possible. making python script ask arduino move servo n position p possible.
those python issues, though, , not python forum.
making arduino read sensor n pretty easy. making arduino move servo n position p pretty easy. but, you've not posted code, or asked how that, there doesn't seem can you.
those python issues, though, , not python forum.
making arduino read sensor n pretty easy. making arduino move servo n position p pretty easy. but, you've not posted code, or asked how that, there doesn't seem can you.
Arduino Forum > Using Arduino > Programming Questions > PySerial (Python) + Arduino sensors
arduino
Comments
Post a Comment