RCServo Entity¶
See the RCServo Entity for generic information.
- group RCServoEntity
Interface to servo entities on BrainStem modules. Servo entities are built upon the digital input/output pins and therefore can also be inputs or outputs. Please see the product datasheet on the configuration limitations.
-
void rcservo_setEnable(unsigned int *id, struct Result *result, const int index, const unsigned char enable)¶
Enable the servo channel
The result parameter will output the following fields:
error: Common EntityClass Return Values common entity return value
- Parameters:
id – ID assigned through “module_createStem”
result – Output object containing result code.
index – The index of the entity in question.
enable – The state to be set. 0 is disabled, 1 is enabled.
-
void rcservo_getEnable(unsigned int *id, struct Result *result, const int index)¶
Get the enable status of the servo channel.
The result parameter will output the following fields:
error: Common EntityClass Return Values common entity return value
value: The current enable status of the servo entity. 0 is disabled, 1 is enabled.
- Parameters:
id – ID assigned through “module_createStem”
result – Output object containing result code and the requested value if successful.
index – The index of the entity in question.
-
void rcservo_setPosition(unsigned int *id, struct Result *result, const int index, const unsigned char position)¶
Set the position of the servo channel
The result parameter will output the following fields:
error: Common EntityClass Return Values common entity return value
- Parameters:
id – ID assigned through “module_createStem”
result – Output object containing result code.
index – The index of the entity in question.
position – The position to be set. Default 64 = a 1ms pulse and 192 = a 2ms pulse.
-
void rcservo_getPosition(unsigned int *id, struct Result *result, const int index)¶
Get the position of the servo channel
The result parameter will output the following fields:
error: Common EntityClass Return Values common entity return value
value: The current position of the servo channel. Default 64 = a 1ms pulse and 192 = a 2ms pulse.
- Parameters:
id – ID assigned through “module_createStem”
result – Output object containing result code and the requested value if successful.
index – The index of the entity in question.
-
void rcservo_setReverse(unsigned int *id, struct Result *result, const int index, const unsigned char reverse)¶
Set the output to be reversed on the servo channel
The result parameter will output the following fields:
error: Common EntityClass Return Values common entity return value
- Parameters:
id – ID assigned through “module_createStem”
result – Output object containing result code.
index – The index of the entity in question.
reverse – Reverses the value set by “setPosition”. For example, if the position is set to 64 (1ms pulse) the output will now be 192 (2ms pulse), however “getPostion” will return the set value of 64. 0 = not reversed, 1 = reversed.
-
void rcservo_getReverse(unsigned int *id, struct Result *result, const int index)¶
Get the reverse status of the servo channel
The result parameter will output the following fields:
error: Common EntityClass Return Values common entity return value
value: The current reverse status of the servo entity. 0 = not reversed, 1 = reversed.
- Parameters:
id – ID assigned through “module_createStem”
result – Output object containing result code and the requested value if successful.
index – The index of the entity in question.