2
« on: August 14, 2013, 12:21:25 AM »
I am trying to figure out the pins on my TinyLily. I am new to electronics and this is my first Arduino, and I do not understand the PDF on the website.
I tried this sketch code below. I have an LED whose short leg (-) is grounded to negative pin on the TinyLily. I can move the longer (+) leg to any other pin on the TinyLily.
digitalWrite(2, HIGH) and digitalWrite(3, HIGH) light up the LED connected to pin 3 and 4 respectively on the board as expected.
But digitalWrite(1, x), where x can be HIGH or LOW, always causes LED on pin 1 to blink.
And digitalWrite(0, y), where y can be HIGH or LOW, also always causes the LED on pin 0 to blink, but this is slightly different from pin 1 such that it lights up, then dims, then lights up and so on, where as pin 1 blinks by lighting up and then turns off. Why does it dim and not turn off before lighting up again?
How can I get pin 0 and pin 1 to behave like pin 2 and 3?
void setup() {
// put your setup code here, to run once:
pinMode(0, OUTPUT); // sets the digital pin as output
pinMode(1, OUTPUT); // sets the digital pin as output
pinMode(2, OUTPUT); // sets the digital pin as output
pinMode(3, OUTPUT); // sets the digital pin as output
pinMode(4, OUTPUT); // sets the digital pin as output
pinMode(5, OUTPUT); // sets the digital pin as output
pinMode(6, OUTPUT); // sets the digital pin as output
pinMode(7, OUTPUT); // sets the digital pin as output
}
void loop() {
// put your main code here, to run repeatedly:
//digitalWrite(0, HIGH); // sets the LED on
//digitalWrite(1, HIGH); // sets the LED on
//digitalWrite(2, HIGH); // sets the LED on
digitalWrite(3, HIGH); // sets the LED on
//digitalWrite(4, HIGH); // sets the LED on
//digitalWrite(5, HIGH); // sets the LED on
//digitalWrite(6, HIGH); // sets the LED on
//digitalWrite(7, HIGH); // sets the LED on
delay(200); // waits for a second
digitalWrite(0, LOW); // sets the LED off
digitalWrite(1, LOW); // sets the LED off
digitalWrite(2, LOW); // sets the LED off
digitalWrite(3, LOW); // sets the LED off
digitalWrite(4, LOW); // sets the LED off
digitalWrite(5, LOW); // sets the LED off
digitalWrite(6, LOW); // sets the LED off
digitalWrite(7, LOW); // sets the LED off
delay(200);
}