Answer the question
In order to leave comments, you need to log in
MonoDevelop Serial Port?
Hello, I am writing in C # in MonoDevelop, you need to open the port, and put all the data received from the port into the textbox, everything worked out without problems in the console application, but when I tried to create a graphical shell, I ran into a problem, the application form does not load, the program seems to be listening port and can not do anything else, the code is at least in principle, but I have been suffering with it for a long time, I am not particularly strong in programming. Thanks for the help.
using System;
using Gtk;
using System.IO.Ports;
using System.Threading;
public partial class MainWindow: Gtk.Window
{
public MainWindow (): base (Gtk.WindowType.Toplevel)
{
Build ();
GetValues ();
}
public void GetValues()
{
SerialPort sp = new SerialPort ("/dev/ttyAMA0", 9600, Parity.None, 8, StopBits.One);
sp.Open ();
if (sp.IsOpen)
{
while(true) //I thing this is a problem!
{
queue.Buffer.Text += Convert.ToChar (sp.ReadChar ());
}
}
}
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
a.RetVal = true;
}
}
if (sp.IsOpen)
{ queue.Buffer.Text += Convert.ToChar (sp.ReadChar ());
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question