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

Touchscreen Base Control + Redstone Wireless Remote

Started by Xiaminou, 02 July 2013 - 09:06 AM
Xiaminou #1
Posted 02 July 2013 - 11:06 AM
Hello fellow programmers,

I'm playing FTB Direwolf20's pack, recommended version.

I'm looking for a little help with my program, here is my idea :

I want to be able to control my base with both a touchscreen and a wireless remote.

for that I'm in need of a program that can read bundled cable redstone inputs and set the buttons according to them.

Here's a little screenshot to help:



On the left it receives the redstone signal for each of my machines
On the right it turns on/off the signals.

I am using a modified version of Direwolf20's Button API and SuPerMiNoR2's Bundled Cable API. I already made a program for my Mob Spawner Control, but I have no idea where to start with this one.

Modified Button API : http://pastebin.com/jXCCfawv
MobControl : http://pastebin.com/aK02kJaF

Keep in mind, I don't know anything about programming, only learned a few things for minecraft. My MobControl program is most certainly terrible, but it works.

Now I know how to set a button on/off (green/red), but I couldn't find a way to link it to a redstone signal.

Thank you for reading all this.
Apfeldstrudel #2
Posted 02 July 2013 - 11:55 AM
Umh… Whats the question?
Xiaminou #3
Posted 02 July 2013 - 02:18 PM
Umh… Whats the question?

I need to know how to make the button appear green when redstone is on, and red when redstone is off.
Xiaminou #4
Posted 03 July 2013 - 08:44 AM
Bump, nobody can help me? or do you need more information? am I too vague?
darkrising #5
Posted 03 July 2013 - 08:49 AM
I have a program that can do this:

http://www.computerc...i-for-monitors/

Check it out, might give you inspiration :)/>

Edit: Just re-read this, I see what you're saying. If you make it listen for redstone input in a separate function running along the program you could make the main program react to the changes by issuing custom events. Try using the parallel api.
Xiaminou #6
Posted 03 July 2013 - 09:16 AM
Just re-read this, I see what you're saying. If you make it listen for redstone input in a separate function running along the program you could make the main program react to the changes by issuing custom events. Try using the parallel api.

Looks hard, but I'll give it a try. Can't I just include that in the while loop?

Edit: You know, I just realised, I have no idea how to make it listen to redstone and change the button's color.
darkrising #7
Posted 03 July 2013 - 12:18 PM
Just re-read this, I see what you're saying. If you make it listen for redstone input in a separate function running along the program you could make the main program react to the changes by issuing custom events. Try using the parallel api.

Looks hard, but I'll give it a try. Can't I just include that in the while loop?

Edit: You know, I just realised, I have no idea how to make it listen to redstone and change the button's color.

Well for a start you would use os.pullEvent("redstone") This will make the program halt until a redstone signal is detected (I think it works for bundled cables)
http://computercraft.info/wiki/Os.pullEvent

And then you would use the redstone api to detect the input
http://computercraft.info/wiki/Redstone_(API)

I would write up an example program but I'm not currently at home :P/>/>

Edit: Wouldn't making the program listen for a redstone event turn off the button when you turn it on?