loading

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

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:
https://www.instructables.com/id/Arduino-NRF24L01-USING-RF-Module/
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.

sort by: active | newest | oldest

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.

https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-ExampleSketches#js1

Science102 (author)  steveastrouk1 year ago

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).

Science102 (author)  steveastrouk1 year ago

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 ?

Science102 (author)  steveastrouk1 year ago

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.

Science102 (author) 1 year ago

This is the code I used for the transmitter arduino and reciever arduino.