Hello everyone!
I need some help.
I had tried to control two brushless motor by two potentiometer, and had succeeded.
Now, I want to sent the signal of potentiometer by nRF24L01.
The wiring schemes and codes like the photos.
The problem is that when I turn on the "potentiometer 1", the "motor 1" doesn't move.
When I turn on the "potentiometer 2", the "motor 2" doesn't move too.
when I turn on the "potentiometer 1" and "potentiometer 2" simultaneously, the "motor 1" doesn't move, but the "motor 2" is move.
I want to control the motors one on one.
How can I fix it?
Transmitter
Receiver
I need some help.
I had tried to control two brushless motor by two potentiometer, and had succeeded.
Now, I want to sent the signal of potentiometer by nRF24L01.
The wiring schemes and codes like the photos.
The problem is that when I turn on the "potentiometer 1", the "motor 1" doesn't move.
When I turn on the "potentiometer 2", the "motor 2" doesn't move too.
when I turn on the "potentiometer 1" and "potentiometer 2" simultaneously, the "motor 1" doesn't move, but the "motor 2" is move.
I want to control the motors one on one.
How can I fix it?
Transmitter
Code:
#include <SPI.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte addresses[] = "1Node";
void setup() {
radio.begin();
radio.setChannel(83);
radio.openWritingPipe(addresses);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
delay(5);
int potValue1 = analogRead(A1);
int angleValue1 = map(potValue1, 0, 1023, 90, 180);
radio.write(&angleValue1, sizeof(angleValue1));
int potValue2 = analogRead(A2);
int angleValue2 = map(potValue2, 0, 1023, 90, 180);
radio.write(&angleValue2, sizeof(angleValue2));
}
Receiver
Code:
#include <SPI.h>
#include <RF24.h>
#include <Servo.h>
RF24 radio(7, 8); // CE, CSN
const byte addresses[] = "1Node";
const byte pipe = 1;
Servo myServo1;
Servo myServo2;
void setup() {
myServo1.attach(10);
myServo2.attach(11);
radio.begin();
radio.setChannel(83);
radio.setPALevel(RF24_PA_MIN);
radio.openReadingPipe(pipe, addresses);
radio.startListening();
}
void loop() {
if (radio.available()) {
int angleValue1 = 0;
radio.read(&angleValue1, sizeof(angleValue1));
myServo1.write(angleValue1);
int angleValue2 = 0;
radio.read(&angleValue2, sizeof(angleValue2));
myServo2.write(angleValue2);
}
}
Last edited: