need help with this code

Delta_G: That's his problem. He's got demo code from one website that uses one library and a library from somewhere else. And the site where he got the demo code doesn't have a link to the library it uses.

Yep. No wonder there are problems. ;)

What I'd like to do is use the RF24 library I got from Github and write appropriate code for it to control a servo via a potentiometer. The sticking point is, of course, that I know diddley about writing code. Ideally there would be an example code for this somewhere I could copy paste, but I have been looking for this elusive example for months and finally found something, albeit from some Turkish guys website.

Oy vey.

Any ideas? To help a noob?

Guitartexan: What I'd like to do is use the RF24 library I got from Github and write appropriate code for it to control a servo via a potentiometer. The sticking point is, of course, that I know diddley about writing code. Ideally there would be an example code for this somewhere I could copy paste, but I have been looking for this elusive example for months and finally found something, albeit from some Turkish guys website. Oy vey. Any ideas? To help a noob?

There are examples provided with the library. One is called "GettingStarted". Sounds like it might be a good place to 'Get Started'. :D Here's a list of the examples. You could work through them, while referring to the documentation. (At least there's very good documentation, from what I've seen.)

GettingStarted GettingStarted_CallResponse GettingStarted_HandlingData Transfer TransferTimeouts pingpair_ack pingpair_dyn pingpair_irq pingpair_irq_simple pingpair_multi_dyn pingpair_sleepy scanner starping

I think this is the library you need: https://github.com/EscuderoKevin/NRF24L01

oqibidipo: I think this is the library you need: https://github.com/EscuderoKevin/NRF24L01

Looks like it, but minimal examples, poor (non-existant) documentation, a foreign language. If I were Guitartexan, I'd stick with the "RF24" library and learn how to use it.

Lo and behold, I found a video on YouTube of a guy in Russia named Dimitry, that shows him doing the very thing I’m wanting to do. He has a link there to his sketch in Russian. With a little help from Google translate and slight tweaking of the code, I got it to compile for me! Woo Hoo! I’m on my way! I’ll let you know how I progress. Thanks for excellent motivation. Truly you have to try everything you can and keep learning as you go.

Guitartexan: Lo and behold, I found a video on YouTube of a guy in Russia named Dimitry, that shows him doing the very thing I'm wanting to do. He has a link there to his sketch in Russian. With a little help from Google translate and slight tweaking of the code, I got it to compile for me! Woo Hoo! I'm on my way! I'll let you know how I progress. Thanks for excellent motivation. Truly you have to try everything you can and keep learning as you go.

Good one. Keep us posted on your progress. And out of interest, which library does his code use?

It worked with the RF24 library from Github.

Guitartexan: It worked with the RF24 library from Github.

Thanks. And that's good, since it's the better documented of the two libraries. Much more flexible if you need to add functionality.

UPDATE

I fiddled around with this for a couple of hours today and I have it working like a charm! just so you know, the goal here was to wirelessly operate servo controlled mini blinds in my house. The servo, Arduino Nano, RF24 and adapter board, along with the power supply fit beautifully into the headrail of my blinds. The pot goes into a wall switch with its Nano, RF24 and adapter. Im using a push/pull pot to operate different blinds independently. I will eventually control the blinds with my isy-994iZwave controller. This will allow automatic control of the blinds by lumens, temperature, or schedule, so if its bright and hot out-the blinds close automatically or if I want to achieve a certain luminosity in my house, I can modulate the blinds automatically via a luminosity sensor. The thing that stopped my progress was this code, but I have it now!

thanks again for the motivation.

Guitartexan: UPDATE

I fiddled around with this for a couple of hours today and I have it working like a charm! just so you know, the goal here was to wirelessly operate servo controlled mini blinds in my house. The servo, Arduino Nano, RF24 and adapter board, along with the power supply fit beautifully into the headrail of my blinds. The pot goes into a wall switch with its Nano, RF24 and adapter. Im using a push/pull pot to operate different blinds independently. I will eventually control the blinds with my isy-994iZwave controller. This will allow automatic control of the blinds by lumens, temperature, or schedule, so if its bright and hot out-the blinds close automatically or if I want to achieve a certain luminosity in my house, I can modulate the blinds automatically via a luminosity sensor. The thing that stopped my progress was this code, but I have it now!

