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

Remote bundled cable control

Started by Dan211, 16 March 2013 - 08:17 PM
Dan211 #1
Posted 16 March 2013 - 09:17 PM
I made a program trying to use rednet to control bundled cable and it doesnt work quite well, i have no idea what the problem is. Its supposed to receive 2 messages by rednet one containing the name(in number format from 1 to 4) of the cable and one the state(Boolean). can someone please check and tell me some useful tips to optimize the code and make it work, thanks.
heres the link: http://pastebin.com/3u0WzM6u
theoriginalbit #2
Posted 16 March 2013 - 09:43 PM
Ok so this can be done easier. here is the code of an easier way (i.e. one message)

With Logging (writes error messages to a file, the console with print and the cc-emu log, if you're using cc-emu and a version that has logging)
Without Logging

It requires 2 characters in the message
char #1: a hexadecimal character of which colour (hex is 0-f, where 0 is white and f is black)
char #2: the boolean, t for true, anything else for false

so quite simply the sending computer would send say

rednet.send(<id>, "et")
to add red to the cable output. and

rednet.send(<id>, "2f")
to remove orange from the output

EDIT: Oh also i believe the problem in your code was with

wiresout = wiresout + cwire[i]
since cwire doesn't have 10 values in it, so the rest would be trying to + or - nil
Edited on 16 March 2013 - 08:45 PM
Dan211 #3
Posted 16 March 2013 - 10:02 PM
Ok so this can be done easier. here is the code of an easier way (i.e. one message)

With Logging (writes error messages to a file, the console with print and the cc-emu log, if you're using cc-emu and a version that has logging)
Without Logging

It requires 2 characters in the message
char #1: a hexadecimal character of which colour (hex is 0-f, where 0 is white and f is black)
char #2: the boolean, t for true, anything else for false

so quite simply the sending computer would send say

rednet.send(<id>, "et")
to add red to the cable output. and

rednet.send(<id>, "2f")
to remove orange from the output

EDIT: Oh also i believe the problem in your code was with

wiresout = wiresout + cwire[i]
since cwire doesn't have 10 values in it, so the rest would be trying to + or - nil

Thanks a lot again. But, the server i was planning to do this on is down so I dont have a chance to test it. Ill see how it goes.
theoriginalbit #4
Posted 16 March 2013 - 10:09 PM
Thanks a lot again. But, the server i was planning to do this on is down so I dont have a chance to test it. Ill see how it goes.
Thats ok. if you have any questions about how any of the code works or functions feel free to ask here or send me a PM :)/>