public virtual void Start(Coder coder) { this.coder = coder; ThreadStart ts = new ThreadStart(this.Receive); receive = new Thread(ts); ThreadStart ts2 = new ThreadStart(this.ReSend); reSend = new Thread(ts2); end = false; port.Open(); receive.Start(); reSend.Start(); }
public void InitializeSystem() { debug = new OutputPort((Cpu.Pin)PortMap.debug, false); debug.Write(true); coder = new Coder(); Thread.Sleep(17000); coder.Start(); Info("Initializing System..."); navigation = new NavigationManager(); Info("Initialized NavigationManager"); sensors = new SensorManager(); Info("Initialized SensorManager"); battery = new BatteryManager(); Info("Initialized BatteryManager"); currentMode = Mode.SearchingForWall; sensorTimer = new Timer(new TimerCallback(sensorTimer_tick), new object(), 0, GlobalVal.transmissionPeriodSensor_ms); positionTimer = new Timer(new TimerCallback(posTimer_Tick), new object(), 0, GlobalVal.transmissionPeriodPosition_ms); batteryTimer = new Timer(new TimerCallback(batteryTimer_Tick), new object(), 0, GlobalVal.transmissionPeriodBattery_ms); magTimer = new Timer(new TimerCallback(magnetometer_Tick), new object(), 0, GlobalVal.trasmissionPeriodMagnetometer_ms); Info("Initialized Timers"); cancel = false; debug.Write(false); navigation.manualSpeed = GlobalVal.speed; navigation.manualTurningSpeed = GlobalVal.turningSpeed; Info("Ready"); }