Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: Trying to learn basics of NRF24L01+ on: June 25, 2014, 09:02:56 pm
Thanks TMRh20 for the help. Unfortunately, after making the changes, it still doesn't work at all.

Any other ideas?
2  Using Arduino / Networking, Protocols, and Devices / Re: Trying to learn basics of NRF24L01+ on: June 23, 2014, 02:32:23 am
Thanks for the idea, but I've tried that. Putting the same value in for each pipe yields the same results.
3  Using Arduino / Networking, Protocols, and Devices / Trying to learn basics of NRF24L01+ on: June 23, 2014, 02:01:27 am
I'm trying to learn how to program for the NRF24L01+ wireless radios. After reviewing many sites, I think I'm close, but still can't seem to get a basic program to work. For my simple test, I have one Arduino attached to one NRF24L01+ sending a random number. Then another Arduino attached to another NRF24L01+ to receive this number.   Here's my code...

Sending...
Code:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

RF24 radio(9,10);

const uint64_t pipe = 0xF0F0F0F0E1LL;

void setup(void) {
 
  Serial.begin(57600);
  radio.begin();
  //radio.setRetries(15,15);
  radio.openWritingPipe(pipe);
 
}


void loop () {
 
  unsigned int random_Number = random(0,255);
  Serial.print("Sending: ");
  Serial.println(random_Number);
 
  radio.stopListening(); 
   
  boolean ok = radio.write( &random_Number, sizeof(random_Number) );
   
  if (ok) Serial.println("ok...");
  else Serial.println("failed.");
 
  delay(5000);
 
}


And receiving...
Code:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

RF24 radio(9,10);

const uint64_t pipe = 0xF0F0F0F0D2LL;

void setup(void) {
 
  Serial.begin(57600); 
  radio.begin();
  //radio.setRetries(15,15);
  radio.openReadingPipe(1,pipe);
  radio.startListening();
  Serial.println("Ready!");
 
}


void loop () {
 
  if ( radio.available() ) {
    Serial.println("radio is available");
    unsigned int data;
    boolean done=false;
    while (!done) {
      done = radio.read( &data, sizeof(data) );
      Serial.print("Received: ");
      Serial.println(data);
    }
  }
 
}

On the sending sketch, the serial monitor says...

"Sending: 145
failed."

And on the receiving sketch it only says "Ready".  Never "radio is available".

I have tested it with the "GettingStarted" sketch from the RF24 examples, and it works perfectly - so I know I have them wired correctly.

Any help someone can give me would be greatly appreciated.

Thanks in advance!
4  Community / Gigs and Collaborations / Need help on: May 07, 2014, 10:05:02 pm
Nevermind...
5  Using Arduino / Microcontrollers / Re: Attiny 45 38khz flash on: April 11, 2014, 04:07:05 pm
To generate 38KHz it's better to use one of the timer/counters. I use timer 1 so that timer 0 is still available for supporting the micros() function. This is the code I use:

Code:
void setup()
{
  PORTB = 0;
  DDRB =  0b00000010; // set PB1 (= OCR1A) to be an output
}

// Set the frequency that we will get on pin OCR1A but don't turn it on
void setFrequency(uint16_t freq)
{
  uint32_t requiredDivisor = (F_CPU/2)/(uint32_t)freq;

  uint16_t prescalerVal = 1;
  uint8_t prescalerBits = 1;
  while ((requiredDivisor + prescalerVal/2)/prescalerVal > 256)
  {
    ++prescalerBits;
    prescalerVal <<= 1;
  }
  
  uint8_t top = ((requiredDivisor + (prescalerVal/2))/prescalerVal) - 1;
  TCCR1 = (1 << CTC1) | prescalerBits;
  GTCCR = 0;
  OCR1C = top;
}

// Turn the frequency on
void on()
{
  TCNT1 = 0;
  TCCR1 |= (1 << COM1A0);
}

// Turn the frequency off and turn off the IR LED.
// We let the counter continue running, we just turn off the OCR1A pin.
void off()
{
  TCCR1 &= ~(1 << COM1A0);
}

I'd like to try this code for the Arduino UNO using Analog Pin #4 (PC4).  I think in the setup I need to change it to   PORTC = 0;
  DDRC  = 0b00010000;   However when I this into my Arduino IDE (1.0.5)  it doesn't recognize "TCCR1", "CTC1" & "OCR1C" in the code.  As you can tell here, I'm new here to these advance concepts. Thank you in advance.
6  Using Arduino / Installation & Troubleshooting / Re: Can uploading code harm an Arduino Leonardo board? on: February 01, 2013, 11:58:37 am
SOLVED!!!

Thanks to this post...

http://arduino.cc/forum/index.php/topic,145143.0.html


This made using the reset button and uploading the blink sketch (as Nick suggested) make more sense.

Thanks guys! 
7  Using Arduino / Installation & Troubleshooting / Parallel Programmer & Arduino Leonardo? on: February 01, 2013, 11:28:42 am
For some reason, the bootloader on my Arduino Leonardo is not working - happened just after I uploaded some code.  I have another post that talks about that problem...

