Answer the question
In order to leave comments, you need to log in
Transferring data from Arduino Uno to C#. How to implement?
Suppose you have an Arduino Uno already programmed. It is necessary to implement in the C # program the transfer of data to the Arduino and vice versa. In the standard Arduino IDE (already with the working arduino) this is done by the port monitor:
Please show a good example.
Answer the question
In order to leave comments, you need to log in
communication with arduino goes through the COM port. You need to dig in the direction of the SerialPort class. Something like this
using System;
using System.IO;
using System.IO.Ports;
using System.Text;
namespace MyProgram
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Opening serial port");
SerialPort sp = new SerialPort("COM3", 115200); //порт и скорость обмена
sp.Open();
WriteLine("Hello!");
while (sp.BytesToRead() <= 0)
{
System.Threading.Thread.Sleep(1000);
}
Console.WriteLine(sp.ReadLine());
sp.Close();
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question