So all you need to get started is an arduino some led's 2 - 7 and the client, i have mine on now, so go ahead, switch on any
of the pins from 2 - 7 from the client or in code.
void setup()
{
Serial.begin( 9600 );
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
ResetPins;
//7 for now... (this source code is just how i think it's done
//if you can do better feel free.. remember you can send
//pin1 or /pin85 it just gets relayed to all the other
//arduino boards connected, so how you develop
//the protocol is up to you, all i have to do is server
//management.. or anyone else who hosts a server.
//simply connect some ids from pins 2 to 7 (not tx/recv 0/1)
}
void loop()
{
String cstr;
char c;
int b = 0;
int pin,n = 0;
boolean pincheck;
int pinstate;
cstr="";
while (Serial.available())
{
c = Serial.read();
if (c=='\n' || c=='\r') break;
cstr=cstr+c;
//turn them off
}
//Serial.println(cstr);
pinstate=HIGH;
if (cstr=="reset") ResetPins();
if (cstr=="pin2") digitalWrite(2,pinstate);
if (cstr=="pin3") digitalWrite(3,pinstate);
if (cstr=="pin4") digitalWrite(4,pinstate);
if (cstr=="pin5") digitalWrite(5,pinstate);
if (cstr=="pin6") digitalWrite(6,pinstate);
if (cstr=="pin7") digitalWrite(7,pinstate);
pinstate=LOW;
if (cstr=="pinl2") digitalWrite(2,pinstate);
if (cstr=="pinl3") digitalWrite(3,pinstate);
if (cstr=="pinl4") digitalWrite(4,pinstate);
if (cstr=="pinl5") digitalWrite(5,pinstate);
if (cstr=="pinl6") digitalWrite(6,pinstate);
if (cstr=="pinl7") digitalWrite(7,pinstate);
delay(500);
}
void ResetPins()
{
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
}
//now turn them on based on event
//s contains info from server, so all we do is act on it.
//to debug, turn off the client/arduino server so you can
//use ArduinoClient 1.0 to view the data you send here with
//for(n=3; n>=7; n++)
// {
// Serial.print("pin");
// Serial.print(n);
// Serial.println();
// delay(2000);
// }