Content deleted Content added
Tags: Mobile edit Mobile web edit |
|||
Line 21: | Line 21: | ||
====Example==== |
====Example==== |
||
<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. It must be between servo and PowerCell. |
||
switch:Configure({SwitchValue=false}) |
switch:Configure({SwitchValue=false}) |
||
servo:SetAngle(math.random(1,360)) |
servo:SetAngle(math.rad(math.random(1,360))) |
||
wait(2) |
wait(2) |
||
switch:Configure({SwitchValue=true}) |
switch:Configure({SwitchValue=true}) |