Jump to content

Component: DC Motor (): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(15 intermediate revisions by 3 users not shown)
Line 15: Line 15:
DC Motor that can be driven in one or both directions using digital output pins, PWM or HBRIDGE peripherals.
DC Motor that can be driven in one or both directions using digital output pins, PWM or HBRIDGE peripherals.


==Component Source Code==
==Detailed description==
 
 
 
 
 
 


Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_Motor_with_reverse.fcfx FC_Comp_Source_Motor_with_reverse.fcfx]


==Detailed description==




Line 54: Line 58:




Simple example showing how to drive the motor components and how to create sub assemblies attached to the motor output shafts in the simulation panels.
 
{{Fcfile|Motors.fcfx|Motors}}
 
 
 
 
 
 
 
''<span style="color:red;">No additional examples</span>''


==Macro reference==
==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Break===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Coast'''
| width="90%" class="mtx-class-macrohead" | '''Break'''
|-
|-
| colspan="2" | Turn off power to the motor by setting the pins according to the 'Coast Pattern' property.&nbsp;
| colspan="2" | Actively drives both ends of the motor by setting the pins according to the 'Brake Pattern' property.&nbsp;
|-
|-
|-
|-
Line 72: Line 84:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Coast===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Break'''
| width="90%" class="mtx-class-macrohead" | '''Coast'''
|-
|-
| colspan="2" | Actively drives both ends of the motor by setting the pins according to the 'Brake Pattern' property.&nbsp;
| colspan="2" | Turn off power to the motor by setting the pins according to the 'Coast Pattern' property.&nbsp;
|-
|-
|-
|-
Line 85: Line 98:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Disable===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Disable'''
| width="90%" class="mtx-class-macrohead" | '''Disable'''
|-
|-
| colspan="2" | Disable the motor output&nbsp;
| colspan="2" | Disable the motor output&nbsp;
Line 98: Line 112:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Enable===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Forwards'''
| width="90%" class="mtx-class-macrohead" | '''Enable'''
|-
|-
| colspan="2" | Set the motor turning in the forwards direction by setting the pins according to the 'Reverse Pattern' property.&nbsp;
| colspan="2" | Enables the motor output&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Duty
|-
|-
| colspan="2" | Sets the motor power for PWM or H-Bridge outputs&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 116: Line 126:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Forwards===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''Forwards'''
|-
| colspan="2" | Set the motor turning in the forwards direction by setting the pins according to the 'Reverse Pattern' property.&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Enable'''
|-
|-
| colspan="2" | Enables the motor output&nbsp;
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Duty
|-
|-
| colspan="2" | Sets the motor power for PWM or H-Bridge outputs&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 129: Line 145:




{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===Reverse===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Reverse'''
| width="90%" class="mtx-class-macrohead" | '''Reverse'''
|-
|-
| colspan="2" | Set the motor turning in the reverse direction by setting the pins according to the 'Reverse Pattern' property.&nbsp;
| colspan="2" | Set the motor turning in the reverse direction by setting the pins according to the 'Reverse Pattern' property.&nbsp;
Line 145: Line 162:
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Control Type
| width="90%" class="mtx-class-propfolder" | Control Type
|-
|-
|-
|-
Line 176: Line 191:
| colspan="2" | Decides how the motor outputs are enabled.&nbsp;
| colspan="2" | Decides how the motor outputs are enabled.&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| width="90%" class="mtx-class-propfolder" | Connections
|-
|-
|-
|-
Line 210: Line 225:
| colspan="2" | States of pins A and B required to stop the motor.&nbsp;
| colspan="2" | States of pins A and B required to stop the motor.&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation Settings
| width="90%" class="mtx-class-propfolder" | Simulation Settings
|-
|-
|-
|-
Line 239: Line 254:
| colspan="2" | Which way the motor will rotate when the 'forwards' command is sent.&nbsp;
| colspan="2" | Which way the motor will rotate when the 'forwards' command is sent.&nbsp;
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Linkage
| width="90%" class="mtx-class-propfolder" | Linkage
|-
|-
|-
|-
Line 248: Line 263:
| colspan="2" | An object or group to link the motor to - the object will move along with the motor.&nbsp;
| colspan="2" | An object or group to link the motor to - the object will move along with the motor.&nbsp;
|}
|}
==Component Source Code==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Motor_with_reverse.fcfx FC_Comp_Source_Motor_with_reverse.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Motor_with_reverse.fcfx FC_Comp_Source_Motor_with_reverse.fcfx]

Latest revision as of 14:37, 13 July 2026

Author Matrix Ltd.
Version 1.2
Category


DC Motor component

DC Motor that can be driven in one or both directions using digital output pins, PWM or HBRIDGE peripherals.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Macro reference

Break

Break
Actively drives both ends of the motor by setting the pins according to the 'Brake Pattern' property. 
- VOID Return


Coast

Coast
Turn off power to the motor by setting the pins according to the 'Coast Pattern' property. 
- VOID Return


Disable

Disable
Disable the motor output 
- VOID Return


Enable

Enable
Enables the motor output 
- VOID Return


Forwards

Forwards
Set the motor turning in the forwards direction by setting the pins according to the 'Reverse Pattern' property. 
- UINT Duty
Sets the motor power for PWM or H-Bridge outputs 
- VOID Return


Reverse

Reverse
Set the motor turning in the reverse direction by setting the pins according to the 'Reverse Pattern' property. 
- UINT Duty
Sets the motor power for PWM or H-Bridge outputs 
- VOID Return


Property reference

Properties
Control Type
Control Method
Controls how the motor is controlled. On/Off requires output pins PWM requires a hardware PWM channel H-Bridge requires a hardware H-Bridge channel 
Bridge Type
 
Enable Method
Decides how the motor outputs are enabled. 
Connections
PinA
First control pin - set 'pattern' properties below to set the pin's function. 
PinB
Second control pin - set 'pattern' properties below to set the pin's function. 
Forwards Pattern
The state of pins A and B required to drive the motor in a forwards direction. 
Reverse Pattern
States of pins A and B required to drive the motor in a reverse direction. 
Coast Pattern
States of pins A and B required to stop the motor. 
Brake Pattern
States of pins A and B required to stop the motor. 
Simulation Settings
Speed
Speed of the motor when turned on. Positive speed -> Counter-clockwsie Negative speed -> Clockwise  
Acceleration
Speed change per second when the motor us powered. Set to zero for instantaneous speed changes.  
Deceleration
Speed change per second when the motor is coasting with no power. Set to zero for instantaneous speed changes. 
Show Actuator
When active, an actuator is shown on the motor spindle to make the animation easier to observe. 
Forwards Direction
Which way the motor will rotate when the 'forwards' command is sent. 
Linkage
Target Object
An object or group to link the motor to - the object will move along with the motor. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Motor_with_reverse.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Motor_with_reverse.fcfx