Serial port Communication problem
hello , using visual c# develop program read information send via serial port arduino uno board , uploaded program send number 0 1023 delaying 1 second ( depending on input signal ) , program has read signal , display in listbox . have declared infinite loop ( ) , permanently reads input value .
my written code working , when press button , includes code below , program hanging ( doesn't functioning more ) , values in listbox being added , can't press other buttons , can't close program .
code looks :
string input = ""; arduinoport.open (); (int = 0;;i++) { info = arduinoport.readline(); listbox1.items.add (info); } arduinoport.close();
hi,
to avoid hanging use application.doevents()
eg:
string input = "";
arduinoport.open ();
for (int = 0;;i++)
{
info = arduinoport.readline();
listbox1.items.add (info);
application.doevents();
}
arduinoport.close();
ps.shakeer hussain
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment