Esempio n. 1
0
        static void Main()
        {
            try
            {
                // I²C Mode
                //_lcd = new DevantechLcd03(Hardware.SocketOne, 0xC8 >> 1)

                // Serial mode
                _lcd = new DevantechLcd03(Hardware.SocketOne)
                {
                    BackLight = true,
                    Cursor    = DevantechLcd03.Cursors.Hide
                };
                _lcd.ClearScreen();
                _lcd.Write(1, 1, "Hello world !");
                _lcd.Write(1, 2, "UART mode");
                _lcd.Write(1, 4, "Using TinyCLR 2.0");
            }

            catch (Exception ex) when(Debugger.IsAttached)
            {
                WriteLine("Exception caught : " + ex.Message);
            }
            catch
            {
            }
            finally
            {
                WriteLine("Entering infinite loop...");
                Thread.Sleep(Timeout.Infinite);
            }
        }
Esempio n. 2
0
 private static void InitLcd()
 {
     _lcd = new DevantechLcd03(Hardware.SocketTwo, 0xC8 >> 1)
     {
         BackLight = true,
         Cursor    = DevantechLcd03.Cursors.Hide
     };
     _lcd.ClearScreen();
     _lcd.Write(1, 1, "    MikroBus.Net");
     _lcd.Write(1, 2, "RFID Click demo");
 }
Esempio n. 3
0
        public static void Main()
        {
            _lcd = new DevantechLcd03(Hardware.SocketOne, 0xC8 >> 1)
            {
                BackLight = true,
                Cursor    = DevantechLcd03.Cursors.Hide
            };
            _lcd.ClearScreen();
            _lcd.Write(1, 1, "Hello world !");
            _lcd.Write(1, 3, "Version " + _lcd.DriverVersion);

            Thread.Sleep(Timeout.Infinite);
        }
Esempio n. 4
0
        public static void Main()
        {
            try
            {
                _rfid = new RFIDClick(Hardware.SocketOne);
                InitLcd();

                Debug.WriteLine("RFID identification : " + _rfid.Identification());

                _lcd.Write(1, 4, "Calibration...");
                _rfid.Calibration(Hardware.Led2);
                _lcd.Write(1, 4, "              ");

                _rfid.TagDetected += Rfid_TagDetected;
                _rfid.TagRemoved  += Rfid_TagRemoved;

                InitTimer();

                _rfid.DetectionEnabled = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            Thread.Sleep(Timeout.Infinite);
        }
Esempio n. 5
0
        private static void DemoMux2()
        {
            var _mux = new I2cMux2Click(Hardware.SocketTwo, 0xE0 >> 1, 100000);

            _mux.InterruptDetected += _mux_InterruptDetected;

            GpioPin _pin1 = GpioController.GetDefault().OpenPin(Hardware.SocketSix.Rst);

            _pin1.SetDriveMode(GpioPinDriveMode.Output);
            _pin1.Write(GpioPinValue.High);

            GpioPin _pin2 = GpioController.GetDefault().OpenPin(Hardware.SocketSix.Int);

            _pin2.SetDriveMode(GpioPinDriveMode.Output);
            _pin2.Write(GpioPinValue.High);

            _mux.ActiveChannels = 0b00001000;
            var _lcd = new DevantechLcd03(Hardware.SocketThree, 0xC8 >> 1)
            {
                BackLight = true,
                Cursor    = DevantechLcd03.Cursors.Hide
            };

            _lcd.ClearScreen();
            _lcd.Write(1, 1, "MBN rules");
            _lcd.Write(1, 4, $"{DateTime.Now}");

            _pin1.Write(GpioPinValue.Low);
            _pin2.Write(GpioPinValue.Low);
            Thread.Sleep(500);
            _pin1.Write(GpioPinValue.High);
            _pin2.Write(GpioPinValue.High);


            Thread.Sleep(2000);
            _lcd.ClearScreen();
            _lcd.BackLight = false;
        }