How to output from UNO R3 commands from a C# application ?

First thing is to design a protocol that both sides will adhere to. You can base the Arduino side on Robins updated Serial Input Basics; the basics are e.g. in example 3.

The protocol can e.g. be something like <pin,value> to switch a pin on or off or pass a value from 0 to 255 for PWM. Example 5 in above topic will show you how to receive and parse so if you e.g. send <3,128> from the C# application the Arduino can parse it and give pin 3 a PWM value of 128.

You can send a number of them in series like <3,240><7,1><13,0>. There are other ways to send multiple info but they may make life more complicated

Note:
Using text is easier than binary; you can implement the Uno side of things testing with Serial Monitor and once that works as expected you can concentrate on the C# side of things.


I've moved your topic to a section of the forum that is dedicated to interfacing with software on the PC.

2 Likes