How to fix "Does not name a type" error?

Hi all
I keep on getting a "Does not name a type error" for this line of code, how do i fix it?


Error message:

'nrf905' does not name a type; did you mean 'nRF905'?

I know it says change to nRF905 but that is already a variable thing from the library i'm using

Full Code:

#include <SPI.h>
#include <nRF905.h>

int NRF905_CSN = 10;

byte Message[] = {0b00000000, 0b10000001, 0b10000010, 0b10000011, 0b10000100, 0b10000101, 0b10000110, 0b10000111, 0b10001000, 0b10011000, 0b10101000, 0b10111000, 0b11001000, 0b11011000, 0b11101000, 0b11111001, 0b00101001, 0b00111001, 0b01011001, 0b01101001, 0b01111001, 0b10011010, 0b10011011, 0b10011101, 0b10011110, 0b10011111, 0b10101010, 0b11101011, 0b01101011, 0b11101101, 0b11101110, 0b11111111};
byte mess_Address = {0xB54CAB34};

void setup() {
  // put your setup code here, to run once:
  pinMode(NRF905_CSN, OUTPUT); //to make sure SPI works

  nrf905.setPayloadSize(32, 0); // Will transmit 5 byte payloads, receive 32 byte payloads
  nrf905.setAddressSize(4, 4);
  nrf905.write(mess_Address, Message, sizeof(Message));



void loop() {
  // put your main code here, to run repeatedly:
  nrf905.TX(NRF905_NEXTMODE_STANDBY, false);

You haven't declared the variable type of "nrf905" - int, float, string etc.

What would the variable type be? i couldnt find any variables on the Arduino website that would fit this

What is the function nRF905 outputting?
if it outputs an int, float etc?

1 Like

That’s how you declare the type

nRF905 nrf905=nRF905(NRF905_CSN);

Like you would do for any other variable

1 Like

I tried that and it came back with the error

no matching function for call to 'nRF905::nRF905(int&)'

Just try naming the type of variable as an int, check if it works.

no it didn’t work

try void or will that not work

the documentation says that 'nRF905' is a constructor/deconstructor if that helps

the void one came back with

variable or field 'nrf905' declared void

I'm not sure how to do that, I'll do some more research.

1 Like


Not sure but can you use #define?

that was what i had originally but i kept on getting this error whenever i used the nrf905 variable

expected primary-expression before '.' token

Does your library come with examples? If so, look at those.
Do you have a link to the library?

yes right here nRF905 Radio Library for Arduino: Main Page

here is probably the most relevant example code for me

 * Project: nRF905 Radio Library for Arduino (Low power sensor node example)
 * Author: Zak Kemble,
 * Copyright: (C) 2020 by Zak Kemble
 * License: GNU GPL v3 (see License.txt)
 * Web:

// This examples requires the low power library from

// This examples configures the nRF905 library to only use 5 connections:
// SCK
// SS -> 6
// PWR -> 8

// The following pins on the nRF905 must be connected to VCC (3.3V) or GND:
// CE (TRX_EN) -> VCC
// TXE (TX_EN) -> VCC

#include <nRF905.h>
#include <SPI.h>
#include <LowPower.h>

#define NODE_ID				78
#define LED					A5

nRF905 transceiver = nRF905();

static bool txDone; // NOTE: In polling mode this does not need to be volatile

// Event function for TX completion
void nRF905_onTxComplete(nRF905* device)
	txDone = true;

void setup()
	Serial.println(F("Sensor node starting..."));
	pinMode(LED, OUTPUT);

	// standby off TODO
	//pinMode(7, OUTPUT);
	//digitalWrite(7, HIGH);
	// pwr
	//pinMode(8, OUTPUT);
	//digitalWrite(8, HIGH);
	// trx
	//pinMode(9, OUTPUT);
	//digitalWrite(9, HIGH);
	// This must be called first

	// Minimal wires (polling mode)
	// Up to 5 wires can be disconnected, however this will reduce functionalliy and will put the library into polling mode instead of interrupt mode.
	// In polling mode the .poll() method must be called as often as possible. If .poll() is not called often enough then events may be missed.
		NRF905_PIN_UNUSED, // CE (standby) pin must be connected to VCC (3.3V)
		NRF905_PIN_UNUSED, // TRX (RX/TX mode) pin must be connected to VCC (3.3V) (force TX mode)
		8, // PWR
		NRF905_PIN_UNUSED, // Without the CD pin collision avoidance will be disabled
		NRF905_PIN_UNUSED, // Without the DR pin the library will run in polling mode and poll the status register over SPI. This also means the nRF905 can not wake the MCU up from sleep mode
		NRF905_PIN_UNUSED, // Without the AM pin the library must poll the status register over SPI.
		NULL, // Running in polling mode so no interrupt function
		NULL // Running in polling mode so no interrupt function

	// Register event functions

	// Low-mid transmit level -2dBm (631uW)

	Serial.println(F("Sensor node started"));

void loop()
	digitalWrite(LED, HIGH);

	uint8_t buffer[NRF905_MAX_PAYLOAD];
	// Read some digital pins and analog values
	int val1 = analogRead(A0);
	int val2 = analogRead(A1);
	int val3 = analogRead(A2);
	buffer[0] = NODE_ID;
	buffer[1] = digitalRead(5);
	buffer[2] = digitalRead(7);
	buffer[3] = digitalRead(9);
	buffer[4] = val1>>8;
	buffer[5] = val1;
	buffer[6] = val2>>8;
	buffer[7] = val2;
	buffer[8] = val3>>8;
	buffer[9] = val3;
	Serial.print(F("Analog values: "));
	Serial.print(F(" "));
	Serial.print(F(" "));
	Serial.print(F("Digital values: "));
	Serial.print(F(" "));
	Serial.print(F(" "));


	// Write data to radio
	transceiver.write(BASE_STATION_ADDR, buffer, sizeof(buffer));

	txDone = false;

	// This will power-up the radio and send the data
	transceiver.TX(NRF905_NEXTMODE_TX, false);

	// Transmission will take approx 6-7ms to complete (smaller paylaod sizes will be faster)

	// Transmission done, power-down the radio
	// NOTE:
	// After the payload has been sent the radio will continue to transmit an empty carrier wave until .powerDown() is called. Since this is a sensor node that doesn't need to receive data, only transmit and go into low power mode, this example hard wires the radio into TX mode (TXE connected to VCC) to reduce number of connections to the Arduino.
	digitalWrite(LED, LOW);

	// TODO
	// Sleep for 64 seconds
	//uint8_t sleepCounter = 8;
	// Sleep for 1 second
		LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF);

Have you read through this and checked the correct circuit?

yes i have

It looks like the code that you presented in your opening post is written for a different nRF905 library.

I've installed the library, took the lowpwr_node_sensor example (your code in reply #17 is incomplete) and it compiles.

I suggest that you base your code on the examples that come with the library