Well I found the optimal mapping values but the servo is still shaking. Here is the code :
Transmitter :
#include <SoftwareSerial.h>
int ROT ;
SoftwareSerial HC12(10, 11);
void setup() {
Serial.begin(9600);
HC12.begin(9600);
}
void loop() {
int ROT = analogRead(A0);
ROT = map(ROT , 515 , 1023 , 1585 , 1800) ;
Serial.println(ROT);
HC12.write(ROT);
delay(100);
}
Reciever :
#include <Servo.h>
#include <SoftwareSerial.h>
int ROT ;
Servo myServo;
SoftwareSerial HC12(10,11);
void setup() {
myServo.attach(6);
HC12.begin(9600);
Serial.begin(9600);
}
void loop() {
while ( HC12.available()>0) {
ROT = HC12.read();
Serial.println(ROT);
myServo.write(ROT);
delay(100);
}
}
Any ideas?