Hey guys, I am a beginner in electronics. I need some help. I'm trying to control my brushless motor with my joystick but it's not spinning. All I hear is the beeping from the brushless motor. Like it continuously beeps until I move the joystick, then it rapidly beeps fast, then returns to it's normal paced continuous beeps. So I guess there is some connection, but I don't know why it's not spinning. It may be my code. Down below are my code and the Wiring diagram I'm using.

Code:
Transmitter Code:
#include <SPI.h>
#include <RF24.h>
RF24 radio(8, 7); // CE, CSN
const byte addresses[] = {"1Node"};
struct dataStruct {
int motorSpeed;
} myData;
void setup() {
radio.begin();
radio.openWritingPipe(addresses[0]);
radio.stopListening();
}
void loop() {
int joystickvalue = analogRead(A0);
myData.motorSpeed = map(joystickvalue, 550, 1023, 0, 180);
radio.write( &myData, sizeof(myData));
}
Receiver Code:
#include <SPI.h>
#include <RF24.h>
#include <Servo.h>
RF24 radio(8, 7); // CE, CSN
const byte addresses[] = "1Node";
const byte pipe = 1;
Servo myServo_1;
struct dataStruct {
int motorSpeed;
} myData;
void setup() {
myServo_1.attach(9);
radio.begin();
radio.openReadingPipe(pipe, addresses[0]);
radio.startListening();
}
void loop() {
if (radio.available()) {
while (radio.available()) {
radio.read( &myData, sizeof(myData) );
myServo_1.write(myData.motorSpeed);
}
}
}

Last edited by a moderator: