2010-12-30 02:43:35 -04:00
|
|
|
/*
|
|
|
|
Example of APM_RC library.
|
|
|
|
Code by Jordi MuÒoz and Jose Julio. DIYDrones.com
|
|
|
|
|
|
|
|
Print Input values and send Output to the servos
|
|
|
|
(Works with last PPM_encoder firmware)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <APM_RC.h> // ArduPilot Mega RC Library
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
APM_RC.Init(); // APM Radio initialization
|
2011-04-16 01:50:38 -03:00
|
|
|
|
|
|
|
Serial.begin(38400);
|
2010-12-30 02:43:35 -04:00
|
|
|
Serial.println("ArduPilot Mega RC library test");
|
|
|
|
delay(1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
// New radio frame? (we could use also if((millis()- timer) > 20)
|
|
|
|
if (APM_RC.GetState() == 1){
|
|
|
|
Serial.print("CH:");
|
|
|
|
for(int i = 0; i < 8; i++){
|
|
|
|
Serial.print(APM_RC.InputCh(i)); // Print channel values
|
|
|
|
Serial.print(",");
|
|
|
|
APM_RC.OutputCh(i, APM_RC.InputCh(i)); // Copy input to Servos
|
|
|
|
}
|
|
|
|
Serial.println();
|
|
|
|
}
|
2010-11-27 01:01:44 -04:00
|
|
|
}
|