thanks again for the motivation.

This sounds super cool. I don't suppose you have this written up anywhere with some pictures? I'd love to see how you did this.

Thanks for letting us know about the success.

Hey there DuaneDegn.

I thought that might be a good idea, so I’m going to do some pics or maybe a video. Right now I have it working on my bench. I plan on doing a permanent install this week and will put it all together and post up here.

Right now I need someone with good knowledge to look at my code help me understand why it will work with UNO but is not working with NANO. Any help is much appreciated!!

#include <SPI.h>

#include “RF24.h” // library RF24.

//Контакты от радио модуля NRF24L01 подключаем к pins → Arduino

//SCK → 13//MISO → 12//MOSI → 11//CSN → 10//CE → 9

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

RF24 radio(9,10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

int msg[1];

int potpin_1 = A0; // potentiometer pin №1

int val_1; // potentiometer №1

int potpin_2 = A1; // potentiometer №2

int val_2; //potentiometer №2

void setup(void){

radio.begin();

radio.openWritingPipe(pipe);

void loop()

}

Arduino: 1.6.6 (Windows 7), Board: “Arduino Nano, ATmega328”

C:\Users\Tia\AppData\Local\Temp\arduino_3c28bd111bb205ba81b8075835e3d918\sketch_nov15a.ino: In function ‘void setup()’:

sketch_nov15a:34: error: expected initializer before ‘}’ token

}

below is the error message.

^

exit status 1
expected initializer before ‘}’ token

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.

Right now I need someone with good knowledge to look at my code help me understand why it will work with UNO but is not working with NANO

That code won't compile for ANY Arduino, so it is patently ridiculous to claim that it works for one model but not another.

Sorry about that. I pasted the one I’ve been tweaking to see if I could discover what the NANO doesn’t like. The code does work for the UNO. I know because its working on my work bench.

AHA!
below is the tweaked code that I was able to get to compile on the NANO.
I am testing now and will keep you posted.

#include <SPI.h>

#include “RF24.h” // Подключаем скачанную библиотеку RF24.

//Контакты от радио модуля NRF24L01 подключаем к pins → Arduino

//SCK → 13//MISO → 12//MOSI → 11//CSN → 10//CE → 9

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10

RF24 radio(9,10);

const uint64_t pipe = 0xE8E8F0F0E1LL; // адрес канала передачи

int msg[1]; //переменная для отправки радио сигнала

int potpin_1 = A0; // potentiometer Переменный резистор №1

int val_1; //переменная для potentiometer Переменный резистор №1
int potpin_2 = A1; // potentiometer Переменный резистор №2

int val_2; //переменная для potentiometer Переменный резистор №2

void setup(void){

radio.begin();

radio.openWritingPipe(pipe); // Открываем канал передачи

}

void loop() {

}

Well, I'm back again and need some more assistance with my project. I have wracked my brain trying to figure out why this wont work on my Nano. The code compiles, it uploads, the servo jumps slightly when power is applied. It all looks as though everything is right and just waiting for that signal. I'm using a B250K pot and 2 Nanos over 2 nrf24l01s using adapter boards that have voltage regulators on board. I have soldered a 10Uf cap across the power and ground.The LEDs light up like they should as well. When I twist the pot, nothing happens. Wrong size, type pot maybe? I'm using pins 9-13 5v input, A0 for the pot, D3 for the servo, shared all the grounds, not using a separate power supply.

Any ideas for me to try?

Thanks!

Guitartexan: B250K pot . . . Any ideas for me to try?

Can the Arduino ADC read the value from such a high impedance source?

Do you have a 5K or 10K pot you can try?