Exemple #1
0
        public void OpenSerialPort(string SerialName)
        {
            _ArduinoManager = new ArduinoManagerComm();
            _AutomateComm   = new AutomateCommunication(SerialName, true, _ArduinoManager);

            _AutomateComm.OpenSerialPort(SerialName);

            _Follower = new Follower(_ArduinoManager, _AutomateComm);

            _tUpdate = new Thread(new ThreadStart(_threadUpdate));
            _tUpdate.Start();
            //_AutomateComm.OnNewTrameArduinoReceived += new AutomateCommunication.NewTrameArduinoReceivedEventHandler(_AutomateComm_OnNewTrameArduinoReceived);
        }
Exemple #2
0
        public Follower(ArduinoManagerComm AM, AutomateCommunication AUTO)
        {
            // Partie communication
            this._ArduinoManager = AM;
            this._AutomateComm   = AUTO;

            _ListArduino = new List <ArduinoBotIA>();

            // Createur de trajectoire
            _TrackMaker = new TrackMaker();

            this._AutomateComm.OnArduinoTimeout          += new AutomateCommunication.ArduinoTimeoutEventHandler(_AutomateComm_OnArduinoTimeout);
            this._AutomateComm.OnNewTrameArduinoReceived += new AutomateCommunication.NewTrameArduinoReceivedEventHandler(_AutomateComm_OnNewTrameArduinoReceived);
        }
Exemple #3
0
        public void Dispose()
        {
            if (_tUpdate != null)
            {
                _tUpdate.Abort();
            }
            _tUpdate = null;

            _Follower       = null;
            _ArduinoManager = null;
            if (_AutomateComm != null)
            {
                _AutomateComm.Dispose();
            }
            _AutomateComm = null;
        }
Exemple #4
0
        public Form1()
        {
            InitializeComponent();
            g_Logger.attachToRTB(txtbox_debug_log);
            g_Logger.levelDebug = 1;        // Enlever le gros debug
            Logger.GlobalLogger = g_Logger; // Met a la disposition le logger
            getListePortSerie();

            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Form1_close);

            _ArduinoManager = new ArduinoManagerComm();
            _AutomateComm   = new AutomateCommunication("COM0", true, _ArduinoManager); // Initialise l'automate sur le port 0
            _AutomateComm.OnNewTrameArduinoReceived += new AutomateCommunication.NewTrameArduinoReceivedEventHandler(_OnNewTrameArduinoReceived);
            _AutomateComm.OnArduinoTimeout          += new AutomateCommunication.ArduinoTimeoutEventHandler(_OnArduinoTimeout);

            /* Set de la source */
            _AutomateComm.IdPc = 0xFE;
            MessageBuilder.src = 0xFE;
        }
Exemple #5
0
        public void CloseSerialPort()
        {
            if (_tUpdate != null)
            {
                _tUpdate.Abort();
            }
            _tUpdate = null;

            if (_AutomateComm != null)
            {
                _AutomateComm.CloseSerialPort();
            }
            if (_AutomateComm != null)
            {
                _AutomateComm.Dispose();
            }
            _AutomateComm = null;

            _ArduinoManager = null;
        }