Odd Behavior: RF24 and DigitalWrite()

Hi all,

I've been sending 1 byte from one nrf24l01+ to another with no problems. Let's say the value I'm sending is 190.
Today I've been wanting to add LEDs to Pins 3 and 4 (Duemilanove) so I make those pins as Outputs and I initially set them low using digitalWrite(3,LOW) in setup(). I don't even set them HIGH and the value I receive from the nrf24l01+ instead of being 150 is around 730 or something, but it's consistent and reproducible (even the number I get!).

Am I missing something here?

So to re-iterate:
With no digitalWrite(3,LOW) in setup(), I receive the value of 190, no problem.
With digitalWrite(3,LOW) in setup(), I receive the value of 730 but it's always 730 (or whatever the number was).

Am I missing something here?

Yep. Some code for us to look at.

Here you go: #include <SPI.h>#include "nRF24L01.h"#include "RF24.h"#include "printf.h" - Pastebin.com
This code gets unit 1 to send '190' to unit 2. Then waits for unit 2 to send back the '190'. If 190 is received, digital pin 2 goes high.


Ok tested it by sending different numbers, I think I've got something.

When I send 190 I get 702
50 -> 562

It's clear that I get a value that is 512 too high. But this only happens when I call digitalWrite(2,LOW) in setup().
When I don't call digitalWrite, the values are received at their normal value....

edit: If I call digitalWrite at the begining of loop() instead, then the values are sent normally... this is so weird!!!

I can't get to pastebin from work, and, for the same reasons I can't get there from work, I won't go there from home. There is an Additional Options link below this window, where you can attach your code HERE.

I placed it in the attachment here.

send_recv.txt (1.84 KB)