Arduino & c# – RGB LED / LED STRIP CONTROL c# Application

Hello world! Today i made a c# Application with visual studio to control RGB Leds/Led strips. The Arduino code is very simple.
The source is open to modify and included in this description.

In the C# Code you can use 2 options to send a color to the arduino from each button, examples are below.

1: Using RGB Values
First open the Project file in Visual Studio.

Open the code Form1.cs

go to:
public partial class Form1 : Form
change and add new values and names like below:

private Color RedColor1 = Color.FromArgb(255, 0, 0);

Next place this.SetColor(RedColor1); at a (NEW) button like the example below.

=====================================
2: Using color names (These are Web Colors)

Simply place the following at a button and choose a color:
SetColor(Color.Red);

example below:

=================
The color panel:
(Windows color dialog)
Press the Color Panel button to open the Color Dialog.
Not all colors work form the Color Dialog because RGB Leds cannot generate any color from every value, But it gives you a wide choice of colors that can be used.
=================

HOW to modify?:
Files you modify in the C# source are the following. Form1.cs & Form.1Designer.cs
To modify the look of the Application you simply double click on Form1.cs and the Form1.cs [Design] should pop up. You can now drag and drop buttons and whatever you want from the toolbox, and change background in the properties etc. If adding a button for example, double click the button to give it a function, Double clicking it will bring you to the part of the code that belongs to the button.

You can also change the about box by double clicking on the about box AboutBox1.cs, You can change background, font, colors etc. To change company name, version etc. you can double click Properties in the [solution explorer]. And then at [application] click on [assembly information], you can also modify AssemblyInfo.cs directly.

Follow the next steps for the Schematic, Code, Parts list and C# Source Download.

Schematic:

RGB LED CONTROL c# Application arduino_bb
RGB LED CONTROL c# Application arduino_bb

Just wire it up as the schematic, make sure if you have common Cathode or Common Anode leds.

For Common anode the Black wire on the schematic should go to 5v​.

For common Cathode the black wire on the schematic used GND.

(So if the leds are not working switch from GND to 5v or 5v to GND, this probably will solve your problem.)

 

Parts list:

  • Arduino uno
  • KY-016 RGB Led Module (A Single RGB or LED strip will do to, for a led strip you need to add a RGB Led Amplifier or make one yourself.)
  • Jumper Wires set
  • C# Application .exe program (or build yourself one from the source)
  • Visual Studio (Optional, only if you want to build your own application)

See this instructable on how to wire up a RGB Led Amplifier​
​​https://www.instructables.com/id/RGB-Led-STRIP-Control-Arduino-Android-BLUETOOTH-SM/
Good luck!

Download C# Source here

Download .exe program here

FULL SOURCE ON GitHub

Arduino Code:

 

Buy sensors here: http://arduinosensors.nl

facebook-profile-picture
Danny van den Brande

http://www.arduinosensors.nl

I like to code electronics, do 3D Design, Webdesign and Graphic Design.

Leave a Reply

Your email address will not be published. Required fields are marked *