git-svn-id: https://arducopter.googlecode.com/svn/trunk@1370 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
jasonshort 2010-12-30 06:43:35 +00:00
parent 9f11c97463
commit b9f3fb7d64
1 changed files with 30 additions and 30 deletions

View File

@ -1,31 +1,31 @@
/* /*
Example of APM_RC library. Example of APM_RC library.
Code by Jordi Muñoz and Jose Julio. DIYDrones.com Code by Jordi MuÒoz and Jose Julio. DIYDrones.com
Print Input values and send Output to the servos Print Input values and send Output to the servos
(Works with last PPM_encoder firmware) (Works with last PPM_encoder firmware)
*/ */
#include <APM_RC.h> // ArduPilot Mega RC Library #include <APM_RC.h> // ArduPilot Mega RC Library
void setup() void setup()
{ {
APM_RC.Init(); // APM Radio initialization APM_RC.Init(); // APM Radio initialization
Serial.begin(57600); Serial.begin(57600);
Serial.println("ArduPilot Mega RC library test"); Serial.println("ArduPilot Mega RC library test");
delay(1000); delay(1000);
} }
void loop() void loop()
{ {
if (APM_RC.GetState()==1) // New radio frame? (we could use also if((millis()- timer) > 20) // New radio frame? (we could use also if((millis()- timer) > 20)
{ if (APM_RC.GetState() == 1){
Serial.print("CH:"); Serial.print("CH:");
for(int i=0;i<8;i++) for(int i = 0; i < 8; i++){
{ Serial.print(APM_RC.InputCh(i)); // Print channel values
Serial.print(APM_RC.InputCh(i)); // Print channel values Serial.print(",");
Serial.print(","); APM_RC.OutputCh(i, APM_RC.InputCh(i)); // Copy input to Servos
APM_RC.OutputCh(i,APM_RC.InputCh(i)); // Copy input to Servos }
} Serial.println();
Serial.println(); }
}
} }