Modifications

Sauter à la navigation Sauter à la recherche
Ligne 83 : Ligne 83 :     
# Make sure you include <AFMotor.h>
 
# Make sure you include <AFMotor.h>
# Create the AF_DCMotor object with '''AF_DCMotor(motor#, frequency)''', to setup the motor H-bridge and latches. The constructor takes two arguments.
+
# Create the AF_DCMotor object with '''AF_DCMotor(motor#, frequency)''', to setup the motor H-bridge and latches. The constructor takes two arguments.<br />
    The first is which port the motor is connected to, '''1, 2, 3''' or '''4'''.
+
The first is which port the motor is connected to, '''1, 2, 3''' or '''4'''.
  ''' ''frequency''' '' is how fast the speed controlling signal is.
+
''' ''frequency''' '' is how fast the speed controlling signal is.<br />
    For motors 1 and 2 you can choose '''MOTOR12_64KHZ, MOTOR12_8KHZ, MOTOR12_2KHZ''', or '''MOTOR12_1KHZ'''. A high speed like 64KHz wont be audible but a low speed like 1KHz will use less power. Motors 3 & 4 are only possible to run at 1KHz and will ignore any setting given
+
For motors 1 and 2 you can choose '''MOTOR12_64KHZ, MOTOR12_8KHZ, MOTOR12_2KHZ''', or '''MOTOR12_1KHZ'''. A high speed like 64KHz wont be audible but a low speed like 1KHz will use less power. Motors 3 & 4 are only possible to run at 1KHz and will ignore any setting given
 
# Then you can set the speed of the motor using '''setSpeed(speed)''' where the ''speed'' ranges from 0 (stopped) to 255 (full speed). You can set the speed whenever you want.
 
# Then you can set the speed of the motor using '''setSpeed(speed)''' where the ''speed'' ranges from 0 (stopped) to 255 (full speed). You can set the speed whenever you want.
 
# To run the motor, call '''run(direction)''' where direction is '''FORWARD, BACKWARD''' or '''RELEASE'''. Of course, the Arduino doesn't actually know if the motor is 'forward' or 'backward', so if you want to change which way it thinks is forward, simply swap the two wires from the motor to the shield.
 
# To run the motor, call '''run(direction)''' where direction is '''FORWARD, BACKWARD''' or '''RELEASE'''. Of course, the Arduino doesn't actually know if the motor is 'forward' or 'backward', so if you want to change which way it thinks is forward, simply swap the two wires from the motor to the shield.
29 917

modifications

Menu de navigation