Recent Posts

Pages: 1 ... 8 9 [10]
91
Software / Problemas al refrescar web esp...
Last post by jsosa89 - Today at 05:02 am
Hola buen dia,
Estoy haciendo pruebas con el modulo esp8266 y no logro obtener los resultados que necesito, que por el momento es lo siguiente:
-escribir en el navegador: http://ip/temperatura1, y recibir los datos correspondientes a temperatura1,
por ahora solo estoy colocando un 38 que es la temperatura ambiente actual.

Bueno, cuando escribo por primera vez http://ip/temperatura1 en el navegador, todo funciona muy bien, el problema viene cuando lo intento de nuevo, y el resultado que obtengo es una notificacion diciendo que la conexion ha sido rechazada...

Se reinicio el modulo, puedo de nuevo ver los datos...

El codigo es el siguiente: (tomando como base ejemplos de la web de jopapa)
Code: [Select]
#define DEBUG true
#define SSID "test"
#define PASS "test"
void setup()
{
  Serial.begin(115200);
  Serial3.begin(115200);
  sendData("AT+RST\r\n",3000,DEBUG);
  sendData("AT+CWMODE=1\r\n",3000,DEBUG);
  boolean connected=false;
  for(int i=0;i<5;i++){
    if(connectWiFi()){
      connected = true;
      break;
    }
  }
  sendData("AT+CIFSR\r\n",3000,DEBUG); // Verificar direccion IP
  sendData("AT+CIPMUX=1\r\n",3000,DEBUG); // Habilitar conecxiones multiples
  sendData("AT+CIPSERVER=1,80\r\n",3000,DEBUG); // Iniciar el servidor en el puerto 80
  delay(500);
  Serial3.println("AT+CIFSR");

}

void loop()
{
  if (Serial3.available())
  {
   //Prueba de concepto aun no se tiene la variable temperatura
    if(Serial3.find("temperatura1")){
      Serial.println("Se solicito temperatura ambiente");
      Serial.println("Temperatura Ambiente: 38");
      http("<!DOCTYPE HTML>");
      http("<html>");
      http("<body>");
      http("38");
      http("</body>");
      http("</html>");
      delay(200);
      Serial3.println("AT+CIPCLOSE=0");//Cerrar sesion TCP
    }
  }

}

String sendData(String command, const int timeout, boolean debug)
{
  String response = "";

  Serial3.print(command); //Enviar la cadena leida al modulo

  long int time = millis();

  while( (time+timeout) > millis())
  {
    while(Serial3.available())
    {
      char c = Serial3.read(); //Leer el siguiete caracter
      response+=c;
    }  
  }

  if(debug)
  {
    Serial.print(response);
  }

  return response;
}


boolean connectWiFi(){
  //Serial3.println("AT+CWMODE=1");
  String cmd="AT+CWJAP=\"";
  cmd+=SSID;
  cmd+="\",\"";
  cmd+=PASS;
  cmd+="\"";
  Serial.println(cmd);
  Serial3.println(cmd);
  delay(2000);
  if(Serial3.find("OK")){
    Serial.println("Conectado a WiFi");
    return true;
  }
  else{
    Serial.println("No puede conectar a WiFi");
    return false;
  }
}


void http(String output)
{
  Serial3.print("AT+CIPSEND=0,"); // AT+CIPSEND=0, num, iniciar sesion tcp
  Serial3.println(output.length());
  if (Serial3.find(">"))                       // Si recibimos la peticion del mensaje
  {    
    Serial.println(output);
    Serial3.println(output);            //Aqui va el string hacia el WIFI
    delay(10);
    while ( Serial3.available() > 0 )
    {
      if (  Serial3.find("SEND OK") )    // Busca el OK en la respuesta del wifi
        break;
    }
  }
}


Adjunto capturas de pantalla de los resultados que obtengo tanto en la consola serie, como en el navegador

