Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This can be used to test for cooked pins on an Arduino
- Change OUTPUT states then Change to INPUT and Write HIGH (pull-ups on) and then LOW (pull-ups off)
- Start with pin 2 and work up to pin 12 one at a time. We'll assume the other pins are fine.
- Verify the voltage on each pin with a DVM.
- */
- int testPin=2; // Start with pin 2 and increment for each pin after running the four tests below.
- int testNumber=0; // Start at 0 and increment to 3 on each pin set above.
- void setup() {
- // initialize digital pin LED_BUILTIN as an output.
- pinMode(LED_BUILTIN, OUTPUT);
- switch(testNumber){
- case 0:
- pinMode(testPin,OUTPUT);
- digitalWrite(testPin,LOW);
- break;
- case 1:
- pinMode(testPin,OUTPUT);
- digitalWrite(testPin,HIGH);
- break;
- case 2:
- pinMode(testPin,INPUT);
- digitalWrite(testPin,HIGH);
- break;
- case 3:
- pinMode(testPin,INPUT);
- digitalWrite(testPin,LOW);
- break;
- default:
- pinMode(testPin,INPUT);
- digitalWrite(testPin,LOW);
- break;
- }
- }
- // the loop function runs over and over again forever
- void loop() {
- digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(1000); // wait for a second
- digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
- delay(1000); // wait for a second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement