How to make a computer output a redstone signal? (via touchscreen)

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Arterra

New Member
Jul 29, 2019
5
0
0
Im trying to set up a levitator for a wizard tower, and want it to be powered for a few seconds via a 4x4 monitor on the wall. Lets just say I know little about programming, and was wondering if any computercraft users can explain how to hook up a monitor to a computer, how to enable touchscreen, and how to output a signal.

Tell me if this request is legitimately high in difficulty xD
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
Advanced Monitors next to computers emit events (which you can grab through os.pullEvent()). They have the X/y location of the screen where they were touched. If this isn't enough information for you I suggest you dive into LUA programming for CC because I'm not going to explain everything.
 

Larroke

New Member
Jul 29, 2019
301
0
0
Don't know enough about touchscreen yet... but the others I can try to help

to connect to a monitor you first have to connect it as a peripheral in essence: (from http://computercraft.info/wiki/Monitor)
"top" refers to the side of the computer a monitor block is touching.
Code:
local monitor = peripheral.wrap("top")
monitor.write("Hello World!")

To trigger a redstone signal look up the Redstone API (built in)... (from http://computercraft.info/wiki/Redstone_(API))

the code to variable "pulse" is,

Code:
redstone.setOutput("back", true)
sleep(2)
redstone.setOutput("back", false)

alternatively you can also connect to bundled wiring as such, "rs." can be used as shorthand for "redstone.":
Code:
rs.setBundledOutput('back', colors["green"])
sleep(0.1)
rs.setBundledOutput('back',0)
sleep(0.1)