Hi im new in this field and i would like to get some help.
Okay so im having trouble getting to run my servos through the python/ arduino software. I cant open the servo.py on the arduino-python-4-axis-servo-control website to save onto my pc. So whenever I write import servo, it says " print ' serial port has been changed to ' + usbport Syntax error: invalid syntax ".
I really need help on overcoming this 'hill'.
Thanks in advance.
Rim
you mean - principialabs.com - This website is for sale! - principialabs Resources and Information. - ? (there is a nice movie)
Could you post your code so far ?
please use the # button to add code tags around the separate files.
What platform are you using?
I could open servo.py, see below, note it is 'tuned' for linux not windows
#!/usr/bin/env python
################################################
# Module: servo.py
# Created: 2 April 2008
# Author: Brian D. Wendt
# http://principialabs.com/
# Version: 0.2
# License: GPLv3
# http://www.fsf.org/licensing/
'''
Provides a serial connection abstraction layer
for use with Arduino "MultipleServos" sketch.
'''
################################################
import serial
usbport = '/dev/ttyUSB0'
ser = serial.Serial(usbport, 9600, timeout=1)
#print ser
def move(servo, angle):
'''Moves the specified servo to the supplied angle.
Arguments:
servo
the servo number to command, an integer from 1-4
angle
the desired servo angle, an integer from 0 to 180
(e.g.) >>> servo.move(2, 90)
... # "move servo #2 to 90 degrees"'''
if (0 <= angle <= 180):
ser.write(chr(255))
ser.write(chr(servo))
ser.write(chr(angle))
else:
print "Servo angle must be an integer between 0 and 180.\n"
Im absolutely new to this, i did not know it was for linux instead of windows. Im looking for servo coding tutorials but im having alot of trouble. Im trying to create a walking little robot; i have the frame/ servos / arduino and everything but i cant get it to move how i want because im lacking in coding knowledge. If you have any tips or anything that would help me reach my goal, it would be greatly appreciated : ) !
Thanks again,
Rim
If you are absolutely new to the Arduino spend some time in the Tutorial Section - http://arduino.cc/en/Tutorial/HomePage - there is a lot to learn and the best way to learn the Arduino fast is to make little steps. You will learn a lot about LED's voltages, inputs outputs servos etc.
Succes