virtual wire probleme

hi guys

i need same help please. im new in the arduino world . i have a boat project .i already have write the code but i want to use vertual wire via an RF 433 mhrz. i know its easy for someone but not for me . i hope that someone can help me.

i use
for transmitter:

1 arduino uno
1 joystick
1 puch boton

for receiver:

1 arduino uno
1 DC motor 12v with H bridge l298n
2 servo motor

here is my code

#include <Servo.h>
Servo xservo;
#include <Servo.h>
Servo servoOne;
#define enA 9
#define in1 10
#define in2 11

int motorSpeedA = 0;
int xPin = A1;
int xval = 0;
const int buttonPin = 8;
const int servoPin = 2;
int buttonState = 0;
int directionState = 0;

int pos = 0;
void setup(){
{
servoOne.attach(2);
servoOne.write(directionState);
pinMode(buttonPin, INPUT);
}
{
xservo.attach(6);

Serial.begin(9600); // also set up Serial port for debugging
}
{
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);

}
}
void loop() {
{
buttonState = digitalRead(buttonPin);
if (directionState == 0) {
if (buttonState == HIGH) {
directionState = 1;
for (pos = 0; pos < 180; pos = pos + 1) {
servoOne.write(pos);
delay(5);
}
}
} else if (directionState == 1) {
if (buttonState == HIGH) {
directionState = 0;
for (pos = 180; pos > 1; pos = pos - 1) {
servoOne.write(pos);
delay(5);
}
}
}
}
int yAxis = analogRead(A0); // Read Joysticks Y-axis

// Y-axis used for forward and backward control
if (yAxis < 470) {
// Set Motor A backward
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
// Convert the declining Y-axis readings for going backward from 470 to 0 into 0 to 255 value for the PWM signal for increasing the motor speed
motorSpeedA = map(yAxis, 470, 0, 0, 255);

}
else if (yAxis > 550) {
// Set Motor A forward
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
// Convert the increasing Y-axis readings for going forward from 550 to 1023 into 0 to 255 value for the PWM signal for increasing the motor speed
motorSpeedA = map(yAxis, 550, 1023, 0, 255);

}
// If joystick stays in middle the motors are not moving
else {
motorSpeedA = 0;

}

// Prevent buzzing at low speeds (Adjust according to your motors. My motors couldn't start moving if PWM value was below value of 70)
if (motorSpeedA < 70) {
motorSpeedA = 0;
}

analogWrite(enA, motorSpeedA); // Send PWM signal to motor A
{

// SERVO CONTROL WITH JOYSTICK
xval = analogRead(xPin);
xval = map(xval, 0, 1023, 0, 179); // map Joystick to Servo values
xservo.write(xval); // Turn servo to specified angle on Joystick X axis

/*SEL BUTTON
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
*/

delay(10); // debounce values a wee bit
}
}

thanks for ur help

Vertual wire ou radio head . J ai besoin d la distance . Merci la famille

  • C’est le forum en français ici
  • Lire les post épinglés en haut du forum pour voir comment poster correctement du code avec les balises (merci de corriger votre post)
  • lisez un cours de programmation - c’est quoi toutes ces accolades inutiles?
  • votre code ne mentionne pas VirtualWire du tout
  • définissez ce que votre code doit faire
  • postez les 2 codes émetteur et récepteur (avec les balises) en ayant étudié un peu les exemples