hey folks,
I am new to Arduino, I programmes some C# and VBA before but never in connection with hardware.
I am so far to let LEDs blinks, move a servo and show some stuff on a display
how can I connect a RC-receiver to the Arduino Uno and read the servosignal to send it to a servo ?
the servo gets the angle it should move
to controll the servo I use following code:
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
thanks a lot, this really helped me
here the Code I used
//parts marked with "RC" are for the receiver part
//parts marked with "LCD" are for the LCD part
//parts marked with "Servo" are for the Servo part
int pin = 7; //RC
unsigned long duration; // RC
#include <Wire.h> //LCD
#include <LiquidCrystal_I2C.h> //LCD
LiquidCrystal_I2C lcd(0x3F,20,4); //LCD
#include <Servo.h> //Servo
Servo myservo; //Servo
int pos = 0; //Servo
void setup()
{
pinMode(pin, INPUT);//RC
lcd.init(); //LCD
lcd.init(); //LCD
lcd.backlight(); //LCD
myservo.attach(9);//Servo
}
void loop()
{
duration = pulseIn(pin, HIGH); //RC
lcd.setCursor(3,0);//LCD
lcd.print("Pulslength");//LCD
lcd.setCursor(2,1);//LCD
lcd.print(" ");//LCD
lcd.setCursor(2,1);//LCD
lcd.print(duration);//LCD
myservo.writeMicroseconds(duration);//Servo
}