This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
tmyt's profile picture

remote lever question

Started by tmyt, 17 September 2012 - 12:25 PM
tmyt #1
Posted 17 September 2012 - 02:26 PM
heya, ive spent maybe an hour trying to figure this out, so forgive me if its a really simple question and ive just not come across the answer yet. Im new to computercraft and programming.

i want to operate a lever remotely via a console. So i guess i want to do it wirelessly, somehow.

Ultimatley im trying to make a program that will switch a lever to off when the inventory of a chest is full. But i want to do it via a great distance.


Thanks for any help:)

im not looking for code etc, just tell me what computercraft things do it and hopefully i can figure the rest out. I know about ccSensors, but not how to remotely turn a lever on/off without the use of bundled cable.
Cranium #2
Posted 17 September 2012 - 04:36 PM
Levers cannot be operated without interaction from the player.
KillaVanilla #3
Posted 17 September 2012 - 09:56 PM

rednet.open(side)
while true do
sender, message = rednet.receive()
if message == "lever on" then
   redstone.setOutput("right", true)
elseif message == "lever off" then
   redstone.setOutput("right", false)
end
end

How to use:
  1. Replace your lever with a computer with a wireless modem attached.
  2. Replace "side" with the side that the modem was attached to.
  3. Replace "right" with the side where the redstone will be attached to.
To turn the lever on/off wirelessly, simply send a rednet message saying "lever on" or "lever off" to the computer, or broadcast it.