public void Init() { _i2c = I2cDevice.Create(new I2cConnectionSettings(1, 0x27)); _pcf = new Pcf8574(_i2c); _lcd = new Lcd2004(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7 }, backlightPin: 3, readWritePin: 1, controller: _pcf); }
public void InitHardware() { redLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLEDRed, false); // blueLed = new DigitalOutputPort(Device.Pins.OnboardLEDBlue, false); // greenLed = new DigitalOutputPort(Device.Pins.OnboardLEDGreen, false); display = new Lcd2004(App.Device, Device.Pins.D05, Device.Pins.D07, Device.Pins.D08, Device.Pins.D09, Device.Pins.D10, Device.Pins.D11, 2, 16); }
public void Init() { _i2c = I2cDevice.Create(new I2cConnectionSettings(1, 0x27)); _driver = new Pcf8574(_i2c); _lcd = new Lcd2004(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7 }, backlightPin: 3, backlightBrightness: 0.1f, readWritePin: 1, controller: new GpioController(PinNumberingScheme.Logical, _driver)); }
public void InitHardware() { redLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLEDRed, false); blueLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLEDBlue, false); greenLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLEDGreen, false); spdtSwitch = new SpdtSwitch(Device, Device.Pins.D14, InterruptMode.EdgeBoth, ResistorMode.Disabled); spdtSwitch.Changed += SpdtSwitch_Changed; display = new Lcd2004(App.Device, Device.Pins.D05, Device.Pins.D07, Device.Pins.D08, Device.Pins.D09, Device.Pins.D10, Device.Pins.D11, 2, 16); blueLed.State = true; }
/// <summary> /// This method will use I2C commands to talk to the display. The display is expected to be at address 0x27 and accept 4 bit commands. /// This runs a full test suite against the display. /// </summary> static void UsingHd44780OverI2C() { using (I2cDevice i2CDevice = I2cDevice.Create(new I2cConnectionSettings(1, 0x27))) { LcdInterface lcdInterface = LcdInterface.CreateI2c(i2CDevice, false); using (Hd44780 hd44780 = new Lcd2004(lcdInterface)) { hd44780.UnderlineCursorVisible = false; hd44780.BacklightOn = true; hd44780.DisplayOn = true; hd44780.Clear(); ExtendedSample.Test(hd44780); } } }
public Lcd2004 GetLcd() { if (_lcd == default) { _i2c = I2cDevice.Create(new I2cConnectionSettings(1, 0x27)); _lcdDriver = new Pcf8574(_i2c); _lcdGpc = new GpioController(PinNumberingScheme.Logical, _lcdDriver); _lcd = new Lcd2004(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7 }, backlightPin: 3, backlightBrightness: 1.0f, readWritePin: 1, controller: _lcdGpc); } return(_lcd); }
static void Main(string[] args) { Console.WriteLine("You are modified"); using Lcd2004 lcdDisplay = new Lcd2004(22, 17, new int[] { 25, 24, 23, 18 }); using Bmp280 tempSensor = new Bmp280(I2cDevice.Create(new I2cConnectionSettings(1, 0x77))); tempSensor.SetTemperatureSampling(Sampling.UltraHighResolution); tempSensor.SetPowerMode(Bmx280PowerMode.Normal); using CancellationTokenSource cts = new CancellationTokenSource(); Task workTask = Task.Run(() => DoWorkAsync(lcdDisplay, tempSensor, cts.Token), cts.Token); Console.WriteLine("Press Enter to stop the program..."); // Run until user adds input Console.ReadLine(); cts.Cancel(); workTask.Wait(5000); lcdDisplay.Clear(); }
/// <summary> /// This method will use I2C commands to talk to the display. The display is expected to be at address 0x27 and accept 4 bit commands. /// This runs a full test suite against the display. /// </summary> private static void UsingHd44780OverI2C() { using (I2cDevice i2CDevice = I2cDevice.Create(new I2cConnectionSettings(1, 0x27))) { LcdInterface lcdInterface = LcdInterface.CreateI2c(i2CDevice, false); using (Hd44780 hd44780 = new Lcd2004(lcdInterface)) { hd44780.UnderlineCursorVisible = false; hd44780.BacklightOn = true; hd44780.DisplayOn = true; hd44780.Clear(); Console.WriteLine("Display initialized. Press Enter to start tests."); Console.ReadLine(); LcdConsoleSamples.WriteTest(hd44780); ExtendedSample.Test(hd44780); } } }
protected void InitializePeripherals() { _rtc = new DS3231(0x68, 100); // Run once to adjust the time on the RTC // _rtc.CurrentDateTime = new DateTime(2018, 12, 17, 22, 41, 0); _lcd = new Lcd2004 ( RS: N.Pins.GPIO_PIN_D8, E: N.Pins.GPIO_PIN_D9, D4: N.Pins.GPIO_PIN_D10, D5: N.Pins.GPIO_PIN_D11, D6: N.Pins.GPIO_PIN_D12, D7: N.Pins.GPIO_PIN_D13 ); H.PWM _contrast = new H.PWM(H.Cpu.PWMChannel.PWM_0, 1000, 0.6, false); _contrast.Start(); }
public static void Main() { MCP23008 mcp = new MCP23008(); ITextDisplay lcd = new Lcd2004(mcp); lcd.WriteLine("Wilderness Labs", 0); lcd.WriteLine(" Powering", 1); lcd.WriteLine(" Connected", 2); lcd.WriteLine(" Things", 3); //Thread.Sleep(3000); //lcd.Clear(); //byte[] happyFace = { 0x0, 0x0, 0xa, 0x0, 0x11, 0xe, 0x0, 0x0 }; //byte[] sadFace = { 0x0, 0x0, 0xa, 0x0, 0xe, 0x11, 0x0, 0x0 }; //byte[] rocket = { 0x4, 0xa, 0xa, 0xa, 0x11, 0x15, 0xa, 0x0 }; //byte[] heart = { 0x0, 0xa, 0x1f, 0x1f, 0xe, 0x4, 0x0, 0x0 }; //// save the custom characters //lcd.SaveCustomCharacter(happyFace, 1); //lcd.SaveCustomCharacter(sadFace, 2); //lcd.SaveCustomCharacter(rocket, 3); //lcd.SaveCustomCharacter(heart, 4); //lcd.Clear(); //// create our string, using the addresses of the characters //// casted to char. //StringBuilder s = new StringBuilder(); //s.Append("1:" + (char)1 + " "); //s.Append("2:" + (char)2 + " "); //s.Append("3:" + (char)3 + " "); //s.Append("4:" + (char)4 + " "); //lcd.WriteLine(s.ToString(), 0); Thread.Sleep(Timeout.Infinite); }
static async Task DoWorkAsync(Lcd2004 lcd, Bmp280 sensor, CancellationToken token) { string currentTemp = "Current temp:"; while (!token.IsCancellationRequested) { lcd.Clear(); try { Temperature temp = await sensor.ReadTemperatureAsync(); lcd.Write(currentTemp); lcd.SetCursorPosition(0, 1); lcd.Write($"{temp.Celsius.ToString("0.00")} degrees"); } catch (Exception e) { Console.WriteLine("Error when attempting to read the Bme280 sensor:"); Console.WriteLine($" {e.Message}"); Console.WriteLine($" {e.StackTrace}"); } Thread.Sleep(1000); } }
public Display(I2cDevice i2c) { _i2c = i2c; _mcp = new Mcp23008(_i2c); _lcd = new Lcd2004(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7 }, backlightPin: 3, backlightBrightness: 0.1f, readWritePin: 1, controller: _mcp); }
public LcdClockDisplay(Lcd2004 lcd) { _lcd = lcd; }
public void Init() { _i2c = I2cDevice.Create(new I2cConnectionSettings(1, 0x27)); _mcp = new Mcp23008(_i2c); _lcd = new Lcd2004(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7 }, backlightPin: 3, backlightBrightness: 0.1f, readWritePin: 1, controller: _mcp); }