http://arduino.cc/forum/index.php/topic,146248.0.html

Right now I'm trying to figure out how to restore my Leonardo and I came across this using the parallel port to upload new code...

http://www.arduino.cc/en/Hacking/ParallelProgrammer?from=Main.ParallelProgrammer


So it looks like I'll need to construct a cable.  My question is, will this work with the Leonardo board?  Anyone aware of any issues or gotchas using the Parallel Programmer method?

Thanks in advance!
8  Using Arduino / Installation & Troubleshooting / Re: Can uploading code harm an Arduino Leonardo board? on: February 01, 2013, 10:01:14 am
The problem is that the windows 7 computer can't see the board.  There is no COM port.  It's only listed as an "unknown device".  Pushing the reset button makes even that go away.  I'm using an Arduino Leonardo board.  My only option it seems like is to re-upload a bootloader.  Found some stuff here...

Looks like I'll need to make a cable...

http://www.arduino.cc/en/Hacking/ParallelProgrammer?from=Main.ParallelProgrammer


Problem is, I don't really know what in my code caused my Arduino to loose it's bootloader in the first place.

Help!
9  Using Arduino / Installation & Troubleshooting / Can uploading code harm an Arduino Leonardo board? on: January 31, 2013, 11:16:54 pm
Okay, first off, I'm new here, teaching myself C, and am not sure what's going wrong - which is why I'm posting my situation here.

I have an Arduino Leonardo board and have uploaded my sketches many times with no problems.   Earlier this week I uploaded new code and immediately after uploading the code the Arduino disappears from the computer (Windows 7) and I get this message "USB Device Not Recognize".  In Windows 7 device manager, the only listing I see is "Unknown Device".  I've tried updating the driver, uninstalling/reinstalling the driver - each time pointing to the Arduino Driver folder.  Each time the result is the same - "The Best Driver software for your device is already installed".  I've tried all the other USB ports - same problem.  I've tried rebooting the computer - same problem.  Pressed the "reset" button on the Arduino - same problem. There is also nothing listed under "PORTS" in the device manager and the "tools/serial port" Arduino menu option is ghosted out.  I've always kept the Arduino in it's original packaging when not in use.  I can't imagine something went wrong with it.  

I contacted the place where I purchased the Arduino and they kindly sent me a replacement with no questions.  When I hooked up the new board, the computer saw it fine.  Everything looked good to go. I then uploaded my code and suddenly the Arduino disappears from the computer and I get the same message "USB Device Not Recognize".  Nothing listed in the ports - same issue as before.  

Which leads me to my question - can uploading code harm an Arduino Leonardo board?  Is there a way to restore the Arduino?  

Thanks in advance!
10  Using Arduino / Installation & Troubleshooting / USB Device Not Recognized on: January 29, 2013, 04:06:31 pm
I went to plug in my Leonardo Arduino today and I get this message "USB Device Not Recognize".  In Windows 7 device manager, it is listed as "Unknown Device".  I've tried updating the driver, uninstalling/reinstalling the driver - each time pointing to the Arduino Driver folder.  Each time the result is the same - "The Best Driver software for your device is already installed".  I've tried all the other USB ports - same problem.  I've tried rebooting the computer - same problem.  Pressed the "reset" button on the Arduino - same problem. There is also nothing listed under "PORTS" in the device manager and the "tools/serial port" Arduino menu option is ghosted out.  I've always kept the Arduino in it's original packaging when not in use.  I can't imagine something went wrong with it.  The last time I used the Arduino was about 4 days ago - and it worked perfectly then and it was kept in it's original box the whole time.

I'm out of ideas - any thoughts?

Thanks in advance!
11  Using Arduino / Programming Questions / What does -> mean? on: January 22, 2013, 01:02:20 am
I'm new to programming so please forgive my lame question. I came across this...

->

...in some code and I can't seem to figure out what it does.

The term was found after downloading the IRremote library from here...

https://github.com/shirriff/Arduino-IRremote

...and opening up the IRrecvDump sketch.

It's used in this context...

int count = results->rawlen;

and here...

Serial.print(results->value, HEX);

Again, I'm sorry if I'm not asking this in the correct place or in the correct manner.  I've been searching the forums and tutorials with no luck - so I thought I'd ask here. 

Thanks in advance!
12  Using Arduino / Installation & Troubleshooting / Re: Noob question on: February 01, 2011, 08:25:47 pm
I didn't realize that I needed to install drivers.  Now it works!

Thanks!

'jammer
13  Using Arduino / Installation & Troubleshooting / Noob question on: February 01, 2011, 05:26:30 pm
I just got the Arduino Duemilanove and I'm trying to upload code to it. 

I'm running Win XP and the only serial port I can select is "COM 3"

When I hook up the Arduino via USB to the computer and select "Upload to I/O Board" I get an error...

Problem uploading to board.

Binary sketch size: 4716 bytes (of a 14336 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x30
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Any ideas?  Does COM 3 mean USB?

Thanks in advance!

'jammer
Pages: [1]