Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Launching GarageAssistant...");
            LED green = new LED(Pi.Gpio.GetGpioPinByBcmPinNumber(20));
            LED red   = new LED(Pi.Gpio.GetGpioPinByBcmPinNumber(21));
            UltrasoundSensor sensor = new UltrasoundSensor(
                Pi.Gpio.GetGpioPinByBcmPinNumber(2),
                Pi.Gpio.GetGpioPinByBcmPinNumber(3)
                );

            Console.CancelKeyPress += (sender, e) =>
            {
                Console.WriteLine("Terminating...");
                green.TurnOff();
                red.TurnOff();
            };

            Daemon daemon = new Daemon(
                statusLED: green,
                distanceLED: red,
                ultrasoundSensor: sensor
                );

            daemon.Run();
        }
Ejemplo n.º 2
0
 public Daemon(LED statusLED, LED distanceLED, UltrasoundSensor ultrasoundSensor)
 {
     this.distanceLED = distanceLED;
     this.statusLED   = statusLED;
     sensor           = ultrasoundSensor;
 }