Notifications
Clear all

Unable to compile this code, can anyone tell me why it is not working ?

22 Posts
5 Users
0 Likes
8,025 Views
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

From the topic title, I know that it doesn't look like a very Important kind of Question but here this code in which I am getting this problem is kind of special. I got this code from "Howtomechatronics.com".

By this code we can control a servo motor using Potentiometer Through the nrf24l01 module. the library that I used here is "RF24- master" and "RF24 network" Library. Since there are very few codes available that can tell you how to control a servo motor by potentiometer using the nrf24l01 modules, which can be useful in robotics project.

Here whenever i try to compile the code in Arduino ide I am always getting an Error like "exit status 1
Error compiling for board Arduino/Genuino Uno.
". I don't know why i am getting this kind of error while compiling it. that's why I would Like to Share this Code With you to know if you are also getting the same error or maybe you are able to fix this error. 

Please tell me About it.

Transmitter code:-

/*
  Arduino Wireless Network - Multiple NRF24L01 Tutorial
 == Example 01 - Servo Control / Node 00 - Potentiometer ==
  by Dejan, www.HowToMechatronics.com
  Libraries:
  nRF24/RF24,  https://github.com/nRF24/RF24 
  nRF24/RF24Network,  https://github.com/nRF24/RF24Network 
*/
#include <RF24.h>
#include <RF24Network.h>
#include <SPI.h>

RF24 radio(10, 9);               // nRF24L01 (CE,CSN)
RF24Network network(radio);      // Include the radio in the network
const uint16_t this_node = 00;   // Address of this node in Octal format ( 04,031, etc)
const uint16_t node01 = 01;      

void setup() {
  SPI.begin();
  radio.begin();
  network.begin(90, this_node);  //(channel, node address)
}

void loop() {
  network.update();
  unsigned long potValue = analogRead(A0);  // Read the potentiometer value
  unsigned long angleValue = map(potValue, 0, 1023, 0, 180); // Convert the value to 0-180
  RF24NetworkHeader header(node01);     // (Address where the data is going)
  bool ok = network.write(header, &angleValue, sizeof(angleValue)); // Send the data
}


Receiver Code:-
/* Arduino Wireless Network - Multiple NRF24L01 Tutorial == Example 01 - Servo Control / Node 01 - Servo motor == */ #include <RF24.h> #include <RF24Network.h> #include <SPI.h> #include <Servo.h> RF24 radio(10, 9); // nRF24L01 (CE,CSN) RF24Network network(radio); // Include the radio in the network const uint16_t this_node = 01; // Address of our node in Octal format ( 04,031, etc) Servo myservo; // create servo object to control a servo void setup() { SPI.begin(); radio.begin(); network.begin(90, this_node); //(channel, node address) myservo.attach(3); // (servo pin) } void loop() { network.update(); while ( network.available() ) { // Is there any incoming data? RF24NetworkHeader header; unsigned long incomingData; network.read(header, &incomingData, sizeof(incomingData)); // Read the incoming data myservo.write(incomingData); // tell servo to go to a particular angle } }
You an Also check the code at the websites official page down below
https://howtomechatronics.com/tutorials/arduino/how-to-build-an-arduino-wireless-network-with-multiple-nrf24l01-modules/

Thank You


   
Quote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

exit status 1
Error compiling for board Arduino/Genuino Uno.

The above is just the end of the error message!

Try and compile it again, click the "Copy error messages" button and paste into your post!

And make sure that "Show verbose output during" compilation is checked!


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

@pugwash

Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'uint16_t RF24Network::read(RF24NetworkHeader&, void*, uint16_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:694:12: error: 'rf24_min' was not declared in this scope

maxlen = rf24_min(maxlen,bufsize);

^~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:694:12: note: suggested alternative: 'fmin'

maxlen = rf24_min(maxlen,bufsize);

^~~~~~~~

fmin

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write(RF24NetworkHeader&, const void*, uint16_t, uint16_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:794:25: error: 'rf24_min' was not declared in this scope

uint16_t fragmentLen = rf24_min((uint16_t)(len-offset),max_frame_payload_size);

^~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:794:25: note: suggested alternative: 'fmin'

uint16_t fragmentLen = rf24_min((uint16_t)(len-offset),max_frame_payload_size);

^~~~~~~~

fmin

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:827:16: error: 'class RF24' has no member named 'txStandBy'

ok = radio.txStandBy(txTimeout);

^~~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write(uint16_t, uint8_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:974:11: error: 'class RF24' has no member named 'txStandBy'

radio.txStandBy(txTimeout);

^~~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write_to_pipe(uint16_t, uint8_t, bool)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:1083:14: error: 'class RF24' has no member named 'writeFast'; did you mean 'write'?

ok = radio.writeFast(frame_buffer, frame_size,0);

^~~~~~~~~

write

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:1086:16: error: 'class RF24' has no member named 'txStandBy'

ok = radio.txStandBy(txTimeout);

^~~~~~~~~

Multiple libraries were found for "SPI.h"
Used: C:\Program
Multiple libraries were found for "RF24Network.h"
Used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master
Multiple libraries were found for "Servo.h"
Used: C:\Program
Not used: C:\Users\GULSHAN\Documents\Arduino\libraries\Servo-master
Multiple libraries were found for "RF24.h"
Used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24-master
Not used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24-1.3.3
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@gulshan

Did you copy the code from one sketch window or two sketch windows? Because the first thing that I noticed is that there are two different sketches in your code.

Sorry about such a naive question ? 

Multiple libraries were found for "RF24Network.h"

This makes me suspect that you have two sketches!


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

@pugwash

yes actually i was in hurry for a bit

 


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

that was the error code message from Receiver code


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

This is from the Transmitter CODE

Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'uint16_t RF24Network::read(RF24NetworkHeader&, void*, uint16_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:694:12: error: 'rf24_min' was not declared in this scope

maxlen = rf24_min(maxlen,bufsize);

^~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:694:12: note: suggested alternative: 'fmin'

maxlen = rf24_min(maxlen,bufsize);

^~~~~~~~

fmin

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write(RF24NetworkHeader&, const void*, uint16_t, uint16_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:794:25: error: 'rf24_min' was not declared in this scope

uint16_t fragmentLen = rf24_min((uint16_t)(len-offset),max_frame_payload_size);

^~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:794:25: note: suggested alternative: 'fmin'

uint16_t fragmentLen = rf24_min((uint16_t)(len-offset),max_frame_payload_size);

^~~~~~~~

fmin

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:827:16: error: 'class RF24' has no member named 'txStandBy'

ok = radio.txStandBy(txTimeout);

^~~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write(uint16_t, uint8_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:974:11: error: 'class RF24' has no member named 'txStandBy'

radio.txStandBy(txTimeout);

^~~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write_to_pipe(uint16_t, uint8_t, bool)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:1083:14: error: 'class RF24' has no member named 'writeFast'; did you mean 'write'?

ok = radio.writeFast(frame_buffer, frame_size,0);

^~~~~~~~~

write

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:1086:16: error: 'class RF24' has no member named 'txStandBy'

ok = radio.txStandBy(txTimeout);

^~~~~~~~~

Multiple libraries were found for "SPI.h"
Used: C:\Program
Multiple libraries were found for "RF24Network.h"
Used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master
Multiple libraries were found for "RF24.h"
Used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24-master
Not used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24-1.3.3
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@gulshan

Both of those sketches compile perfectly, just tried it!!


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

@pugwash

How? I mean which version of arduino ino you are using ? 

 


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@gulshan

Both of these sketches compile in the Arduino 1.8.10 IDE

 

 

Try them!!


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

@pugwash

I have the same version but still it is causing the same problem for Both Codes. should I Just Uninstall it or There is a certain library to fix it ?


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@gulshan

Compile one of the sketches and post the error. I don't think any other library would help, a fresh install of the Arduino IDE might. ? 


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

@pugwash

Here it is from The Receiver Code :-

Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'uint16_t RF24Network::read(RF24NetworkHeader&, void*, uint16_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:694:12: error: 'rf24_min' was not declared in this scope

maxlen = rf24_min(maxlen,bufsize);

^~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:694:12: note: suggested alternative: 'fmin'

maxlen = rf24_min(maxlen,bufsize);

^~~~~~~~

fmin

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write(RF24NetworkHeader&, const void*, uint16_t, uint16_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:794:25: error: 'rf24_min' was not declared in this scope

uint16_t fragmentLen = rf24_min((uint16_t)(len-offset),max_frame_payload_size);

^~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:794:25: note: suggested alternative: 'fmin'

uint16_t fragmentLen = rf24_min((uint16_t)(len-offset),max_frame_payload_size);

^~~~~~~~

fmin

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:827:16: error: 'class RF24' has no member named 'txStandBy'

ok = radio.txStandBy(txTimeout);

^~~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write(uint16_t, uint8_t)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:974:11: error: 'class RF24' has no member named 'txStandBy'

radio.txStandBy(txTimeout);

^~~~~~~~~

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp: In member function 'bool RF24Network::write_to_pipe(uint16_t, uint8_t, bool)':

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:1083:14: error: 'class RF24' has no member named 'writeFast'; did you mean 'write'?

ok = radio.writeFast(frame_buffer, frame_size,0);

^~~~~~~~~

write

C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master\RF24Network.cpp:1086:16: error: 'class RF24' has no member named 'txStandBy'

ok = radio.txStandBy(txTimeout);

^~~~~~~~~

Multiple libraries were found for "RF24.h"
Used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24-master
Not used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24-1.3.3
Multiple libraries were found for "SPI.h"
Used: C:\Program
Multiple libraries were found for "RF24Network.h"
Used: C:\Users\GULSHAN\Documents\Arduino\libraries\RF24Network-master
Multiple libraries were found for "Servo.h"
Used: C:\Program
Not used: C:\Users\GULSHAN\Documents\Arduino\libraries\Servo-master
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@gulshan

it may be a good idea to check this folder

C:\Users\GULSHAN\Documents\Arduino\libraries\

to see if you have multiple versions of the libraries you are calling in your sketch, alternatively, delete all the libraries your sketch is using, try and compile again, and check whether you get a "not found error". If you do, reinstall that library and repeat, it is possible that you have the same libraries at different locations on your hard disk.


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 4 years ago
Posts: 127
Topic starter  

@pugwash

Yeah!!!!! Yes It worked ?   Thanks


   
ReplyQuote
Page 1 / 2