#! /usr/bin/env python """ This is an example that demonstrates how to use a a DC Motor with BreakfastSerial. It assumes you have a motor wired up to PWM pin 9. Expected behavior is: 0 Seconds: Turn on motor to 80% speed 3 Seconds: Set speed to 50% 6 Seconds: Turn off motor """ from BreakfastSerial import Arduino, Motor from time import sleep board = Arduino() motor = Motor(board, 9) motor.start(80) sleep(3) motor.speed = 50 sleep(3) motor.stop() # Run an interactive shell so you can play (not required) import code code.InteractiveConsole(locals=globals()).interact()
# from pyfirmata import Arduino, util # board = Arduino('/dev/tty.usbserial-A601EGIN') # board.digital[13].write(1) from BreakfastSerial import Arduino, Motor from time import sleep board = Arduino() motor = Motor(board, "10") motor.start(80) sleep(2) motor.speed = 160 sleep(2) # servo.move(200) # sleep(2) # servo.move(-200) # sleep(2) # servo.move(100) # sleep(2) motor.stop()
a DC Motor with BreakfastSerial. It assumes you have a motor wired up to PWM pin 9. Expected behavior is: 0 Seconds: Turn on motor to 80% speed 3 Seconds: Set speed to 50% 6 Seconds: Turn off motor """ from BreakfastSerial import Arduino, Motor from time import sleep board = Arduino() motor = Motor(board, 9) motor.start(80) sleep(3) motor.speed = 50 sleep(3) motor.stop() # Run an interactive shell so you can play (not required) import code code.InteractiveConsole(locals=globals()).interact() ########NEW FILE######## __FILENAME__ = potentiometer #! /usr/bin/env python """ This is an example that demonstrates how to use a potentiometer to fade an LED with BreakfastSerial. It assumes you have an potentiometer wired up to pin A0 and a LED on pin 9.