pinMode(2,INPUT); // PD2 - INT0 - Rudder in - INPUT Rudder/Aileron pinMode(3,INPUT); // PD3 - INT1 - Elevator in - INPUT Elevator
pinMode(4,INPUT); // PD4 - XCK/T0 - MUX pin - Connected to Pin 2 on ATtiny
pinMode(5,INPUT); // PD5 - T0 - Mode pin - Connected to Pin 6 on ATtiny - Select on MUX
pinMode(6,INPUT); // PD6 - T1 - Ground start signaling Pin
pinMode(7,OUTPUT); // PD7 - AIN0 - GPS Mux pin
// PORTB
pinMode(8,OUTPUT); // PB0 - AIN1 - Servo throttle - OUTPUT THROTTLE
pinMode(9,OUTPUT); // PB1 - OC1A - Elevator PWM out - Elevator PWM out
pinMode(10,OUTPUT); // PB2 - OC1B - Rudder PWM out - Rudder PWM out
pinMode(11,OUTPUT); // PB3 - MOSI/OC2 - GPS status -
pinMode(12,OUTPUT); // PB4 - MISO - Blue LED pin - GPS Lock - GPS Lock
pinMode(13,INPUT); // PB5 - SCK - Yellow LED pin - INPUT Throttle
However, the digital input pins on Ardupilot are listed as D6,D7, D8, D11, D12, D13.
So I need to ask again. What ports arefree and how do I reference them?
Thanks in advance...
Nick
Replies
"D6" is the pin referenced in the line "pinMode(6, INPUT)"
"D7" is the pin referenced in the line "pinMode(7, OUTPUT)"
All of the pins can be configured to either input or output and will have different behaviour accordingly. Most of the pins on the ArduPilot are already allocated to something so you have to lose some functionality if you want hijack pins for your own purposes.
Tom
http://arduino.cc/en/Hacking/PinMapping168
That's where the names come from. The names like "OC1A" are important as it's referenced in the Atmel docs.
Pin 13 is free if you read in throttle
pin 12 is just an LED output for GPS lock.
pin 8 is free if you don't output throttle
pin 6 is free with the latest code
pin 7 is free if you don't use a shield
Analog pins 1-5 are free if you don't connect sensors. (for IMU folksusing 2.6)