Home Support Forums

Main Menu

Login

Note: The Issue Tracker currently has a separate login.



Support Forums
Welcome, Guest
Please Login or Register.    Lost Password?
C# example
(1 viewing) 1 Guest
Go to bottomPost New TopicPost Reply
TOPIC: C# example
#3
Steven

C# example 2 Years, 10 Months ago  
Can anyone give an example of how to use this library in C#?

Specifically, I just need to be able to set a line of text at a time.

So for example I would like to be able to do something like this in C#:

SetPico(0,"This is some text"); //where zero is the line number

I am pretty sure this would require some sort of wrapper, but I'm not sure how to accomplish it.
 
Logged Logged
  Reply Quote
#4
Steven

Re:C# example 2 Years, 10 Months ago  
Well,

Looks like I answered my own question... lol.

Here is an example I came up with that works.

Code:


using System;
using System.Collections.Generic;
using System.Text;
using PicoLCDLib;
static class PicoLCD
{
    #region "Private Members"

    private static List<PicoLCD_4x20> Picos = new List<PicoLCD_4x20>();

    #endregion

    public static void SetPico(int lineNum, string lineText)
    {
        try
        {
            Picos.AddRange(PicoLCD_4x20.EnumeratePicoLCDDevices());

            foreach (PicoLCD_4x20 Pico in Picos)
            {

                Pico.Cache = false;

                Pico.set_Text(lineNum, lineText);

                Pico.Contrast = 0;
                Pico.Backlight = 15;
            }
        }
        catch (Exception ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.ToString());
        }
    }


 
Logged Logged
  Reply Quote
Go to topPost New TopicPost Reply