public ManualDrive(Connection conn) { InitializeComponent(); groupKeys.Enabled = false; groupMotor1.Enabled = false; groupMotor2.Enabled = false; try { _motorControl = new Phidgets.MotorControl(); _motorControl.Attach += new Phidgets.Events.AttachEventHandler(motorControl_Attach); _motorControl.BackEMFUpdate += new Phidgets.Events.BackEMFUpdateEventHandler(motorControl_BackEMFUpdate); _motorControl.CurrentChange += new Phidgets.Events.CurrentChangeEventHandler(motorControl_CurrentChange); _motorControl.CurrentUpdate += new Phidgets.Events.CurrentUpdateEventHandler(motorControl_CurrentUpdate); _motorControl.Detach += new Phidgets.Events.DetachEventHandler(motorControl_Detach); _motorControl.EncoderPositionChange += new Phidgets.Events.EncoderPositionChangeEventHandler(motorControl_EncoderPositionChange); _motorControl.EncoderPositionUpdate += new Phidgets.Events.EncoderPositionUpdateEventHandler(motorControl_EncoderPositionUpdate); _motorControl.Error += new Phidgets.Events.ErrorEventHandler(motorControl_Error); _motorControl.InputChange += new Phidgets.Events.InputChangeEventHandler(motorControl_InputChange); _motorControl.SensorUpdate += new Phidgets.Events.SensorUpdateEventHandler(motorControl_SensorUpdate); _motorControl.ServerConnect += new Phidgets.Events.ServerConnectEventHandler(motorControl_ServerConnect); _motorControl.ServerDisconnect += new Phidgets.Events.ServerDisconnectEventHandler(motorControl_ServerDisconnect); _motorControl.VelocityChange += new Phidgets.Events.VelocityChangeEventHandler(motorControl_VelocityChange); _motorControl.open(conn.Ip, conn.Port, conn.Pass); } catch { Fatal_Error(); } }
public Form1() { InitializeComponent(); screen = new Phidgets.TextLCD(); screen.open(); screen.waitForAttachment(); screen.Backlight = true; screen.rows[0].DisplayString = "hello :)"; screen.rows[1].DisplayString = ""; motor = new Phidgets.MotorControl(); motor.Attach += new Phidgets.Events.AttachEventHandler(motor_Attach); motor.VelocityChange += new Phidgets.Events.VelocityChangeEventHandler(motor_VelocityChange); motor.open(); interfaceKit = new Phidgets.InterfaceKit(); interfaceKit.SensorChange += new Phidgets.Events.SensorChangeEventHandler(interfaceKit_SensorChange); interfaceKit.open(); }