Go Down

Topic: Output Pins. (Read 3237 times) previous topic - next topic


Hello, I'm a beginner to the arduino and the coding. I want to build this robot posted here at http://arduino.cc/forum/index.php/topic,90809.0.html but I want to know how to set the outputs he listed to the output pins for my motor shield. The motor shield I will be receiving is http://dx.com/p/arduino-compatible-2-channel-relay-shield-module-138600?item=1 . Can anyone please help me. I'm a total noob when it comes to this. Please reply!


Have you worked through any of the examples provided with the IDE?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


Not really, I just started working on some projects that seemed simple to me. I just want to know how the output pins are set in the sketch provided. I understand everything else to it.


It's just this part.
Code: [Select]
      int i;
    for(i=5;i<=8;i++)     //For Arduino Motor Shield
    pinMode(i, OUTPUT);    //set pin 4,5,6,7 to output mode

How do I change the output pins to something else like 13, 12, 11, 3.


The for() loop is an easy way to set the pins from 5,6,7 (not sure why the comment is wrong) to OUTPUT.

Hint, it would be the same as doing:
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


Ahh, so I just remove what I've listed above and use the separate regular pinMode thing? Makes a lot of sense now. Thank you very much!

Go Up