ngocthanhit / xig

Automatically exported from code.google.com/p/xig
0 stars 0 forks source link

Example Arduino code for API mode #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Perhaps I'm amiss, but the sample code provided is for 'transparent/command' 
mode between the 'Digi Connect Port' and the 'Arduino+Xbee'.  Can you provide 
an example for using API mode instead?

I've attempted the following Arduino code [below]  which does not make a web 
request.  
But I see this on the 'Connect Port':
RECV: 8 bytes from ('[00:13:a2:00:40:6f:80:2c]!', 232, 49413, 17)

//Arduino Code
#include <XBee.h> 
#include <string.h>

XBee xbee = XBee(); 
char basehtml[30] = "http://foo.com/bar";

XBeeAddress64 addr64 = XBeeAddress64(0x00000000, 0x0000ffff); 
ZBTxRequest zbTx = ZBTxRequest(addr64, (uint8_t*) (basehtml), 
strlen(basehtml)); 

void setup() {
  xbee.begin(9600);
  Serial.begin(9600);
  } 

void loop() { 
  Serial.println("http://foo.com/bar"); // as used in the example, this doesn't work
  xbee.send(zbTx);  // this returns 'RECV...' message above

  delay(1000); } 

Original issue reported on code.google.com by stevenr...@gmail.com on 16 May 2011 at 8:43

GoogleCodeExporter commented 9 years ago
Apologies, I had omitted the '\r\n' in my 'basehtml' URL request in my caffeine 
induced stupor.

Please close. 

Original comment by stevenr...@gmail.com on 16 May 2011 at 9:22

GoogleCodeExporter commented 9 years ago
Rob, do you think you could tackle this one and add something to the Wiki?

Original comment by Jordan.H...@gmail.com on 2 Jun 2011 at 12:36

GoogleCodeExporter commented 9 years ago

Original comment by Jordan.H...@gmail.com on 10 Sep 2011 at 3:40