Sending through a signal

Hey everyone,

I have a question. Basically, I want to send an analog signal without any edits towards another pint. For our project, we have a drone which can (by the use of a button) change from manual control to automatic control. As soon as the manual control is activated, a radio control system is activated. The received signal differs from 0.7V to 0.9V.

I thought by using analogRead and analogWrite, the singal would be send through but unfortunately, it doens't work. I tried a lot but i cannot figure out what to do.

I'll put a text with our present code and where i want the read and send trhough to be placed!

Kind regards, Nobby.

//The study i am doing is dutch so sorry for the strange names but i have to explain my teacher

int knop=12;
int knopnieuw;
int knopoud=1;
int veranderd;

int plusstroomIN = A0;
int stroomwaardeIN = 0;

///////////////////////////////////////////////////////////////////////////////////////////////////////////

void setup() {
delay(300);
Serial.begin(9600);

pinMode(plusstroomIN, INPUT);
}

void loop() {

if(veranderd == 0){
//Here, i want the signal for the manual control. It has to read a value between 0.7V and 0.9V. After reading, it has to send the siglas as output whereby it has to maintain the values
}

if (veranderd == 1){
// here comes the automatic signal (for now, just ingore :slight_smile:
}

knopnieuw=digitalRead(knop);

if (knopnieuw==1 && knopoud==0){
if (veranderd==1){
veranderd =0;
Serial.println("manual");
delay(100);
}
else {
veranderd=1;
Serial.println("automatisch");
delay(100); } }

knopoud=knopnieuw;
delay(100);
}

Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation of your ask).

An RC receiver usually produces pulses, not voltages. The pulses typically range from 1000 microseconds to 2000 microseconds and repeat about every 20 milliseconds (50 times per second). This is these same type of signal generated by the Servo library.

A quick and dirty way to read a channel from an RC receiver is to use:
unsigned long value = pulseIn(pin, HIGH, 30000);
this will return the length of the pulse in microseconds. You can use myServo.writeMicroseconds(value);
to copy the control signal to a servo.

Note: The '30000' is the timeout time in microseconds. If no pulse is seen in 30 milliseconds, pulseIn() will return 0. The default timeout is 1,000,000 microseconds (1 second).

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.