Example #1
0
        string GetCommand(DigitalInput p7, DigitalInput p8, DigitalInput p9)
        {
            bool b7 = p7.Read();
            bool b8 = p8.Read();
            bool b9 = p9.Read();

            if (b7 == false && b8 == false && b9 == true)
            {
                //Mainboard.TurnOnLed(15);
                return("GO");
            }
            else if (b7 == false && b8 == true && b9 == false)
            {
                //Mainboard.TurnOnLed(14);
                return("BACK");
            }
            else if (b7 == false && b8 == true && b9 == true)
            {
                //Mainboard.TurnOnLed(13);
                return("LEFT");
            }
            else if (b7 == true && b8 == false && b9 == false)
            {
                //Mainboard.TurnOnLed(12);
                return("RIGHT");
            }
            else
            {
                //Mainboard.TurnOnLed(11);
                return("STOP");
            }
        }
Example #2
0
 private void PirDetection(GT.Timer timer)
 {
     if (pir_sensor.Read())
     {
         Debug.Print("beccato!!!");
         //codice da eseguire quando scatta pir
     }
 }
Example #3
0
 private void CheckForColorChange()
 {
     _colorCode = (uint)((_colorPin3.Read() ? 8 : 0)
                         + (_colorPin2.Read() ? 4 : 0)
                         + (_colorPin1.Read() ? 2 : 0)
                         + (_colorPin0.Read() ? 1 : 0));
     SetColor();
 }
Example #4
0
        void timer_Tick(GT.Timer timer)
        {
            var isButtonPressed = _digitalInput.Read();

            Mainboard.SetDebugLED(isButtonPressed);
            _digitalOutput.Write(isButtonPressed);

            _digitalOutput2.Write(_analogValue);
            Debug.Print("signal measured: " + _digitalInput2.Read().ToString());
            _analogValue = !_analogValue;
        }
Example #5
0
        void dataReadTimer_Tick(GT.Timer timer)
        {
            output_pl.Write(false);
            output_pl.Write(true);
            output_ce.Write(false);

            int retval = 0;

            for (int i = 0; i <= 7; i++)
            {
                retval = retval << 1;
                if (input.Read())
                {
                    retval = retval + 1;
                }
                Clock();
            }
            output_ce.Write(true);
            Debug.Print(retval.ToString());
//            if (retval > 0) // uncomment if you want to keep the lights on
            DisplayLeds(retval);
        }