Hi all,
Very new to Arduino hoping this is an easy one for you all.
I am trying to find / download a Library called : NRF905.h by electrodragon.
but the only one i can seem to get my hands on is nRF905.h by Zak Kemble.
thanks in advance for the help and i hope i have posted in the correct place.
Cheers
LUKE
Hello lukesb1
Welcome to the worldbest Arduino forum ever.
Take a search engine of your choice and ask the WWW for 'nRF905.h by Zak Kemble' to collect some data to be sorted out to get the needed information.
Have a nice day and enjoy coding in C++.
toddnz
August 22, 2023, 6:59am
4
This is most likely the code. I downloaded the "Code for arduino" zip archive from this site, and I think I can see where the confusion is coming from.
The archive seems to be at least 10 years old. It is no longer a valid library, and needs some minor restructuring to get it compiling.
@lukesb1
It may not be particularly appropriate, but I have repackaged the code from ElectroDragon for you.
NRF905.zip (5.8 KB)
You should now be able to import it like any other .zip library:
Importing a .zip Library
In the menu bar, go to Sketch > Include Library > Add .ZIP Library...
You will be prompted to select the library you want to add. Navigate to the .zip >file’s location and open it.
If you’re using Arduino IDE 2, you may need to restart it for the library to be available[1] .
The examples compile fine on my machine, in IDE 2, for Arduino UNO R3, but I can't confirm whether or not the code actually works.
Hi Delta_G
Yes thats it but no luck with adding the Library unfortunately.
It seem that what "toddnz" has said may be the case, i was just unable to get the code to add to the library but now that he has fixed the code i get a message saying library in installed but can then not find it or use it.
b707
August 23, 2023, 9:19pm
8
Please show how do you try to use it. Do you have a code?
At this point i am just trying to add the Library i havent had any trouble manually adding Librarys in the past so i presume that there is an issue with this one.
/**
@brief nRF905 RX Demo, by elechouse.
*/
#include <NRF905.h>
#include <SPI.h>
#define BUF_LEN 32
#define CONF_LEN 10
#define NRF905_CSN 4
unsigned char write_config_buf[CONF_LEN]={
0x76, //CH_NO,868.4MHZ
0x0E, //output power 10db, resend disable, Current Normal operation
0x44, //4-byte address
0x20,0x20, //receive or send data length 32 bytes
0xCC,0xCC,0xCC,0xCC, //receiving address
0x58, //CRC enable,8bit CRC,external clock disable,16MHZ Oscillator
};
unsigned char rx_buf[BUF_LEN]= {0};
unsigned char read_config_buf[CONF_LEN];
unsigned char rx_address[4]= {0xcc,0xcc,0xcc,0xcc};
void putstring(unsigned char *str)
{
while(*str){
Serial.write(*str++);
}
}
void setup()
{
char i;
pinMode(10, OUTPUT); // make sure SPI works
pinMode(NRF905_CSN,OUTPUT);
nrf905=NRF905(NRF905_CSN);
/** pin/port configuration */
nrf905.init();
/** register configuration */
// user self-defined configuration
// nrf905.write_config(write_config_buf);
/**
default configuration, need to specify frequency
choose Z-Wave frequency band, support :
US 908.42Mhz
EUROPE 868.42MHz
AFRICA 868.42MHz
CHINA 868.42MHz
HK 919.82MHz
JAPAN 853.42MHz
AUSTRALIA 921.42MHz
NEW_ZEALAND 921.42MHz
BRASIL 921.42MHz
Russia 896MHz
*/
nrf905.write_config(CHINA);
/** read register configuration, check register value written */
nrf905.read_config(read_config_buf);
/** serial communication configurate */
Serial.begin(9600);
/** test configuration */
for(i=0; i<CONF_LEN; i++){
Serial.print(read_config_buf[i],HEX);
Serial.print(' ');
}
}
void loop()
{
/** recieve data packet with default RX address */
nrf905.RX(rx_buf);
/** recieve data packet with specified RX address */
// nrf905.RX(rx_buf, rx_address );
// NOTE: TX_Address and RX_Address must be the same
/** send recieved data to PC through serial port */
putstring(rx_buf);
delay(1);
}
/**
@brief nRF905 TX Demo, by elechouse.
*/
#include <LiquidCrystal.h>
#include <NRF905.h>
#include <SPI.h>
#define BUF_LEN 32
#define CONF_LEN 10
#define TrigPin 8
#define EchoPin 9
#define NRF905_CSN 4
int distance;
unsigned char table[10]={'0','1','2','3','4','5','6','7','8','9'};
unsigned char tx_buf[BUF_LEN]= "";
unsigned char read_config_buf[CONF_LEN];
byte tx_address[4]= {0xcc,0xcc,0xcc,0xcc};
LiquidCrystal lcd(A1,A2,A3,A4,A5,10);
void setup()
{
unsigned char i;
pinMode(TrigPin, OUTPUT);
pinMode(EchoPin, INPUT);
//Define the NO.6 pin as the data output pin
//pinMode(6,OUTPUT);
lcd.begin(A1,A3);
lcd.setCursor(4,0);
lcd.print('A');
lcd.print('r');
lcd.print('d');
lcd.print('u');
lcd.print('i');
lcd.print('n');
lcd.print('o');
pinMode(10, OUTPUT); // make sure SPI works
pinMode(NRF905_CSN,OUTPUT);
nrf905=NRF905(NRF905_CSN);
nrf905.init();
/** register configuration */
// user self-defined configuration
// nrf905.write_config(write_config_buf);
/**
default configuration, need to specify frequency
choose Z-Wave frequency band, support :
US 908.42Mhz
EUROPE 868.42MHz
AFRICA 868.42MHz
CHINA 868.42MHz
HK 919.82MHz
JAPAN 853.42MHz
AUSTRALIA 921.42MHz
NEW_ZEALAND 921.42MHz
BRASIL 921.42MHz
Russia 896MHz
*/
nrf905.write_config(CHINA);
nrf905.read_config(read_config_buf);
Serial.begin(9600);
for(i=0; i<10; i++)
{
Serial.print(read_config_buf[i],HEX);
Serial.print(' ');
}
tx_buf[12] = '0';
}
void loop()
{
int a,b,c;
digitalWrite(TrigPin, LOW);
delayMicroseconds(2);
digitalWrite(TrigPin, HIGH);
delayMicroseconds(10);
digitalWrite(TrigPin, LOW);
// Test the width of the pulse and calculate the distance
distance = pulseIn(EchoPin, HIGH) / 58;
a=distance/100;
b=distance%100/10;
c=distance%10;
tx_buf[0]=table[a];
tx_buf[1]=table[b];
tx_buf[2]=table[c];
tx_buf[3]='c';
tx_buf[4]='m';
tx_buf[5]='\r';
tx_buf[6]='\n';
/** transmit data packet with default TX Address */
nrf905.TX(tx_buf);
lcd.setCursor(0,1);
lcd.print('D');
lcd.print('i');
lcd.print('s');
lcd.setCursor(4,1);
lcd.print(a);
lcd.print(b);
lcd.print(c);
lcd.print('c');
lcd.print('m');
/** transmit data packet with specified TX Address */
// nrf905.TX(tx_buf, tx_address);
// NOTE: TX_Address and RX_Address must be the same
/** Count Sending times */
tx_buf[12]++;
if(tx_buf[12] > '9'){
tx_buf[12] = '0';
}
delay(500);
}
this is the code that i am trying to use with it but cannot add the library
b707
August 23, 2023, 9:53pm
13
lukesb1:
cannot add the library
What does it mean? How you try to add it?
You have included the library header in the code - isn't it enough to use it? Do you get a errors while compiling the code? Please show a full error message as text.
toddnz
August 24, 2023, 12:03am
14
I have tested your code on my machine and it compiles fine.
I would have guessed at a conflict between the ElectroDragon and Zak Kemble library, but this does not appear to be an issue.
Please ensure that the folder of your test sketch contains only a single .ino file. The NRF905.cpp and NRF905.h should not be placed here.
As b707 asked, please post any error messages:
Are you able to compile (green "verify" tick button) the examples sketches, from File > Examples > NRF905 > nRF905_RX ?
Ok i think i have maybe missed something happy to share if this what i have but its not much. I assumed (maybe incorrectly) that once added it would show up in the library manager
As you can see it says library installed but then i would expect to see the new library in the Library Manager
im tying to get this project working : https://www.instructables.com/Ultrasonic-Distance-Measurement-NRF905-Wireless-Tr/
so i can retrofit it to my own. if you think it will help I'm happy to share my messy messy code from my project but its not relevant yet i believe.
Cheers
b707
August 25, 2023, 5:22am
16
Seeing the library in the Manager is not important. Plaese test is your code compile with installed library?
1 Like
toddnz
August 25, 2023, 9:39am
17
As you can see it says library installed but then i would expect to see the new library in the Library Manager
To be clear: libraries installed from "Add .ZIP Library" do not show in the library manager.
Although it is not relevant right now, you can read here about finding your manually installed libraries.
1 Like
Hey guys,
Thank you for your help i have got the code to compile.
was unaware that the new code wouldnt show up in the new library list.
Cheers for the help.
1 Like
system
Closed
February 24, 2024, 9:26pm
19
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.