/// <summary> /// Event handler for analog voltage-varying sensor input changes (=sliders, pots, etc). /// Sends an XML Element to Flash. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void phidgetsKit_SensorChange(object sender, GroupLab.Phidgets.Components.EventArguments.IndexSensorChangeEventArgs e) { xmlIO.SendString("<event type=\"analog_in\" index=\""+e.Index+"\" value=\""+e.Value+"\" />"); }
/// <summary> /// Event handler for digital input changes (= buttons, switches). /// Sends an XML Element to Flash. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void phidgetsKit_InputChange(object sender, GroupLab.Phidgets.Components.EventArguments.BitStateChangeEventArgs e) { xmlIO.SendString("<event type=\"digital_in\" index=\""+e.Index+"\" value=\""+Convert.ToByte(e.State)+"\" />"); }
void rightRFID_Tag(object sender, GroupLab.SharedPhidgets.RFIDTagEventArgs e) { //saul if (e.Tag.Equals("01024a913e")) { interfaceKit1.Outputs[2].State = false; interfaceKit1.Outputs[3].State = true; servo1.Motors[0].Position = 173; servo1.Motors[1].Position = 54; interfaceKit1.Outputs[4].State = true; interfaceKit1.Outputs[6].State = false; servo1.Motors[2].Position = 180; servo1.Motors[3].Position = 5; } //reset if (e.Tag.Equals("01024c8080")) { servo1.Motors[0].Position = 134; servo1.Motors[1].Position = 115; servo1.Motors[2].Position = 128; servo1.Motors[3].Position = 83; for (int i = 0; i < interfaceKit1.Outputs.Count; i++ ) { interfaceKit1.Outputs[i].State = false; } } if (markets.ContainsKey(e.Tag)) { string market = markets[e.Tag]; currentPrice = spreadsheet.getPriceByName(market); if (spreadsheet.getChangeByName(market) < 0) { interfaceKit1.Outputs[2].State = false; interfaceKit1.Outputs[3].State = true; servo1.Motors[0].Position = 173; servo1.Motors[1].Position = 54; } else { interfaceKit1.Outputs[2].State = true; interfaceKit1.Outputs[3].State = false; servo1.Motors[0].Position = 101; servo1.Motors[1].Position = 139; } } }
/// <summary> /// Event handler for Phidgets errors - prints all errors to the console /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void phidgetsKit_Error(object sender, GroupLab.Phidgets.Components.EventArguments.PhidgetErrorEventArgs e) { Console.WriteLine("Phidgets Error:"+e.Description); }
void interfaceKit1_SensorChange(object sender, GroupLab.SharedPhidgets.IndexSensorChangeEventArgs e) { if (e.Value < 60) { rightRFID.Antenna = false; leftRFID.Antenna = true; } else { rightRFID.Antenna = true; leftRFID.Antenna = false; } }