Это видео недоступно.
Сожалеем об этом.
NRF24L01 + SERVO + ARDUINO Wireless 2.4GHz Communication.
HTML-код
- Опубликовано: 31 мар 2020
- nRF24l01 is a radio transmitter which can transmit and receive data on the frequency range of 2.4GHz. Thus, this project will show you how to transmit variables to control a servo motor.
The Servo Circuit is as the Receiver Circuit while The potentiometer circuit is the transmitter while
The Circuit is a simple and straight forward one.....
Feel free to ask any questions in the comment section below and I'll do well to answer all for you. Cheers.
+++++++++++++++++++++++++++++++++++++
Hardwares Used:
Arduino Uno/ Arduino Nano x2
nRF24L01 Transceiver Module x2
Rotary Potentiometer
Micro Servo Motor
Jumper Wires.
=======================================
Circuit Diagram and Source Codes:
drive.google.c...
Can the servo be more than 1 and controlled with each lever
Hello. I use Servo and Potentiometer with Arduino UNO and NodeMCU ESP8266. It doesn't work.
The servo only moves after a few second when the code just finished uploading (Arduino side with Servo) or when it restarts. After that, the servo doesn't response to potentiometer on transmitter (NodeMCU)
//****** ESP8266 ***************** //******************* Uno ***************
// Potentiometer & LED // Pushbutton & Servo
/* /*
NRF24L01 - NodeMCU ESP8266 NRF24L01 - Arduino UNO
Vcc(3.3v) - VCC VCC(3.3v) - VCC
GND - GND GND - GND
CE - D4 CE - 8
CSN - D2 CSN - 10
SCK - D5 SCK - 13
MOSI - D7 MOSI - 11
MISO - D6 MISO - 12
*/ /*
#include #include
#include #include
#include #include
#include
#define CE D4 #define CE 8
#define CSN D2 #define CSN 10
#define LED D1
#define pot A0
boolean buttonState = 0; #define pushbutton 4
int angleVal = 0; #define servopin 6
boolean buttonState = 0;
Servo srv;
RF24 radio(CE, CSN); RF24 radio(CE, CSN);
const byte address[][6] = {"00001", "00002"}; const byte address[][6] = {"00001", "00002"};
void setup() void setup()
{ (
pinMode(pot, INPUT); Serial.begin(9600);
pinMode(LED, OUTPUT); pinMode(pushbutton, INPUT);
digitalWrite(LED, LOW); srv.attach(servopin);
radio.begin(); radio.begin();
radio.openWritingPipe(address[1]); //radio.openWritingPipe(address[0]);
//radio.openReadingPipe(1, address[0]); radio.openReadingPipe(1,address[1]);
radio.setPALevel(RF24_PA_MIN); radio.setPALevel(RF24_PA_MIN);
radio.setDataRate(RF24_250KBPS); radio.setDataRate(RF24_250KBPS);
} )
void loop() void loop()
{ {
/* /*
//***********Receiving*************************** //***********Sending******************
delay(50); delay(50);
radio.startListening(); radio.stopListening();
if(radio.available()) buttonState = digitalRead(pushbutton);
{ radio.write(&buttonState,
sizeof(buttonState));
radio.read(&buttonState, sizeof(buttonState)); */
if(buttonState == HIGH)
{
digitalWrite(LED, HIGH);
}
else
{
digitalWrite(LED, LOW);
}
}
*/
//***********Sending******************* //***********Receiving*******************
delay(50); delay(50);
radio.stopListening(); radio.starListening();
int potVal = analogRead(pot); if(radio.available())
angleVal = map(potVal, 0, 1024, 0, 180); {
radio.write(&angleVal, sizeof(angleVal)); while(radio.available())
{
int angleVal = 0;
} radio.read(&angleVal, sizeof(angleVal));
srv.write(angleVal);
Serial.println(angleVal);
}
}
}
Sir.., can we using arduino nano for tx and rx..? Thxs.
Yes you can.