Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
L3ar

Funky locomotion door control

Question

Posted

I'm trying to control 2 funky locomotion frame sliders to move a door using this program :

local component = require("component")
local sides = require("sides")
local rs = component.redstone
 
local doorOpen = false
local delay = 15
 
while true do
  if rs.getOutput(sides.front) > 0 then
    if doorOpen then
      print("Closing door")
      rs.setOutput(sides.right, 15)
      os.sleep(delay)
      rs.setOuput(sides.right, 0)
      doorOpen = not doorOpen
    else
      print("Opening door")
      rs.setOutput(sides.left, 15)
      os.sleep(delay)
      rs.setOutput(sides.left, 0)
      doorOpen = not doorOpen
    end
  end
end

When I press the button the screen goes black, the door doesn't move and the screen show up only if I press tyhe button again.

I'm a noob at lua so I can't really understand what's going on... 

2 answers to this question

Recommended Posts

  • 0
Posted

Pressing the button that is placed on the screen turns the screen on/off. Make sure the button is not adjacent to the screen.

Also, you should use rs.getInput in yor problem. rs.getOutput returns the strength of the redstone signal emitted by the computer's redstone card.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.