I am not sure how to send classic redstone signal in cc so I google it and I found redstone (API) here:
http://www.computercraft.info/wiki/Redstone_(API)
and I tryed commmands from there and it doesnt seem to be working for instance when I try check redstone dust bellow computer with command:
redstone.getOutput("bottom")
I get:
lua:1: attempt to call nil
is possible that I dont have redstone (API) in cc and if so how can I get it ?
Make sure you spell it exactly right. Attempt to call nil means you a calling a null value (i.e something that isn't a function). Function names (like all variable names) are case sensitive. Unfortunately there are know other redstone cables that are compatible with the bundled redstone commands just now. I tested the project red ones recently.
I wrote a program that uses the networking cable so a single computer can coordinate others to do certain redstone functions. There are two programs actually. The first is an API (called modstone) that you can use to interface with other computers. The other is a main program (called redstoner) that you run on the computer you wish to be controlled (this computer will then emit redstone etc)
For example. You have two computers, A and B. Computer A has modstone installed. You use the API to write a program that will cause computer B to emit redstone high and low on a 2 second cycle. It could look like this.
Code:
local modem = peripheral.wrap("left") -- You need modems on all computers for this to work, wired or wireless
local value = true -- The initial redstone value you will set
local channel = 1 -- The modem channel you communicate on (redstoner receivers listen to only one channel)
local filter = "Hello" -- This is an extra filter that enables you to restrict which receivers act on the API's commands
local side = "left" -- The side you want the receiver to emit redstone from.
while true do
modstone.setRedstone(modem, channel, filter, side, value)
value = not value -- Inverts the value from true to false and false to true
sleep(2)
end
This example is a demo only and may have errors - I didn't test it.
The modstoner API can also getRedstoneOutput and getRedstoneInput but there are no other features. It is rough and was written quickly so I could do a specific thing.
Modstone API:
http://pastebin.com/2LWnz5iA
You also need to install the redstoner program on a receiver for this to have any effect. You can set the filter and the listening channel in program arguments. If you leave these blank, the filter will be nil and it will select a random channel (it prints out these channels). It will sit and wait for messages and act accordingly if it gets one. If you want a receiver that will respond to the example program above, download it via pastebin at
Redstoner:
http://pastebin.com/SQ3yF33b
and make a new startup program and type this code
shell.run("redstoner", 1, "Hello")
If it doesn't work, sorry about that. I just wrote it quickly a couple of days ago and I am sharing because it might be useful, but I am not promising any support for it if it doesn't work properly. It should work though (it works for what I wanted it to do.
I should mention that you can have many receivers operating at once being controlled by the same program (more than 16 at least, but I don't know how laggy it could get)