95 lines
2 KiB
Arduino
95 lines
2 KiB
Arduino
|
#if wiflyEnabled
|
||
|
|
||
|
// PACHUBE
|
||
|
|
||
|
void txWiFly() {
|
||
|
|
||
|
if (sleep){Serial.println("Despierta"); digitalWrite(AWAKE, HIGH); }
|
||
|
|
||
|
delay(1000);
|
||
|
wifly.ready(); // tiempo de espera para la conexion!
|
||
|
|
||
|
/*if (wifly.open("www.refarmthecity.org", 80)) {
|
||
|
Serial1.print(" /test/mvb-get-data.php?");
|
||
|
Serial1.print("uid=");
|
||
|
Serial1.print(uid);
|
||
|
Serial1.print("&bid=");
|
||
|
Serial1.print(bid);
|
||
|
Serial1.print("&bl=");
|
||
|
Serial1.println((int)BATvalue);
|
||
|
Serial1.println();
|
||
|
while (!Serial1.available());
|
||
|
delay(10000);
|
||
|
while (Serial1.available())
|
||
|
{
|
||
|
Serial.write(Serial1.read());
|
||
|
//delay(8);
|
||
|
}
|
||
|
Serial.println("Posted to Cosm!");
|
||
|
}
|
||
|
else {
|
||
|
Serial.println("Error posting on Cosm..!");
|
||
|
}
|
||
|
|
||
|
//delay(2000);
|
||
|
|
||
|
if (wifly.isConnected()) {
|
||
|
Serial.println("Old connection active. Closing");
|
||
|
wifly.close();
|
||
|
}*/
|
||
|
// Serial1.print("$$$");
|
||
|
// delay(500);
|
||
|
// Serial1.println();
|
||
|
// Serial1.println();
|
||
|
// Serial1.println("set comm remote $/test/mvb-get-data.php?");
|
||
|
// delay(100);
|
||
|
// Serial1.println("exit");
|
||
|
// delay(2000);
|
||
|
Serial1.print("uid=");
|
||
|
Serial1.print(uid);
|
||
|
Serial1.print("&bid=");
|
||
|
Serial1.print(bid);
|
||
|
Serial1.print("&bl=");
|
||
|
Serial1.print((int)BATvalue);
|
||
|
while (!Serial1.available());
|
||
|
delay(5000);
|
||
|
while (Serial1.available())
|
||
|
{
|
||
|
Serial.write(Serial1.read());
|
||
|
//delay(8);
|
||
|
}
|
||
|
|
||
|
// Serial1.print("$$$");
|
||
|
// delay(500);
|
||
|
// Serial1.println();
|
||
|
// Serial1.println();
|
||
|
// Serial1.println("set comm remote $/test/mvb-send-data.php?");
|
||
|
// delay(100);
|
||
|
// Serial1.println("exit");
|
||
|
// delay(2000);
|
||
|
// Serial1.println();
|
||
|
// while (!Serial1.available());
|
||
|
// delay(5000);
|
||
|
// while (Serial1.available())
|
||
|
// {
|
||
|
// Serial.write(Serial1.read());
|
||
|
// //delay(8);
|
||
|
// }
|
||
|
|
||
|
if (sleep)
|
||
|
{
|
||
|
wifly.sleep();
|
||
|
Serial.println("Duerme");
|
||
|
Serial.println("*******************");
|
||
|
digitalWrite(AWAKE, LOW);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|