Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Anyone who is good with Arduino and C# please help: I am trying to communicate an Arduino with C#. I am having trouble with the
Anyone who is good with Arduino and C# please help:
I am trying to communicate an Arduino with C#. I am having trouble with the button to create a serial port and the button to close the serial port.
I have attached a picture of what I have done, but it does not work.
Instructions:
-One button that creates a serial port Object and opens the relevant COM port.
-Another button that closes the port.
-When the port is open, turn on a Green LED, and off when the port is closed.
using System; using System. Collections. Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System. Linq; using System. Text; using System. Threading.Tasks; using System.Windows .Forms; using System. IO. Ports; 4. 7 8 9 10 12 namespace WindowsFormsAppA public partial class Form1 Form 15 16 public Form1() InitializeComponent (); 18 19 20 private void button1_Click(object sender, EventArgs e) SerialPort myPort new SerialPort(); myPort. BaudRate = 9600; 23 24 25 26 :myPort. PortName "COM3"; myPort.Open) myPort.Write("1") 28 29 30 private void button2_Click (object sender, EventArgs e) 32 myPort.Write(" myPort.Close(); i1im 34 35Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started