I have made a program to control a servo with a potentiometer. The potentiometer and the servo can communicate through the NRF24L01 module. But it doesn’t work.
If you are not good in englisch use google-translate
Write your detailed message in your native language and let do googletranslate do the translation.
The grammar won't be brilliant but it will be easy to understand. And that is the important thing.
You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps
press Ctrl-T for autoformatting your code
do a rightclick with the mouse and choose "copy for forum"
paste clipboard into write-window of a posting
You can re-edit your first posting.
You should a description what you can watach what your software is doing.
For debuging purposes you should add serial output to see what is going on in your code.
If you don't know how to add serial output just ask
best regards Stefan
I set up 2 Unos with rf24 radios, sender with pot and receiver with servo. I only changed pins (CE, CSN, servo pin) to test your code. It works fine. I can adjust the position of the servo with the potentiometer.
How are the radio modules powered? The most likely cause of problems with rf24 radios is lack of current capability of the power supply. I use homemade adapters like these with great success.
Carefully check your wiring.
Check out Robin2's simple rf24 tutorial. He discusses the power problem and some remedies. His tutorial is what I used to get my radios to work. There is a sketch to test the physical wired connection between the radio module and its processor (see reply #30).
You should add the capacitor or larger 100 uF as @TomGeorge reminds you.
Do not expect to power the servo from the Arduino 5 volt pin. Use an external power source with more than adequate current. Do you know what the current requirement of your servo is?
Get a simple set of programs you had nothing to do with writing working. No potentiometer, no servo. Test your wiring and NRFs this way. If your wiring is bad, or they broke, you are out of luck and didn't even know why.
If you want to skip those steps, at least:
Remove the servo from you circuit and see if the Serial.print line on the servo side is producing plausible values.
Until you can see plausible values for myservo.write(…), it is a waste of time to actually add the servo.
if you take pictures then on the picture must be visible which wire starts where and ends where
in one and the same picture. The letters on the connectors must be readable.
The alternative is a hand-drawn schematic.
The NRF24L-module has a documentation where each and every pin is named.
With your fritzing picture and your smartphone-pictures you have posted yet
you force your potential users to look up the documentation which pin is what.
This is work that you have to do. The hand-drawn connecting lines between the NRF24 and the arduino can wiggle up / down / left / right as much as they want as long it is easy to see which arduino-IO-pin-number is connected to pin-number of the NRF24
You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps
press Ctrl-T for autoformatting your code
do a rightclick with the mouse and choose "copy for forum"
paste clipboard into write-window of a posting
A very effictive way to anaylse what is really going on is to add Serial.print-commands
to see in the serial monitor what is really going on in your code.
I would suggest carefully reading and following Robin2's simple rf24 tutorial. That tutorial was instrumental in me getting my rf24 radios to work. Get those basic sketches to work.
Run the CheckConnection.ino sketch in reply #30 and post the results.