示例#1
0
        private void InitializePins()
        {
            board.PinMode(2, PinMode.Output);
            board.PinMode(3, PinMode.Output);
            board.PinMode(4, PinMode.Output);
            board.PinMode(5, PinMode.Output);
            board.PinMode(6, PinMode.Output);
            board.PinMode(7, PinMode.Output);
            board.PinMode(8, PinMode.Output);
            board.PinMode(9, PinMode.Output);

            board.DigitalWrite(2, DigitalPin.High);
            board.DigitalWrite(3, DigitalPin.High);
            board.DigitalWrite(4, DigitalPin.High);
            board.DigitalWrite(5, DigitalPin.High);
            board.DigitalWrite(6, DigitalPin.High);
            board.DigitalWrite(7, DigitalPin.High);
            board.DigitalWrite(8, DigitalPin.High);
            board.DigitalWrite(9, DigitalPin.High);
        }
        private void Press(params int[] pin)
        {
            for (int i = 0; i < pin.Length; i++)
            {
                board.DigitalWrite(pin[i], DigitalPin.Low);
            }
            Thread.Sleep(60);

            for (int i = 0; i < pin.Length; i++)
            {
                board.DigitalWrite(pin[i], DigitalPin.High);
            }
            Thread.Sleep(60);
        }
示例#3
0
 private void button1_Click(object sender, EventArgs e)
 {
     arduino.DigitalWrite((int)TypeOfLed.Red, DigitalPin.High);
 }