Hello everyone, I ran into a problem trying to send an HTTP GET request to a GoPro camera via UNO + XBee (not the shield).
I've used the link below on a basis of how to write the program and essentially modified it for my needs.
https://learn.sparkfun.com/tutorials/internet-datalogging-with-arduino-and-xbee-wifi/discuss
Here is the modified code:
#include <SoftwareSerial.h>
const byte XB_RX = 2; // XBee's RX (Din) pin
const byte XB_TX = 3; // XBee's TX (Dout) pin
SoftwareSerial xB(XB_RX, XB_TX);
const int XBEE_BAUD = 9600; // Your XBee's baud (9600 is default)
const unsigned long UPDATE_RATE = 11000;
unsigned long lastUpdate = 0; // Keep track of last update time
void setup()
{
// Set up serial ports:
Serial.begin(9600);
xB.begin(XBEE_BAUD);
if (sendData())
Serial.println("SUCCESS!");
else
Serial.println("Failed :(");
}
void loop()
{
// If current time is UPDATE_RATE milliseconds greater than
// the last update rate, send new data.
if (millis() > (lastUpdate + UPDATE_RATE))
{
Serial.print("Sending update...");
if (sendData())
Serial.println("SUCCESS!");
else
Serial.println("Failed :(");
lastUpdate = millis();
}
}
byte sendData()
{
xB.flush(); // Flush data so we get fresh stuff in
xB.print("GET /bacpac/PW?t=pw&p=%01 HTTP/1.0");
}
Using the browser, I can easily send http://10.5.5.9/bacpac/SH?t=PASSWORD&p= and it would turn on the gopro. However, when I try to do this via Uno, + XBee it simply would not work. Checking the serial monitor, I get Success! and then I get Sending update...SUCCESS! but the gopro stays off.
I have already pre configured the XBEE using XTCU to be an IBSS Joiner (The gopro creates an ad hoc network), gave it a static ip, and set it to TCP. (I used this information here to do that: http://ftp1.digi.com/support/documentation/doc_xbee_wifi_adhoc.pdf). I'm not to sure if I have to change the port to 8080 for just sending an HTTP GET.
Anyone have any idea what the problem might be?
EDIT: I have 4 connections:
Vcc to 3.3v on arduino
Dout to pin 3 of arduino
Din to pin 2 of arduino
GND to GND
I just turned off the GoPro WiFi, and ran the code, I'm still getting success even though the WiFi is off.