March Madness - Show Pins |
Have you ever wanted to know what the pins on your Arduino are doing?
Are you to lazy to find and read the manual on your new arduino shield you just got?
Do you want to know what each button does what anyway?
Well now you can with "ShowPins". A really simple program that just spits out the status of all of the pins making it very easy to figure out what is what WITHOUT reading the manual. (I know, one of my favorite phrases is RTFM (Read the F'ing Manual)).
Pin # 2 0 Pin # 3 0 Pin # 4 0 Pin # 5 0 Pin # 6 0 Pin # 7 1 Pin # 8 1 Pin # 9 0 Pin # 10 0 Pin # 11 0 Pin # 12 0 Pin # 13 0 Analog Pin # 0 1022 Analog Pin # 1 501 Analog Pin # 2 0 Analog Pin # 3 998 Analog Pin # 4 99 Analog Pin # 5 12 |
|
//******************************************************************* //* Show Pins //* This prints out the serial port the status of all of the pins //* on the Aruino //* //* it sets all of the digital pins to input //* except for 0 and 1 which are the serial port //******************************************************************* #include "WProgram.h" #include "HardwareSerial.h" //******************************************************************* void setup() { short ii; Serial.begin(9600); Serial.println("Show Pins"); for (ii=2; ii<14; ii++) { pinMode(ii, INPUT); } } //******************************************************************* void PrintPins() { short ii; int pinValue; for (ii=2; ii<14; ii++) { pinValue = digitalRead(ii); Serial.print("Pin # "); Serial.print(ii); Serial.print(" "); Serial.print(pinValue); Serial.println(); } Serial.println(); for (ii=0; ii<6; ii++) { pinValue = analogRead(ii); Serial.print("Analog Pin # "); Serial.print(ii); Serial.print(" "); Serial.print(pinValue); Serial.println(); } Serial.println(); } //******************************************************************* void loop() { PrintPins(); delay(2000); } |