Difference between revisions of "Mixly Block Category - Actuator"
(→Stepper Motor) |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Servo= | =Servo= | ||
+ | Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/Servo | ||
==Set Position in Degrees with Delay== | ==Set Position in Degrees with Delay== | ||
+ | Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement). A configurable delay time is added after calling the servo to move to allow to the requested angle. | ||
+ | |||
+ | *Servo Pin # - The pin number that the servo is connected to. | ||
+ | *Degree (0~180) - The angle to move the servo shaft to. | ||
+ | *Delay (ms) - A delay in milliseconds after requesting the servo to move. This allows the servo physically move the servo shaft to the request angle. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/ServoWrite | ||
==Set Position in Microseconds (PWM)== | ==Set Position in Microseconds (PWM)== | ||
+ | Writes a value in microseconds (uS) to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft. On standard servos a parameter value of 1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle. | ||
+ | *Servo Pin # - The pin number that the servo is connected to. | ||
+ | *Microseconds - Set the direct PWM value (instead of an angle) that is sent to the Servo. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/ServoWriteMicroseconds | ||
==Read Position== | ==Read Position== | ||
+ | Returns the current angle of the servo (the value passed to the last call to '''Set Position in Degrees'''). | ||
+ | *Servo Pin # - The pin number that the servo is connected to. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/ServoRead | ||
+ | |||
=Tone= | =Tone= | ||
==Output Tone with Frequency== | ==Output Tone with Frequency== | ||
− | * | + | ===Without Duration=== |
− | *With | + | Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until a call to '''Stop Output Tone'''. The pin can be connected to a piezo buzzer or other speaker to play tone. |
+ | *Tone Pin # - The pin number that has the attached piezo buzzer or speaker. | ||
+ | *Frequency - The frequency of the tone in hertz to generate. | ||
+ | Note: '''Stop Output Tone''' needs to be called to stop tone generation. | ||
+ | |||
+ | ===With Duration=== | ||
+ | Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until the duration time completes. The pin can be connected to a piezo buzzer or other speaker to play tone. | ||
+ | *Tone Pin # - The pin number that has the attached piezo buzzer or speaker. | ||
+ | *Frequency - The frequency of the tone in hertz to generate. | ||
+ | *Duration (ms) - The time in milliseconds to output the tone. | ||
+ | |||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/Tone | ||
==Stop Output Tone== | ==Stop Output Tone== | ||
− | = | + | Stops the generation of a square wave triggered by '''Output Tone with Frequency Without Duration'''. Has no effect if no tone is being generated. |
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/NoTone | ||
+ | |||
+ | =LCD= | ||
+ | Allows you to control LCD displays. | ||
+ | |||
+ | Read more here: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library | ||
==Setup== | ==Setup== | ||
+ | Setup the LCD display for use. This block is required to be called to initialize the LCD and configure. | ||
+ | ===Using Hardware I2C (Default)=== | ||
+ | *LCD Type - The type of LCD connected -- LCM1602 or LCM2004. | ||
+ | *LCD Name - Variable name for the LCD. Any name can be chosen. Used to reference in other blocks. | ||
+ | *Address - I2C address of the LCD module connected. Usually, included in the datasheet or document that is supplied with the module. Or a simple Google search on the LCD module number will yield the I2C address. Or use an I2C scanner to detect the address. <br/> | ||
+ | ===Using Software I2C (Alternative)=== | ||
+ | *LCD Type - The type of LCD connected -- LCM1602 or LCM2004. | ||
+ | *LCD Name - Variable name for the LCD. Any name can be chosen. Used to reference in other blocks. | ||
+ | *Address - I2C address of the LCD module connected. Usually, included in the datasheet or document that is supplied with the module. Or a simple Google search on the LCD module number will yield the I2C address. Or use an I2C scanner to detect the address. | ||
+ | *SCL Pin # & SDA Pin # - SCL & SDA pin numbers to use with Software I2C. Read more here about software I2C: http://playground.arduino.cc/Main/SoftwareI2CLibrary | ||
==Print String== | ==Print String== | ||
− | *Line | + | Display string on the LCD module. |
− | *Row / Column | + | ===Line 1 / Line 2=== |
− | == | + | *LCD Name - The name of the variable of the LCD as defined in the setup (see above). |
+ | *Line 1 - String to display on the first line of the LCD screen. | ||
+ | *Line 2 - String to display on the second line of the LCD screen. | ||
+ | ===Row / Column=== | ||
+ | *LCD Name - The name of the variable of the LCD as defined in the setup (see above). | ||
+ | *Row - Row number to where the start of the String will be printed. | ||
+ | *Column - Column number to where the start of the String will be printed. | ||
+ | *String - Text that will be display starting at the '''Row''' and '''Column'''. | ||
+ | |||
+ | ==Commands== | ||
+ | Performs a command on the LCD. | ||
+ | *LCD Name - The variable name of the LCD which will be acted upon. Variable name is set during the '''setup''' (see above). | ||
+ | *Action - Various action to perform on the LCD. | ||
+ | **On - Turns on the LCD screen. | ||
+ | **Off - Turns off the LCD screen. | ||
+ | **Cursor - Enables the cursor (under scroll) on the selected row and column on the display. | ||
+ | **noCursor - Disables the cursor (under scroll) the display. | ||
+ | **Blink - Enables character blinking on the selected row and column. | ||
+ | **noBlink - Disables character blinking on the selected row and column. | ||
+ | |||
=Stepper Motor= | =Stepper Motor= | ||
+ | Allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/Stepper | ||
==Setup== | ==Setup== | ||
− | *2 Pin | + | Creates a new instance of the Stepper class that represents a particular stepper motor attached. Support for both 2 pin and 4 pin stepper motors. Information such as steps per revolution and bipolar / unipolar of a particular stepper motor can be found online using Google. |
− | *4 | + | |
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/StepperConstructor , https://www.arduino.cc/en/Reference/StepperSetSpeed | ||
+ | ===2 Pin=== | ||
+ | *Stepper Name - A variable name for the stepper motor. | ||
+ | *Pin #1 - Control pin 1 of the stepper motor. | ||
+ | *PIn #2 - Control pin 2 to the stepper motor. | ||
+ | *Steps Per Revolution - The number of steps contain in one revolution of the stepper (360 degree rotation). | ||
+ | *Set Speed - Sets the motor speed in rotations per minute (RPMs). This function doesn't make the motor turn, just sets the speed at which it will when you call '''step'''. | ||
+ | ===4 Pin=== | ||
+ | *Stepper Name - A variable name for the stepper motor. | ||
+ | *Pin #1 - Control pin 1 of the stepper motor. | ||
+ | *PIn #2 - Control pin 2 to the stepper motor. | ||
+ | *Pin #3 - Control pin 3 of the stepper motor. | ||
+ | *PIn #4 - Control pin 4 to the stepper motor. | ||
+ | *Steps Per Revolution - The number of steps contain in one revolution of the stepper (360 degree rotation). | ||
+ | *Set Speed - Sets the motor speed in rotations per minute (RPMs). This function doesn't make the motor turn, just sets the speed at which it will when you call '''step'''. | ||
==Step== | ==Step== | ||
+ | Turns the motor a specific number of steps, at a speed determined in '''setup'''. | ||
+ | *Stepper Name - Variable name for the stepper motor. As defined in '''setup''' (see above). | ||
+ | *Step - the number of steps to turn the motor - positive to turn one direction, negative to turn the other. | ||
+ | |||
+ | |||
+ | Read more here: https://www.arduino.cc/en/Reference/StepperStep |
Latest revision as of 01:01, 24 February 2017
Contents
Servo
Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds.
Read more here: https://www.arduino.cc/en/Reference/Servo
Set Position in Degrees with Delay
Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement). A configurable delay time is added after calling the servo to move to allow to the requested angle.
- Servo Pin # - The pin number that the servo is connected to.
- Degree (0~180) - The angle to move the servo shaft to.
- Delay (ms) - A delay in milliseconds after requesting the servo to move. This allows the servo physically move the servo shaft to the request angle.
Read more here: https://www.arduino.cc/en/Reference/ServoWrite
Set Position in Microseconds (PWM)
Writes a value in microseconds (uS) to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft. On standard servos a parameter value of 1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle.
- Servo Pin # - The pin number that the servo is connected to.
- Microseconds - Set the direct PWM value (instead of an angle) that is sent to the Servo.
Read more here: https://www.arduino.cc/en/Reference/ServoWriteMicroseconds
Read Position
Returns the current angle of the servo (the value passed to the last call to Set Position in Degrees).
- Servo Pin # - The pin number that the servo is connected to.
Read more here: https://www.arduino.cc/en/Reference/ServoRead
Tone
Output Tone with Frequency
Without Duration
Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until a call to Stop Output Tone. The pin can be connected to a piezo buzzer or other speaker to play tone.
- Tone Pin # - The pin number that has the attached piezo buzzer or speaker.
- Frequency - The frequency of the tone in hertz to generate.
Note: Stop Output Tone needs to be called to stop tone generation.
With Duration
Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until the duration time completes. The pin can be connected to a piezo buzzer or other speaker to play tone.
- Tone Pin # - The pin number that has the attached piezo buzzer or speaker.
- Frequency - The frequency of the tone in hertz to generate.
- Duration (ms) - The time in milliseconds to output the tone.
Read more here: https://www.arduino.cc/en/Reference/Tone
Stop Output Tone
Stops the generation of a square wave triggered by Output Tone with Frequency Without Duration. Has no effect if no tone is being generated.
Read more here: https://www.arduino.cc/en/Reference/NoTone
LCD
Allows you to control LCD displays.
Read more here: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
Setup
Setup the LCD display for use. This block is required to be called to initialize the LCD and configure.
Using Hardware I2C (Default)
- LCD Type - The type of LCD connected -- LCM1602 or LCM2004.
- LCD Name - Variable name for the LCD. Any name can be chosen. Used to reference in other blocks.
- Address - I2C address of the LCD module connected. Usually, included in the datasheet or document that is supplied with the module. Or a simple Google search on the LCD module number will yield the I2C address. Or use an I2C scanner to detect the address.
Using Software I2C (Alternative)
- LCD Type - The type of LCD connected -- LCM1602 or LCM2004.
- LCD Name - Variable name for the LCD. Any name can be chosen. Used to reference in other blocks.
- Address - I2C address of the LCD module connected. Usually, included in the datasheet or document that is supplied with the module. Or a simple Google search on the LCD module number will yield the I2C address. Or use an I2C scanner to detect the address.
- SCL Pin # & SDA Pin # - SCL & SDA pin numbers to use with Software I2C. Read more here about software I2C: http://playground.arduino.cc/Main/SoftwareI2CLibrary
Print String
Display string on the LCD module.
Line 1 / Line 2
- LCD Name - The name of the variable of the LCD as defined in the setup (see above).
- Line 1 - String to display on the first line of the LCD screen.
- Line 2 - String to display on the second line of the LCD screen.
Row / Column
- LCD Name - The name of the variable of the LCD as defined in the setup (see above).
- Row - Row number to where the start of the String will be printed.
- Column - Column number to where the start of the String will be printed.
- String - Text that will be display starting at the Row and Column.
Commands
Performs a command on the LCD.
- LCD Name - The variable name of the LCD which will be acted upon. Variable name is set during the setup (see above).
- Action - Various action to perform on the LCD.
- On - Turns on the LCD screen.
- Off - Turns off the LCD screen.
- Cursor - Enables the cursor (under scroll) on the selected row and column on the display.
- noCursor - Disables the cursor (under scroll) the display.
- Blink - Enables character blinking on the selected row and column.
- noBlink - Disables character blinking on the selected row and column.
Stepper Motor
Allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it.
Read more here: https://www.arduino.cc/en/Reference/Stepper
Setup
Creates a new instance of the Stepper class that represents a particular stepper motor attached. Support for both 2 pin and 4 pin stepper motors. Information such as steps per revolution and bipolar / unipolar of a particular stepper motor can be found online using Google.
Read more here: https://www.arduino.cc/en/Reference/StepperConstructor , https://www.arduino.cc/en/Reference/StepperSetSpeed
2 Pin
- Stepper Name - A variable name for the stepper motor.
- Pin #1 - Control pin 1 of the stepper motor.
- PIn #2 - Control pin 2 to the stepper motor.
- Steps Per Revolution - The number of steps contain in one revolution of the stepper (360 degree rotation).
- Set Speed - Sets the motor speed in rotations per minute (RPMs). This function doesn't make the motor turn, just sets the speed at which it will when you call step.
4 Pin
- Stepper Name - A variable name for the stepper motor.
- Pin #1 - Control pin 1 of the stepper motor.
- PIn #2 - Control pin 2 to the stepper motor.
- Pin #3 - Control pin 3 of the stepper motor.
- PIn #4 - Control pin 4 to the stepper motor.
- Steps Per Revolution - The number of steps contain in one revolution of the stepper (360 degree rotation).
- Set Speed - Sets the motor speed in rotations per minute (RPMs). This function doesn't make the motor turn, just sets the speed at which it will when you call step.
Step
Turns the motor a specific number of steps, at a speed determined in setup.
- Stepper Name - Variable name for the stepper motor. As defined in setup (see above).
- Step - the number of steps to turn the motor - positive to turn one direction, negative to turn the other.
Read more here: https://www.arduino.cc/en/Reference/StepperStep