Hey Guys. So basically i want to make a flash application that will have 2 Buttons to control 2 Led's (on/off). I have this script for the arduino that does this through arduinos serial port. I have a Serproxy (socket server) which is already correctly set up. Please help me understand how to code some buttons in flash to turn on these led outputs. THANKS!
int LedPin ();
void setup ()
{
//Create Serial Object
Serial.begin(9600);
pinMode (5, OUTPUT);
pinMode (3, OUTPUT);
}
void loop ()
{
//Have the arduino wait to recieve input
while (Serial.available() == 0);
//Read The Input
int val = Serial.read() -'0';
if (val == 1 )
{
Serial.println("left");
digitalWrite(3, HIGH);
}
else if (val == 2)
{
Serial.println("off");
digitalWrite(3, LOW);
}
else if (val == 3 )
{
Serial.println("right");
digitalWrite(5, HIGH);
}
else if (val == 4)
{
Serial.println("off");
digitalWrite(5, LOW);
}
else
{
Serial.println("Suck a bag of dicks");
}
Serial.flush();
}