1

I want to display some text on my 16x2 LCD display with my Raspberry Pi 3 with Windows IoT, but the output is completly unreadable. My wiring should be good so I don't know what is the problem. I created a new Universal Windows project in VS 2015. Here is the code snipeet where I use the LCD:

public sealed partial class MainPage : Page
    {
        LCD lcd;

        public async void initLCD()
        {
            lcd = new LCD(16, 2);
            await lcd.InitAsync(16, 20, 05, 06, 13, 19); //pin RS, E, D4, D5, D6 and D7
            await lcd.clearAsync();
        }

        public MainPage()
        {
            this.InitializeComponent();
            initLCD();
            while (true)

            {
                lcd.setCursor(0, 1); //write to the second row
                lcd.write(DateTime.Now.ToString("HH:mm:ss"));
            }

        }

    }

I use this library to write some text to the LCD but when I deploy and run this code to the Raspberry and I stop the program than I get this output: enter image description here

  • There must be a wiring issue somewhere? Incorrect pin state or something not wired in completely. I am sure we could blame Windows IoT quickly but based on the actual tutorial that rules IoT itself out as it works for them. I suggest you leave the project for a day, sleep on it, come back and recheck everything. A fresh mind will spot something out of place. – Piotr Kula Mar 16 '17 at 8:12
  • Try moving the loop out from MainPage constructor and into a Button callback instead. To be hones.. having a loop on main thread is a bad idea.. ideally you want to fork the loop into its own thread once you sort out the display.. because the Pi wont be able to do anything else apart than update the LCD... – Piotr Kula Mar 16 '17 at 8:26
  • Any luck with this? – Piotr Kula Mar 17 '17 at 8:33
  • Since I can't comment yet, I have to post this as an answer: As the other commenters said, it could be a wiring issue. Have you tried grounding the RW pin. Certain LCD's require that, it was the same with mine (it came in an Adafruit pack). – Mentha Suaveolens Apr 5 '17 at 17:41
  • The wiring looks good. I have to send bytes to the LCD "really" slow. It means that I send bytes to the LCD every seconds. The library contains a sendbyte() function (which was a private function) so I have to convert my string to byte array and send string to the LCD by bytes. – dinci11 Apr 19 '17 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.