Control Arduino - with PC using C#

preview_player
Показать описание
Build a program for your computer that can control your Arduino.
This example controls pin 13 but you could use it for almost anything that your Arduino can do

Link for Visual studio
Рекомендации по теме
Комментарии
Автор

Great Video. Being able to send messages to an Arduino from a C# program opens up so many possibilities. Good breakdown of the basics of getting it going. Thanks for the video.

overengineeredinoz
Автор

this video has helped me so much, thanks for uploading :)

lecodsportif
Автор

Thank you so much! It works perfectly!

Slushee
Автор

Thank you so much for this video, I have a simple question, can we add a REBOOT button? I have a machine that I am rebooting always and I am looking if we can add this button in this tutorial. Thank you again.

abdelkiki
Автор

Thanks! This is great.
You can help me communication modbus RTU with C#?

ngotrungtruc
Автор

Interesting video. Been thinking of getting into Arduino and wanted to see if I could do the programming in C#. Thanks for the information. Correct me if I'm wrong but you sound like you're from Australia. Hope all is well for you down under :)

steveng
Автор

Hi, great tutorial I implement it without any issues. A while ago I am trying to expand my knowledge in Arduino communication over serial. The question is there: first :if you add to the scene a simple switch on a scheme and while it's 'on' output on relay is also high(that's simple), but add a simple final loop on a PC program to set relay to high, that's what almost getting me crazy, do you have any suggestions how to handle overflow over com

imagiro
Автор

Sometimes it works, sometimes it doesn't, from both the Arduino IDE and the C# app. Interestingly the onboard RX led flashes each time I click on "on" or send a message from serial plotter. Maybe it has to do something with Serial.available()....

andrisszalai
Автор

i can t understand in the first part of compiling you have many part of code that don t appared to me

nuovovideo
Автор

serialport tool isn't showing.. would you pls help me to sort out the problem sir

happinesswithinyourheart
Автор

HI..i make project (" Arduino Ball Color Sorter "), my project is complete successfully hard ware .. i wanner make interface (C#) but (COM6) is not available please help please...

shaidahamakareemmohammed
Автор

Guys, maybe you know what's going on? When I press any button in my program, it will say "Access to COM3 denied". Thanks.

artemtaylor
Автор

Hi, I hope someone, in the best way 50 Hz, reads this still. I have got the problem, that it works inside the serial monitor of my arduino IDE, but not via C#-Application, so the Coms also not appear to me in my portbox, altough I have copied most of your code. Also I am using Checkboxes. too. Is there anything important to using Checkboxes with this type of programm?


This is my programm:


public partial class LegoTrainController : Form
{
public LegoTrainController()
{
InitializeComponent();
}

private void TrainController_Load(object sender, EventArgs e)
{
try
{

PortBox.SelectedIndex = 0;
serialPort1.BaudRate = (9600);
serialPort1.ReadTimeout = (2000);
serialPort1.WriteTimeout = (2000);
}
catch ( Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void sender, EventArgs e)
{
try
{
serialPort1.PortName = PortBox.Text;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void HBGleis1_Click(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void HBGleis2_Click(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Umbaugleis_Click(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Flughafen_Click(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Wohngebiet_Click(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Freizeitpark_Click(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void ICE_CheckedChanged(object sender, EventArgs e)
{
try
{
serialPort1.Open();
serialPort1.WriteLine("ICE");
serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void SBahn1_CheckedChanged(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void SBahn2_CheckedChanged(object sender, EventArgs e)
{
try
{
serialPort1.Open();

serialPort1.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}

Flec
Автор

error what is this = " the name 'portbox' does not exist in the current context "

staff
Автор

Can you share the VS code? When I run with VS 2019 I get error: "InvalidArgument=value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex".

YigalBZ
Автор

Hi mate, where did you learn how to use Visual Studio? Looks swish.

RD-niqe
Автор

Did you connect your Arduino to a USB port? (my computer doesn't have a serial port)

amadeusbojiuc
Автор

It don't work but dosen't tell me any error

truesmiley
Автор

I have the same example with visual basic 😂

hacktheplanetraktor
visit shbcf.ru