¿Que podria ser?
estoy cerrando la conexion con la linea
Serial3.println("AT+CIPCLOSE=0");//Cerrar sesion TCP
¿Esta aqui el problema?
Saludos
92
Thank you for the input Robin2. I will definitely consider your advice.
93
Thanks guys, i really should've looked around google a bit more.
But thanks!
94
Arduino Due / Re: 7" Arduino Display
Last post by ghlawrence2000 - Today at 04:56 am
I am impressed you appear to have done a little research BEFORE turning to the forums to sort out all the problems you will inherently have with the Sainshit TFT. My recommendation would be buy a GENUINE Coldtears 7" display and not a Sainshit rip-off of a Coldtears display.....

Not much more expensive, and (almost) guaranteed to work correctly with no problems with the UTFT suite of libraries by Henning Karlsen (now Rinkydinkelectronics), and not the butchered version Sainshit supply.

Do you see a theme here? Sainshit = crap rip off with poor support..... = asking for trouble....

Coldtears = poor support, but with less potential problems.... :P

You can source your GENUINE Coldtears parts here. http://stores.ebay.com/coldtears-electronics-store/TFT-LCD-Modules-/_i.html?_fsub=3830141016&_sid=680237586&_trksid=p4634.c0.m322

Advice is only that, take it or leave it, but I have already earned my stripes for the sheer quantity of people I have tried to assist AFTER they bought Saincrap and found it not worth the few $$ they saved!

Regards,

Graham

EDIT: Good grief!! Saincrap not even THAT cheap any more..... $106?? Steer clear!!

Get one of these http://www.ebay.com/itm/TFT-SD-Shield-Arduino-DUE-TFT-LCD-Module-SD-Card-Adapter-2-8-3-2-inch-Mega-/121057447668?pt=LH_DefaultDomain_0&hash=item1c2f960ef4

And one of these http://www.ebay.com/itm/7-7-0-inch-TFT-LCD-module-Font-IC-800x480-SSD1963-arduino-DUE-MEGA2560-3-5-4-3-/111008432389?pt=LH_DefaultDomain_0&hash=item19d89e4105

= $76.96 inc shipping!! You're welcome!!  ;) :P
95
Proyectos / Re: Control de temperatura con...
Last post by AlexLPD - Today at 04:56 am
Bueno, ya comenzaron los problemas hahaha...

Me construí un circuito de prueba muy básico 7 leds, a 7 salidas del shif register.

Tiene un problema raro... Y es que no hace nada, hasta que oprimo fisicamente el IC a la placa, ya cambie las conexiones de masa y voltaje, estuve revisando cablecillos pero parece que todo esta bien, de hecho todos los leds se encienden a veces solo levemente, y uno comienza la secuencia, pero despues se borra y hace una cosa media extraña...





Incluso agregue una resistencia de 10k al pin 10 y a masa, como lo tiene en el ejemplo... no se...algo se me paso en esto.

-Alex.
96
Msquare,
Nice... Thank you.
97
Did you make up those library directory file names yourself ?

The library directory file name should probably match the name of the library .h and .cpp files which are inside them.
98
It looks like you have got your libraries directories all screwed up.

When you change your libraries directories,  you also need to restart the Arduino IDE,   because the arduino IDE only examines the libraries directories when it starts up.

99
Arduino Yún / Re: Arduino Yun GET data from ...
Last post by jafrei - Today at 04:49 am
Hi,

I can't help you with this specific problem, but I have solved similar problems.

Maybe the architecture you chose is not very efficient.

IMHO accessing the web from the MCU part of the Yun through the bridge is a bit like painting a room through the key hole. It might work, but is it efficient?

I would write python scripts that run on Atheros processor and handle all the web stuff, parse the json, etc., and then with the same python program put the result into the bridge in the form of a simple command or value.

The sketch on the Atmel processor could then just poll for just that specific value in the bridge.

jafrei
100
Code: [Select]
if(342 < sensorValue < 682)

Syntax error.  You can only have one comparison at a time.  You can string them together with && (AND) or || (OR).

I think you want:
Code: [Select]
if((342 < sensorValue) && (sensorValue < 682))
THANK YOU. Yes, that was the problem. Thank you for all your help, seriously.

Now tomorrow I can try to tackle the fading between colors problem. But at least I have the minimum of what I wanted to do. So again, thank you very much.
Pages: 1 ... 8 9 [10]

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy