No edit summary |
|||
Line 22: | Line 22: | ||
<syntaxhighlight lang="lua" line="1"> |
<syntaxhighlight lang="lua" line="1"> |
||
local servo = GetPartFromPort(1,"Servo") --Main Variant |
local servo = GetPartFromPort(1,"Servo") --Main Variant |
||
local switch = GetPartFromPort(2,"Switch") --A switch must be connected to a servo and a PowerCell. |
local switch = GetPartFromPort(2,"Switch") --A switch must be connected to a servo and a PowerCell with part attachment. |
||
switch:Configure({SwitchValue=false}) |
switch:Configure({SwitchValue=false}) |
Revision as of 02:27, 29 May 2022
This article is a stub you can help the Waste Of Space Wiki by expanding it. |
Servo is similar to Motor, but when activated by electricity, it cannot spin automatically. It can be interacted to add the angles of hinge with the configuration of "AngleStep", rotate the parts by hinge with its angle, by Polysilicon,
FlipFlop mode Polysilicon can set its angles to 0.
Description
"Spins objects attached to the hinge at the front when powered, to set angles. Polysilicon can be used to control its angle. Activate will increment the goal angle by the configured angle step (clockwise looking at its face) Deactivate will decrement the goal angle (counter-clockwise) FlipFlop will reset the angle to 0 Microcontrollers can also set a servo's angle with :SetAngle(Goal)"
Misc.
Programming
Servo:SetAngle(number)
Example
local servo = GetPartFromPort(1,"Servo") --Main Variant
local switch = GetPartFromPort(2,"Switch") --A switch must be connected to a servo and a PowerCell with part attachment.
switch:Configure({SwitchValue=false})
servo:SetAngle(math.random(1,360))
wait(2)
switch:Configure({SwitchValue=true})
Configuration
- ServoSpeed(number) [0 - 20] - Determines the speed at which the servo is driven.
- AngleStep(number) [-180 - 180] - Determines the change in angle when a pulse is received by Polysilicon.