redstone.getAnalogueInput

From ComputerCraft
(Redirected from Redstone.getAnalogInput)
Jump to navigation Jump to search

redstone.getAnalogueInput
Function
Syntax
redstone.getAnalogueInput()
Returns number strength of the redstone signal
API redstone
Source CC:Tweaked (source)

When passed a valid side, this function will return a number value indicating the strength of the redstone signal received on that side. If there is no redstone signal it returns 0. Similar to redstone.getInput except it returns the strength instead of boolean on/off status.

Error creating thumbnail: Unable to save thumbnail to destination
ExamplePrint input on each side
Prints the redstone signal strength on each side of the computer.
Code
for _, side in pairs(redstone.getSides()) do
    print(("redstone signal on %s is %d"):format(side, redstone.getAnalogueInput(side)))
end
Output redstone signal on [top, bottom, left, right, front, back] is [0-15]