I have Arduino UNO, Bread Board, resistors, LEDs and jumper wires.
I am able to light on/off only 1 LED from my c sharp program. How can I set inputs to all leds to turn on/off all leds at same time through C Sharp code.
try
{
int intVal;
int binVal;
int.TryParse(decimalTxtBox.Text, out intVal);
string binaryValue = ConvertDecimalToBinary(intVal); // converts decimal to binary
binaryLbl.Text = binaryValue.PadLeft(4, '0'); // does the padding if binary is less than 4 digits
Thread.Sleep(2000);
foreach (char bin in binaryLbl.Text) // takes each bits of binary
{
int.TryParse(bin.ToString(), out binVal);
if (binVal == 1)
{
serialPort1.Write("1"); // writes to input to LEDs turns ON LEDs
}
else
{
serialPort1.Write("0"); // writes to input to LEDs turns OFF LEDs
}
}
This program is wrting to one LED but I want each input to different LEDs.
Can anyone help me to resolve this issue?