I have a Flip1.5 which runs Multiwii 2.1 just fine on my tricopter. But I'm trying to write something slightly different that will work on a V-tail aeroplane and borrow some from Ardupilot. The first I tried to do was extract just the radio and servo functions and build from there. What happens is I can write a little sketch that will read the PPM radio and will even print over serial what the different channels are reading. As soon as I add the servo stuff, I get an error that the radio functions are "not declared in this scope". If I write a little sketch that only initializes the servos, it will work until I add the radio and then I get the "not declared in this scope."
Why are the radio and servo/motor functions not compatible at the same time? How do I resolve this so I can read the radio and then control servos?
Thanks
Edit: Oops, I see this is 32 bit software. Sorry, still hoping someone can give me a clue to solve problem.
Not declared in this scope
Re: Not declared in this scope
For the sake of discussion, hopefully, I'm posting the main sketch.
Code: Select all
#include <avr/io.h>
#include "def.h"
#include <avr/pgmspace.h>
enum rc {
ROLL,
PITCH,
YAW,
THROTTLE,
AUX1,
AUX2,
AUX3,
AUX4
};
static int16_t rcData[RC_CHANS]; // interval [1000;2000]
static int16_t rcCommand[4]; // interval [1000;2000] for THROTTLE and [-500;+500] for ROLL/PITCH/YAW
static int16_t motor[NUMBER_MOTOR];
static int16_t servo[8] = {1500,1500,1500,1500,1500,1500,1500,1500};
void setup() {
initOutput();
configureReceiver();
initializeServo();
servo[0] = 1600;
servo[1] = 1700;
writeServos();
}
void loop () {
computeRC();
servo[0] = 1500;
servo[1] = 1500;
writeServos();
}
Re: Not declared in this scope
Maybe the topic can be moved to general discussion?