i'm new and I already searched the forums, but i wasn't able to find something regarding my question.
Okay. I don't own an arduino board yet but i want to learn about how to program it, to begin just when it arrives.
so what i want to do is following. i want to control 5-10 (25amps) relays over serial port, using php on a linux server. i have read some tutorials on how to interface php with the arduino board but all of them are utilizing only one output.
i know how to open a connection and write one ascii 1 to the serial port. and i can understand how the arduino code works to process the ascii 1 it just got.
now i want to know, how to identify other pins in the arduino code and in php. are there any tutorials regarding this?
int usbnumber;
//Define pin names above
void loop() {
if (Serial.available() > 0) {
usbnumber = Serial.read();
switch (usbnumber) {
case 5:
//Send a 5 to turn on pin 5
digitalWrite(5,HIGH);
break;
case 50:
//Send 50 to turn off pin 5
digitalWrite(5,LOW);
break;
case 13:
//Send 13 to turn on pin 13
digitalWrite(13,LOW);
break;
case 130:
//Send 130 to turn off pin 13
digitalWrite(13,LOW);
break;
}
}
}
Then just send integers over serial, and change/add to the case loop however you please.