Show Posts
Pages: 1 ... 24 25 [26] 27 28 ... 35
376  Using Arduino / Networking, Protocols, and Devices / Re: Arduino+XBee communicate with bare XBee? on: June 30, 2012, 08:29:52 pm
I didn't mean to imply that I wanted xhee.h running on the 3rd XBee, I understand that doesn't make sense since it's not connected to an Arduino.  What functions in the xbee.h library would let me read the input values on the 3rd XBee?
377  Using Arduino / Networking, Protocols, and Devices / Re: Leonardo + Ethernet R3 - need ICSP connector? on: June 30, 2012, 10:39:28 am
I read that, but I wasn't sure if the Arduino can use the digital I/O pins to communicate with the Ethernet shield.  On the Ethernet shield page it says:
Quote
Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). This is on digital pins 11, 12, and 13 on the Duemilanove and pins 50, 51, and 52 on the Mega.

I found this a bit confusing.  I wasn't sure if the Leonardo can communicate on pins 11-13 or not.  I just took a look at the Ethernet shield schematic and it doesn't look like pins 11-13 are connected to anything, so I guess you have to use the ICSP header only to communicate with the Ethernet shield.
378  Using Arduino / Networking, Protocols, and Devices / Arduino+XBee communicate with bare XBee? on: June 30, 2012, 10:12:56 am
I've got two XBees Series 1 (API mode) each connected to an Arduino and I can get them to communicate using xbee.h library.  I'd like to add a 3rd XBee to the mix that is not connected to an Arduino and it has some sensors connected to it's inputs.  Is this possible?  Are there functions in the xbee.h library that would let me read the inputs on the 3rd XBee?
379  Using Arduino / Networking, Protocols, and Devices / Leonardo + Ethernet R3 - need ICSP connector? on: June 30, 2012, 10:07:45 am
I have a Leonardo board I'm using with an Ethernet shield R3.  They work fine together, but if I put a proto shield in-between them it doesn't work.  I'm guessing that it doesn't work because the ICSP connector on the Ethernet shield doesn't plug into anything in this configuration.  Would the ICSP connector cause this problem?  If so, how do I get the shield to work without using the ICSP connector?
380  Using Arduino / Networking, Protocols, and Devices / Re: xBee.h doesn't compile with leonardo - Serial problem on: June 26, 2012, 06:37:24 am
That worked, thanks!
381  Using Arduino / Networking, Protocols, and Devices / Re: xbee Coordinator - is this Tx or Rx on: June 25, 2012, 09:15:10 pm
I just did some more testing and realized it doesn't matter, either XBee and transmit and receive. 
382  Using Arduino / Networking, Protocols, and Devices / Re: xBee.h doesn't compile with leonardo - Serial problem on: June 25, 2012, 08:02:32 pm
I made the change and made sure I closed then re-opened the Arduino IDE, but my sketch didn't compile when I selected the Leonardo board.  I got this error:

/Volumes/srg/Arduino Sketches/libraries/XBee/XBee.cpp: In constructor 'XBee::XBee()':
/Volumes/srg/Arduino Sketches/libraries/XBee/XBee.cpp:774: error: cannot convert 'Serial_*' to 'HardwareSerial*' in assignment
383  Using Arduino / Networking, Protocols, and Devices / Re: xBee.h doesn't compile with leonardo - Serial problem on: June 25, 2012, 01:32:00 pm
That worked, thanks.   In the \libraries\ folder I created a new directory called \XBee_Leo and copied XBee.h and XBee.cpp in there and renamed them to XBeeLeo.h and XBeeLeo.cpp.  In the XBeeLeo.cpp I made the serial1 change and changed #include XBee.h to #include XBeeLeo.h.  In my sketch I just changed the include from <XBee.h> to <XbeeLeo.h> and all is good. 

It would be nice if one library could compile both Leonardo boards and non-Leonardo boards. I tried some stuff with #ifdef, but it didn't work.  Here's what I tried:
First I changed added a #define to my sketch:
Code:
#define LEONARDO
#include <XBee.h>
In XBee.cpp, I changed
Code:
_serial = &Serial;
to
Code:
#ifdef LEONARDO
   _serial = &Serial1;
#else
   _serial = &Serial;
#endif

But this didn't work.



384  Using Arduino / Networking, Protocols, and Devices / Re: xbee Coordinator - is this Tx or Rx on: June 23, 2012, 06:20:28 pm
I figured it out, the Coordinator is the xbee receiver.
385  Using Arduino / Programming Questions / Re: Best practice for digitalWrite() on: June 23, 2012, 11:11:21 am
While it won't make much difference from a power perspective, it can make a big difference from a timing perspective.
From a timing perspective, digitalWrite() is very time consuming for what it does.

I was thinking about doing a little test for that, now I don't have to.  What about digitalRead() an analogRead(), do they take up as much time as digitalWrite()?
386  Using Arduino / Networking, Protocols, and Devices / xbee Coordinator - is this Tx or Rx on: June 23, 2012, 10:12:48 am
I am trying out the examples that came with xbee.h library.  I configured my two xbees, one as coordinator and one as the end device.  There is a sample Tx and sample Rx sketch (I'm using Series 1).  Should I load the Tx sketch onto the Arduino with the coordinator xbee?
387  Using Arduino / Networking, Protocols, and Devices / xBee.h doesn't compile with leonardo - Serial problem on: June 23, 2012, 09:46:34 am
I am trying to use xbee.h (http://code.google.com/p/xbee-arduino/) with the new Leonardo.  I get this error when I verify the sketch:
769: error: cannot convert 'Serial_*' to 'HardwareSerial*' in assignment

I assume it has something to do with the Leonardo not using serial by default and you have to use Serial1 or something, but I don't know what code to change to fix this.  Can anyone help?

--Scott
388  Using Arduino / Programming Questions / Re: Best practice for digitalWrite() on: June 22, 2012, 07:42:40 pm
Neither sketch ever actually assigns a value to turnMeOn, so neither will ever actually turn the pin on.

I didn't intend to put a complete working sketch, I just wanted enough code so my question was clear.
389  Using Arduino / Programming Questions / Best practice for digitalWrite() on: June 22, 2012, 07:23:16 pm
If I want to turn something on with digitalWrite() there are two ways I can code this.  I'm wondering if one is preferable to the other. 
The first method is to execute the digitalWrite() command in every loop of the sketch, like this:
Code:
void loop()
{
  static bool TurnMeOn;
  if(TurnMeOn == true)
  {digitalWrite(MyPin, HIGH);}
  else
  {digitalWrite(MyPin, LOW);}
}

The second is to turn the output on once, and not do it every loop. For example:
Code:
void loop()
{
  static bool TurnMeOn;
  static bool OutputIsOn;
  if(TurnMeOn == true && OutPutIsOn == false)
  {
    digitalWrite(MyPin, HIGH);
    OutPutIsOn = true;
  }
  else
 {
  digitalWrite(MyPin, LOW);
  OutPutIsOn = false;
 }
}
Does is make any difference between these two methods?

390  Using Arduino / Networking, Protocols, and Devices / Re: Leonardo Digital Pins 0 and 1 on: June 18, 2012, 07:00:07 am
Thanks.  I know nothing about serial interface, but I do have a project that uses an xbee.  I wonder if there is any advantage of using pins 0 and 1 with the xbee.  If so, I'm assuming a library would have to be written to take advantage of the UART.
Pages: 1 ... 24 25 [26] 27 28 ... 35