How to write in the LED moving Board in C#?

Dirazi 1 Reputation point
2021-11-23T02:51:39.203+00:00

please understand that I am really in need of help. I want to write over the Moving LED board which can be connected through serial connection.
151637-ledmovingboard-min-min.jpg. This is the image of the board. There is a software provided by the company from which this board is bought.
151617-boardsoftware.jpgThis is the image of the software GUI. I tried making a C# GUI for serialPort connection. But however, I could not see the output in the board. When making virtual serial ports and communicating through TeraTerm, The program works perfectly. I even have used HEX code converter. But I am unable to write in this board. Plese have a look at my code and help me.
151642-mygui.pngThis is the picture of GUI I created. The code is as follows. Please suggest me. Thanks in advance

namespace comPort18Nov  
{  
public partial class Form1 : Form  
{  
  
    string dataOut;  
      
    string dataIn;  
    public Form1()  
    {  
        InitializeComponent();  
    }  
  
    private void Form1_Load(object sender, EventArgs e)  
    {  
        string[] ports = SerialPort.GetPortNames();  
        cBoxCOMPORT.Items.AddRange(ports);  
  
        chBoxDtrEnable.Checked = false;  
        serialPort1.DtrEnable=false;  
  
        chBoxRTSEnable.Checked = false;  
        serialPort1.RtsEnable = false;  
  
        btnSendData.Enabled = false;  
        btnOpen.Enabled = true;  
  
        btnClose.Enabled = false;     
        
    }  
  
    private void btnOpen_Click(object sender, EventArgs e)  
    {  
        try  
        {  
            serialPort1.PortName = cBoxCOMPORT.Text;  
            serialPort1.BaudRate = Convert.ToInt32(cBoxBaudRate.Text);  
            serialPort1.DataBits = Convert.ToInt32(cBoxDataBits.Text);  
            serialPort1.StopBits = (StopBits)Enum.Parse(typeof(StopBits), cBoxStopBits.Text);  
            serialPort1.Parity = (Parity)Enum.Parse(typeof(Parity), cBoxParityBits.Text);  
  
            serialPort1.Open();  
            progressBar1.Value = 100;  
  
            //Disable the btnOpen once it is open  
            btnOpen.Enabled = false;  
            btnClose.Enabled = true; //Enable the btnClose  
            btnSendData.Enabled = true;  
  
            //show label status as open  
            lblStatusCom.Text = "ON";  
        }  
        catch (Exception err)  
        {  
            MessageBox.Show(err.Message,"Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);  
            btnOpen.Enabled = true;  
            btnClose.Enabled = false;  
            btnSendData.Enabled = false;  
            lblStatusCom.Text = "OFF"; //label status                 
        }  
    }  
  
    private void btnClose_Click(object sender, EventArgs e)  
    {  
        if (serialPort1.IsOpen)  
        {  
            serialPort1.Close();  
            progressBar1.Value = 0;  
  
            //Enable btnOpen and disable btnClose  
            btnOpen.Enabled = true;  
            btnClose.Enabled = false;  
            btnSendData.Enabled = false;  
  
            //show label status  
  
            lblStatusCom.Text = "OFF";  
        }  
    }  
  
    private void btnSendData_Click(object sender, EventArgs e)  
    {  
        if (serialPort1.IsOpen)  
        {  
            dataOut = toHex(tBoxDataOut.Text);  
            //dataOut = tBoxDataOut.Text;  
            serialPort1.WriteLine(dataOut);  
              
             
              
        }  
    }  
  
    //For Hex Conversion  
      
    public string toHex(string inp)  
    {  
  
        string outp = string.Empty;  
        char[] value = inp.ToCharArray();  
        foreach(char L in value)  
        {  
            int V = Convert.ToInt32(L);  
            outp += string.Format("{0:X2}", V);  
  
        }  
        return outp;  
    }  
      
  
    private void label7_Click(object sender, EventArgs e)  
    {  
  
    }  
  
      
    private void checkBox2_CheckedChanged(object sender, EventArgs e)  
    {  
  
    }  
  
    private void chBoxDtrEnable_CheckedChanged(object sender, EventArgs e)  
    {  
        if (chBoxDtrEnable.Checked)  
        {  
            serialPort1.DtrEnable = true;  
        }  
        else { serialPort1.DtrEnable = false; }  
          
    }  
  
    private void chBoxRTSEnable_CheckedChanged(object sender, EventArgs e)  
    {  
        if (chBoxRTSEnable.Checked)  
        {  
            serialPort1.RtsEnable = true;  
        }  
        else{serialPort1.RtsEnable = false;}  
  
    }  
  
    private void btnClearDataOut_Click(object sender, EventArgs e)  
    {  
        if (tBoxDataOut.Text != "")  
        {  
            tBoxDataOut.Text = "";  
        }  
    }  
  
    private void tBoxDataOut_TextChanged(object sender, EventArgs e)  
    {  
        int dataOutLength = tBoxDataOut.TextLength;  
        lblDataOutLength.Text = string.Format("{0:00}", dataOutLength);  
    }  
    
    private void tBoxDataIn_TextChanged(object sender, EventArgs e)  
    {  
  
    }  
}  
}  
Developer technologies | Windows Forms
Windows for business | Windows Client for IT Pros | Networking | Network connectivity and file sharing
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,926 Reputation points
    2021-11-25T16:23:25.12+00:00

    Hi there,

    Generally speaking the programing process has the below steps.

    -Enter the number of LEDs in width and height on your LED display.
    -Select module type – this means the distance between the centers of two LEDs placed alongside
    -Select luminance.
    -Select frequency of refresh.

    This also changes with respect to the manufacturer , make sure you enquire about this to them to guide you in right way.


    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.