The c# was not connected to my arduino hardware.

Arduino code

byte relayPin[4] = {2,7,8,10};

//D2 → RELAY1

//D7 → RELAY2

//D8 → RELAY3

//D10 → RELAY4

void setup(){

for(int i = 0; i < 4; i++) pinMode(relayPin*,OUTPUT);*
}

// an sample to switch the 4 relays

void loop(){

int i;
for(i = 0; i < 4; i++) digitalWrite(relayPin,HIGH);
delay(1000);
for(i = 0; i < 4; i++) digitalWrite(relayPin,LOW);
delay(1000);

}
I was written below c# code for my arduino code.But the C# code was getting error.
The c# was not connected to my arduino hardware. How to solve this issue.
Please help me to solve this problem.
C# code
private void button1_Click(object sender, EventArgs e)
{

serialPort1.PortName = “COM25”;
serialPort1.BaudRate = 9600;
serialPort1.Open();
Byte[] data = new byte[4];
data[0] = 2;
data[1] = 3;
data[2] = 8;
data[3] = 10;
serialPort1.Write(data, 0, serialPort1.BytesToWrite);
}

If you expect an answer, you will have to ask a question in a way that make some sense and provides some information about the actual problem. Your post does neither. See http://www.catb.org/~esr/faqs/smart-questions.html

Even Carnac couldn’t figure out what to say on this one.

I am guessing that the Arduino is on COM25 and he’s trying to connect to it from a program on his PC… But his Arduino code doesn’t have Serial enabled.

Add

Serial.begin(9600);

To the Arduino setup code.

Not only does it not have serial enabled, there’s no code on the Arduino to read the serial port or do anything with the data.

So what do you want the Arduino to do when it receives 0x02 0x03 0x08 0x0A?

/mike