Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This code allows the receiving of inputs from the Spektrum AR600
- //Radio Receiver. It is written to test the onboard inputs on the
- //Rainbowduino (which do not function properly when Rb.init() is
- //called, due to the inputs being used for driving the display).
- //The code is easily adaptable for Arduino and any other
- //microcontroller you want to add remote capabilities to. The AR600
- //provides input values ranging from approximately 1000 to 2000.
- int rx1 = 0; //throttle control
- int rx2 = 0; //aileron control
- int rx3 = 0; //elevation control
- int rx4 = 0; //rudder control
- int rx5 = 0; //AUX switch
- int rx6 = 0; //Trainer momentary switch
- #include <Arduino.h>
- unsigned long time1 = 0;
- unsigned long time2 = 0;
- void setup() {
- Rb.init(); // initialize
- Serial.begin(115200); // open the serial port at 115200 bps:
- }
- void loop() {
- rx1=pulseIn(A0,HIGH);
- rx2=pulseIn(A1,HIGH);
- rx3=pulseIn(A2,HIGH);
- rx4=pulseIn(A3,HIGH);
- rx5=pulseIn(2,HIGH);
- rx6=pulseIn(3,HIGH);
- Serial.print(rx1);
- Serial.print("\t");
- Serial.print(rx2);
- Serial.print("\t");
- Serial.print(rx3);
- Serial.print("\t");
- Serial.print(rx4);
- Serial.print("\t");
- Serial.print(rx5);
- Serial.print("\t");
- Serial.print(rx6);
- Serial.print("\t");
- Serial.println("\t");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement