Thank you put I can download the RF24 libary,they say that the zip file doesn't contain a libary it's saying this:
Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
java.io.IOException: Zip doesn't contain a library
at processing.app.Base.handleAddLibrary(Base.java:2319)
at processing.app.Base$7.actionPerformed(Base.java:1157)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Zip doesn't contain a library
java.io.IOException: Zip doesn't contain a library
at processing.app.Base.handleAddLibrary(Base.java:2319)
at processing.app.Base$7.actionPerformed(Base.java:1157)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Zip doesn't contain a library
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
On my Linux system I just extract the zip file - which creates a folder called RF24-master.
I rename that to RF24.
Then I copy (or move) the folder to the libraries folder in my Arduino sketchbook folder. On my PC the sketchbook folder is called /mnt/sdb1/SGT-Prog/Arduino and the libraries folder is /mnt/sdb1/SGT-Prog/Arduino/libraries
Then it is necessary to restart the IDE for it to see the change.
Samuelridet:
I can't add any library you gave to me!
Brief answers like that may be appropriate when you are talking to someone face to face and can get an instant response and where the person giving advice can see your PC. They are not helpful for the Forum where there is a long time lag.
You need to provide as much information as you can - for example full details of the exact steps you used to install the library and full details of how your Arduino IDE is configured. And full details of the tests you carried out that make you believe the library is not installed correctly.
And, by the way, I did not give you the library - I just told you where to find it.
Ok, I finally added both library and I triedthe little test to transmit data from one arduino to another. It worked. Later, I am going to try with the joystick and the servo.
ok I tried with the servo and the joystick, but I couldn’t compile the receiver code. I have the SoftwareServo libary and the Nrf24 library but it doesn’t work. this the code, maybe I didn’t copy-paste a thing:
#include <SoftwareServo.h>
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h> // Comes with Arduino IDE
// NEED the SoftwareServo library installed
// http://playground.arduino.cc/uploads/ComponentLib/SoftwareServo.zip
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN 7 // The pins to be used for CE and SN
#define CSN_PIN 8
#define ServoHorizontalPIN 3 //Pin Numbers for servos and laser/LED
#define ServoVerticalPIN 5
#define LaserPIN 6
#define ServoMIN_H 30 // Don't go to very end of servo travel
#define ServoMAX_H 150 // which may not be all the way from 0 to 180.
#define ServoMIN_V 30 // Don't go to very end of servo travel
#define ServoMAX_V 150 // which may not be all the way from 0 to 180
/*-----( Declare objects )-----*/
/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus (usually) pins 7 & 8 (Can be changed) */
RF24 radio(CE_PIN, CSN_PIN);
SoftwareServo HorizontalServo;
SoftwareServo VerticalServo; // create servo objects to control servos
/*-----( Declare Variables )-----*/
byte addresses[][6] = {"1Node", "2Node"}; // These will be the names of the "Pipes"
// Allows testing of radios and code without servo hardware. Set 'true' when servos connected
boolean hasHardware = false; // Allows testing of radios and code without Joystick hardware.
//boolean hasHardware = true;
int HorizontalJoystickReceived; // Variable to store received Joystick values
int HorizontalServoPosition; // variable to store the servo position
int VerticalJoystickReceived; // Variable to store received Joystick values
int VerticalServoPosition; // variable to store the servo positio
/**
Create a data structure for transmitting and receiving data
This allows many variables to be easily sent and received in a single transmission
See http://www.cplusplus.com/doc/tutorial/structures/
*/
struct dataStruct {
unsigned long _micros; // to save response times
int Xposition; // The Joystick position values
int Yposition;
bool switchOn; // The Joystick push-down switch
} myData; // This can be accessed in the form: myData.Xposition etc.
void setup() /****** SETUP: RUNS ONCE ******/
{
Serial.begin(115200); // MUST reset the Serial Monitor to 115200 (lower right of window )
// NOTE: The "F" in the print statements means "unchangable data; save in Flash Memory to conserve SRAM"
Serial.println(F("YourDuino.com Example: Receive joystick data by nRF24L01 radio from another Arduino"));
Serial.println(F("and control servos if attached (Check 'hasHardware' variable"));
printf_begin(); // Needed for "printDetails" Takes up some memory
/*-----( Set up servos )-----*/
if (hasHardware)
{
HorizontalServo.attach(ServoHorizontalPIN); // attaches the servo to the servo object
VerticalServo.attach(ServoVerticalPIN);
}
radio.begin(); // Initialize the nRF24L01 Radio
radio.setChannel(108); // 2.508 Ghz - Above most Wifi Channels
radio.setDataRate(RF24_250KBPS); // Fast enough.. Better range
// Set the Power Amplifier Level low to prevent power supply related issues since this is a
// getting_started sketch, and the likelihood of close proximity of the devices. RF24_PA_MAX is default.
// PALevelcan be one of four levels: RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX
radio.setPALevel(RF24_PA_LOW);
// radio.setPALevel(RF24_PA_MAX);
// Open a writing and reading pipe on each radio, with opposite addresses
radio.openWritingPipe(addresses[1]);
radio.openReadingPipe(1, addresses[0]);
// Start the radio listening for data
radio.startListening();
// radio.printDetails(); //Uncomment to show LOTS of debugging information
}//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
if ( radio.available())
{
while (radio.available()) // While there is data ready to be retrieved from the receive pipe
{
radio.read( &myData, sizeof(myData) ); // Get the data
}
radio.stopListening(); // First, stop listening so we can transmit
radio.write( &myData, sizeof(myData) ); // Send the received data back.
radio.startListening(); // Now, resume listening so we catch the next packets.
Serial.print(F("Packet Received - Sent response ")); // Print the received packet data
Serial.print(myData._micros);
Serial.print(F("uS X= "));
Serial.print(myData.Xposition);
Serial.print(F(" Y= "));
Serial.print(myData.Yposition);
if ( myData.switchOn == 1)
{
Serial.println(F(" Switch ON"));
}
else
{
Serial.println(F(" Switch OFF"));
}
} // END radio available
if (hasHardware)
{
/*-----( Calculate servo position values, send to the servos )-----*/
SoftwareServo::refresh();//refreshes servo to keep them updating
HorizontalJoystickReceived = myData.Xposition; // Get the values received
VerticalJoystickReceived = myData.Yposition;
// scale it to use it with the servo (value between MIN and MAX)
HorizontalServoPosition = map(HorizontalJoystickReceived, 0, 1023, ServoMIN_H , ServoMAX_H);
VerticalServoPosition = map(VerticalJoystickReceived, 0, 1023, ServoMIN_V , ServoMAX_V);
// tell servos to go to position
HorizontalServo.write(HorizontalServoPosition);
VerticalServo.write(VerticalServoPosition);
} // END hasHardware
}//--(end main loop )---
/*-----( Declare User-written Functions )-----*/
// NONE YET
//*********( THE END )***********
You have a variable called hasHardware and it is set to false which means that the hardware stuff is ignored. Change it to true and see what happens. Read lines 35, 36 and 37 of the program.
Or is it that the program won’t compile? If so, please post the error message that you get.
I posted a new, and more complete nRF24 tutorial here. It may of interest.