Ejemplo n.º 1
0
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

import time
import jetduino
from jetduino_pins import *

start_pin = ARD_D2

print("attaching to servos.")
for servo in range(0,12):
    jetduino.servoAttach(start_pin + servo)
    time.sleep(.1)

while True:
    try:
        for angle in range(0,180):
            #print("    angle %d" % angle)
            for servo in range(0,12):
                jetduino.servoWrite(start_pin + servo, angle)

            time.sleep(0.05)

    except KeyboardInterrupt:
        print("Exiting loop")
        break
    except IOError:
Ejemplo n.º 2
0
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

import time
import jetduino
from jetduino_pins import *

servo_pin = ARD_D4

print("attaching to servo.")
jetduino.servoAttach(servo_pin)
time.sleep(.1)

print("Moving servo to angle 0.")
jetduino.servoWrite(servo_pin, 0)
time.sleep(0.3)

print("Reading servo angle.")
cur_angle = jetduino.servoRead(servo_pin)
print ("angle =", cur_angle)
time.sleep(1)

print("Moving servo to angle 180.")
jetduino.servoWrite(servo_pin, 180)
time.sleep(0.3)