Esempio n. 1
0
        void ProgramStarted()
        {
            Debug.Print("Program Started");

            // create the model
            Model model = new Model(4);

            // setup the sensors
            int[] sockets = { 3, 3, 4, 4 };
            byte[] addresses = { 1, 2, 3, 4 };
            Ranger ranger = new Ranger(sockets, addresses);
            Controller controller = new Controller(model, ranger, button);

            // setup the tunes modules
            TunesModule leftTunes = new TunesModule(11, model);
            TunesModule rightTunes = new TunesModule(8, model);
            TunesListener tunesListener = new TunesListener(leftTunes, rightTunes);
            model.addModelListener(tunesListener);

            // calibrate everything
            controller.calibrate();

            // start ranging
            ranger.startRanging();

            Debug.Print("Initialisation Ended");
        }
Esempio n. 2
0
        public Controller(Model model, Ranger ranger, GTM.GHIElectronics.Button thresholdButton)
        {
            this.model = model;

            this.ranger = ranger;
            ranger.MeasurementComplete += new Microsoft.SPOT.EventHandler(ranger_MeasurementComplete);

            this.thresholdButton = thresholdButton;
            thresholdButton.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(thresholdButton_ButtonPressed);
        }