HELP with arduino flash and php :S


I'm gonna try to explain my problem 'cause is a bit complitated.

I made an application with Flash that connects to PHP and send some data to MYSQL. To connect to php I used Apache through the IPadress Then I connected as well flash and Arduino trough serProxy with the IPadress So, Arduino send some data to flash. Everything works fine, if is not all together at the same time. For example, I can read signals from arduino if the Apache is closed or I can send data to MYSQL if serProxy is closed. But not using both at the same time. Then I tried to upload the flash program into a web server to work without localhost and to leave free the ipAdress just for the serProxy.

When I open the aplication trough mozilla (because now is on the net), the Arduino connects for a second and then it disconnects automatically.

I don't know how to solve this. I guess that is a problem of hosts.

I hope that someone gonna have an idea.

Thank you

I hope that someone gonna have an idea.

I have an idea that you should at least post the Arduino code.

Here you have the code. But this code works perfectly with flash. The problem is about host adress and ports.

int pinFum = 11;
int pinAlarma = 12;
int pinSirena = 13;
int pinUltraso = 9;
int pinPes = 8;
int pinLaser = 7;
int pinFoto = 0;
long valfoto;
unsigned long rebot = 0;
unsigned long valor = 0;
int valPes;
int t = 1000;
int tempsDeCanvi,tempsDeCarregaLaser,tempsTornada = 0;
int distancia,comensar,agafat,hasGuanyat,hasPerdut,final = 0;
int i;

void setup () {
  Serial.begin (19200);
  pinMode (pinAlarma,OUTPUT);
  pinMode (pinFum,OUTPUT);
  pinMode (pinSirena,OUTPUT);
  pinMode (pinPes,INPUT);

unsigned long ping(){
   //inicialitzem el sensor
 pinMode(pinUltraso, OUTPUT); 
 digitalWrite(pinUltraso, LOW); 
 digitalWrite(pinUltraso, HIGH); 
 digitalWrite(pinUltraso, LOW); 
 //Convertim el pin digital de Sortida en pin digital d'entrada.
 pinMode(pinUltraso, INPUT);
 //Llançem una pulsasio
 digitalWrite(pinUltraso, HIGH); 
 // escoltem el rebot de la pulsacio
 rebot = pulseIn(pinUltraso, HIGH); 
  //convertim el rebot en centimetres
 valor = (rebot / 58.138); 
 return valor;
 void sirena () {
   for (i=0; i<5; i++) {
   digitalWrite (pinSirena,HIGH);
 void fum () {
  digitalWrite (pinFum,HIGH);
  digitalWrite (pinFum,LOW);
void loop () {
  //Quan has guanyat
  if (hasGuanyat == 1 && final == 0) {
    //Arduino Sends to serProxy '3'
    final = 1;
  } else if (hasPerdut ==1 && final == 0) {
      //Arduino Sends to serProxy '2'
    final = 1;
    digitalWrite (pinAlarma,HIGH);
  } else {
    valPes = digitalRead (pinPes);
    // Si ja sa començat el joc, s'arriba a l'estand i s'agafa l'objecte
     if (valPes ==0 && comensar == 1) {
      //Arduino Sends to serProxy '4'
      if (tempsDeCanvi>500) {
      tempsTornada = 0;
      hasPerdut = 1;
      } else {
      //ha agafat l'objecte
      agafat = 1;
      tempsDeCanvi ++;
    //Si l'objecte es al seu lloc
    if (valPes == 1) {
      distancia = ping();
    //Si detectem que l'usuari comensa a jugar per primer cop
      if (distancia < 50 && comensar == 0) {
        comensar = 1;
        tempsDeCarregaLaser = 0;
        digitalWrite (pinLaser,HIGH);
        //Arduino Sends to serProxy '1'
      if (comensar==1) {
        if (agafat==1) {
          tempsTornada ++;
        //marge de temps pq el laser doni tota la seva potencia
        if (tempsDeCarregaLaser > 100) {
          for (int i = 0;i<500;i++){
                valfoto +=  analogRead (pinFoto);
          valfoto = valfoto/500;
          //Si l'usuari toca el laser
          if (valfoto<100) {
              hasPerdut = 1;
        } else {
          tempsDeCarregaLaser ++;
      // Si s'ha arribat a la linia de meta i es te l'objecte a la ma
      if (distancia<50 && comensar == 1 && tempsTornada >50) {
          digitalWrite (pinLaser,LOW);
          hasGuanyat = 1;
      tempsDeCanvi = 0;

But this code works perfectly with flash. The problem is about host adress and ports.

If you ask what size resistor to use with your LED on pin 8, on the Flash forum, are they going to help you?

You have a problem with an application on your PC, not with the application talking to the Arduino, with the Arduino talking to the application on the PC, or with the Arduino.

So, your question is inappropriate here.