// * Write to a digital out // * @param value The value that is to be written, either 0 or 1. public string write(int value) { String s = value.ToString(); String[] Args = { s }; return(mbedRPC.RPC(name, "write", Args)); }
// * Read the value of the string output from the atatched function last time it was run. // * @return The output from the function as a string public String read() { String response; response = mbedRPC.RPC(name, "read", null); return(response); }
public string write(float value) { String s = value.ToString(); s = s.Replace(',', '.'); //Hack -> replace , to .! String[] Args = { s }; return(mbedRPC.RPC(name, "write", Args)); }
public int read() { String response = mbedRPC.RPC(name, "read", null); //Need to convert response to and int and return int i = Convert.ToInt32(response); return(i); }
//* Read the value of the AnalogIn //* @return The value of the AnalogIn between 0 and 1 public float read() { String response = mbedRPC.RPC(name, "read", null); response = response.Replace('.', ','); //Hack -> replace '.' to ','! //Need to convert response to and int and return float i = Convert.ToSingle(response); return(i); }
// * Read a list of all the objects that can be accessed using the RPC. // * // * @return A string array of objects public String[] Objects() { String response; response = mbedRPC.RPC(" ", null, null); ObjArray = null; //parse response by spaces to and transfer object names into array ObjArray = response.Split(new Char [] { ' ' }); return(ObjArray); }
// * This is the constructor to create a new Digital Out on mbed // * // * @param connectedMbed The mbed object for the mbed that the DigitalOut is to be created on. // * @param pin The pin that is to be used as a Digital Out public DigitalOut(SerialRPC connectedMbed, MbedPin pin) { //Create a new DigitalOut on mbed mbedRPC = connectedMbed; name = "mbed_" + pin.PinName.ToLower(); String[] Args = { pin.PinName, name }; string parameter = mbedRPC.RPC("DigitalOut", "new", Args); Debug.Print("New DigitalOut initialized: " + parameter); }
public Serial(SerialRPC connectedMbed, MbedPin TxPin, MbedPin RxPin) { //Create a new Serial on mbed mbedRPC = connectedMbed; name = "serial_" + TxPin.PinName + RxPin.PinName; String[] Args = { TxPin.PinName, RxPin.PinName, name }; string parameter = mbedRPC.RPC("Serial", "new", Args); Debug.Print("New Serial object initialized: " + parameter); }
public void baud(int baudRate) { String[] Args = { baudRate.ToString() }; mbedRPC.RPC(name, "baud", Args); }