Hi. I am new to OpenComputers and Lua. I have gotten comfortable with building computers and installing OpenComputers onto my hard drive.
Currently I have:
tier 3 case with:
tier 3 cpu
tier 3 hard drive
tier 2 hard drive
tier 3 memory x 2
tier 3 graphics card
tier 2 redstone card
internet card
I have a line of redstone coming off the right side of the cpu case if you are looking at it from the front, and the redstone goes to a Dispenser with fireworks in it.
I then have a line of redstone coming off the front side of the cpu case to a block of diamond with a lever on the front.
If I flip the lever a redstone signal runs to the cpu.
I can use redstone.getInput(front) to find out it is getting a value of 10.
I want to send a redstone signal out the side to the dispenser, then shut it off, check the front, if signal still at 10 then send another signal out the side.
so far here is my code:
local component = require("component")
local sides - require("sides")
local colors = require("colors")
local redstone = component.redstone
local function main()
local firecount =- 1
local signal =- redstone.getInput(front)
redstone.getInput(front)
If signal == 10 then
repeat
print("Redstone Lever ON")
print("Firing FIrework!" firecount)
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.
Hi. I am new to OpenComputers and Lua. I have gotten comfortable with building computers and installing OpenComputers onto my hard drive.
Currently I have:
tier 3 case with:
tier 3 cpu
tier 3 hard drive
tier 2 hard drive
tier 3 memory x 2
tier 3 graphics card
tier 2 redstone card
internet card
I have a line of redstone coming off the right side of the cpu case if you are looking at it from the front, and the redstone goes to a Dispenser with fireworks in it.
I then have a line of redstone coming off the front side of the cpu case to a block of diamond with a lever on the front.
If I flip the lever a redstone signal runs to the cpu.
I can use redstone.getInput(front) to find out it is getting a value of 10.
I want to send a redstone signal out the side to the dispenser, then shut it off, check the front, if signal still at 10 then send another signal out the side.
so far here is my code:
local component = require("component")
local sides - require("sides")
local colors = require("colors")
local redstone = component.redstone
local function main()
local firecount =- 1
local signal =- redstone.getInput(front)
redstone.getInput(front)
If signal == 10 then
repeat
print("Redstone Lever ON")
print("Firing FIrework!" firecount)
redstone.setOutput(sides.left,15)
firecount ++
os.sleep(1)
redstone.setOutput(sides.left, 0)
os.sleep(1)
Else
print("Lever is OFF")
End
while true do
main()
End
Any help?
Thanks.
Link to post
Share on other sites