multithreading - C# use SerialPort in Thread loop -


i have issue, want use serial port in thread loop. can't because thread not static , threadloop static. know how ?

my code (simplified) :

public static void threadloop()     {         // code simplified in example...                  {             sendtoarduino(coordinate, r, g, b)          } while (thread.currentthread.isalive);     }      private static void sendtoarduino(string coordinate, byte r, byte g, byte b)     {         currentport.writeline(coordinate);         currentport.write(new byte[] {r, g, b}, 0, 4);     } 

thanks in advance.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -