Eln Computer Probe

From Electrical Age
Revision as of 23:51, 25 May 2017 by Omega Haxors (talk | contribs)

Jump to: navigation, search

The Eln Computer Probe is a block which allows a computer to read and manipulate signals passing through it, as well as wireless signals within range.

The functions it provides do not contain an internal API, so they will be defined here:

  • signalSetDir("side","in" or "out") - Sets the direction a signal flows on the specified side. Both arguments must be strings, and are case-sensitive. Always returns nil. This can be used to set a value before actually applying it to your ELN network, or to deactivate it without losing its value. This also means one cannot read and write a voltage value at the same time. Switch the modes on each port as needed or dedicate different ports for reading and writing.
  • signalGetDir("side") - Used to determine if the specified side is in "in" or "out" mode.
  • signalGetIn("side") - Gets the signal strength as a percentage. Multiply by 50 to get exact voltage value.
  • signalSetOut() - If the side is set to "out" use this function to set the signal's strength as a percentage. If the side is set to "in" the voltage won't change until it is set to "out". Divide by 50 to use the exact voltage value.
  • wirelessGet("channel name") - Gets the wireless signal strength as a percentage, uses channel name rather than side.
  • wirelessSet("channel name",number) - Sets the signal strength of the specified channel name. Uses the same percentage value. Divide by 50 to use exact voltage value.
  • wirelessRemove("channel name") - Removes a wireless channel from the block by name.
  • wirelessRemoveAll() - Clears the wireless channels within the block. This is used to disable all wireless interactions in a single command.


Directions

When a probe is placed, 6 sides will appear printed on the sides of the block. These always face the same way, no matter which direction you place the block in. These are used to control the previous functions, usually to specify which side to operate the function on. Its naming structure is a reference to transistors, where P-type is considered positive and N-type is considered negative. The x and y refers to the co-ordinate value.

  • XN - Faces West
  • XP - Faces East
  • YN - Faces Ground
  • YP - Faces Skyward
  • ZN - Faces North
  • ZP - Faces South

Note: Some of the sides are written backwards on the block, and the top and bottom are completely unlabeled! An easy way to remember which side is which is to read the first letter as a co-ordinate value, and the second letter as a direction. YN is downwards on the Y axis, and thus faces the ground.


Sample Code

  • probe.signalSetDir("ZP","out") --The South end is now emitting voltage
  • probe.signalSetDir("ZN","in") --The North end is now reading voltage
  • local voltage = probe.signalGetIn("ZN") * 50 -- Reads the North end as a voltage value
  • local output = voltage / 2 --The output is now half the value of the input
  • probe.signalSetOut("ZP",output/50) --Now the South end is emitting half the value of the North end