Author Options:

How to use nrf24l01 (transciever) with arduino to control servos with potentiometers? Answered

I am trying to  control 6 separate servos connected to one arduino 6 seperate potentiometers connected to another arduino. The two arduinos are connected wirelessly with an nrf24l01 connected to each arduino (total of 2 nrf24l01 being used). I modified the code from this instructable:
which controls 1 servo with 1 potentiometer. I think I might have done something wrong since I am not too familiar with the nrf24l01 module. I have attached the code below. Please look over it and tell me if what I did wrong. I greatly appreciate any help you could provide, thank you.


hi can you help me i cant get it to work only one of my servo`s will twitch when i touch the CE and CSN wire can you help me i am just a beginner

Your code won't really work at all. Here is the best example I can find.

If you read the examples, and look at the STRUCT mydata, you should be able to readily modify it for more than two channels.


I am definitely very grateful for all that you helped me with. For some reason I still do not understand what I need to do. So on this website: https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-ExampleSketches#js1 , I am still confused as to what example would best suit my purpose. I didn't want to bug you too much and I didn't seem to be making any ground with my deadline closing in on me soon, so I thought I should maybe just make another question. I did not mean to upset you in any way. If you could maybe clarify a little or maybe show me a little of the code so I can use an example to model mine off of I would be really thankful (here is the code without any sort of wireless communication).

Thank you for the link. Based on the code provided in that example, would that mean I would need to use a different channel for every potentiometer or can I send like an array of potentiometer values? Which would be easier? I know that the following code I attached below works, but it is for only 1 potentiometer and 1 servo. Again one file is for the receiver and one for the transmitter. Thank you very much once again.

Like I said, just modify the STRUCT and see if you can squeeze XO,X1,X2,X3,X4,X5 in it, where Xn is the servo value. My link's code is much more elegant than the single channel code.

Whose library did you use ? Can you make the one channel example work ?

I used the library that was provided on the instructable from the link above. I was able to make it work with 1 servo and 1 potentiometer. Pretty much I just added to what was in the while loop and hoped it worked. I don't really understand how to do multiple servos and potentiometers. I hope you will be able to help me and I thank you for your help.