I’m trying to use more than one pin on my LilyPad Arduino. I can only get signals out of pin#2. I tried pinMode(x, OUTPUT) with all x=pin# but it keeps sending signals to pin#2 regardless of my void setup. Here's the code that's supposed to work on pin# 3 and 9 but it only goes through pin#2.
</>
void setup()
{
pinMode(3, OUTPUT);
pinMode(9, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH);
digitalWrite(9, LOW);
delay(2000);
digitalWrite(5, HIGH);
digitalWrite(9, LOW);
delay(2000);
}
Please post an example sketch and schematic that exhibits this problem
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
Hello,
Welcome to the Arduino Forum.
This guide explains how to get the best out of this forum. Please read and follow the instructions below.
Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frustrating for you and frustrating for us.
The people who try to help with your pro…
1 Like
It seems I fixed it by selecting Programmer to Arduino as ISP.
aghasaleh1:
void loop() {
digitalWrite(3, HIGH);
digitalWrite(9, LOW);
delay(2000);
digitalWrite(5, HIGH);
digitalWrite(9, LOW);
delay(2000);
}
You are repeatedly setting Pins 3 and 5 HIGH and 9 LOW so nothing is going to blink. Did you mean to write:
void loop()
{
digitalWrite(3, HIGH);
digitalWrite(9, LOW);
delay(2000);
digitalWrite(3, LOW);
digitalWrite(9, HIGH);
delay(2000);
}
system
Closed
June 14, 2022, 6:49pm
5
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.