Please HELP me NOW!!!!!!

bld:
Not sure what your problem is, I am trying to help you, and instead you are bringing that stupid crap up.

And the fun thing is, we all understand each other over here, and we even understand everyone over where you are too, so where is the actual problem? Us over here, or people over there?

But all in all, I prefer not to waste my time like this, so this will probably be the last time trying to help you. Good luck

Cool down a bit.
This whole thread was a joke from the beginning. That's why it was posted in Bar Sport.
A lot of the stuff in the Bar Sport group is just waste of time. If you don't have time to waste, stop reading it.

mowcius:
bld, did you read the first post?

I did, but also thought there must be a reason to post something. Making a post just for making one, is... Well, don't even know what to call it, besides it might be because the author just needed some attention.

perhof:
Cool down a bit.
This whole thread was a joke from the beginning. That's why it was posted in Bar Sport.
A lot of the stuff in the Bar Sport group is just waste of time. If you don't have time to waste, stop reading it.

No, because many of the things in bar sport actually got something in them, maybe not some productive, but they still got something in.

When looking back over this, I see nothing. I even asked what it was about, and instead of a reply, I get a video making fun of someone, not even sure who, because no one over here talks like that.

So maybe it was all just for fun, wonder when the part making it fun come.

bld: Undskyld.

mowcius:
You need to set it as an output though or it's not properly turned on.

Well, there you go. All this chit chat and yet, another interesting fact creeps up. I thought from this (and some other stuff done previously) that all pins start as INPUT (re)boot, except #13 because of its LED wiring basically only is usable as OUTPUT.

Hmmm. digitalWrite to an input pin is supposed to put a 20K resistor to Vcc and if the other end of the LED is at GND then yes, I get 0.2mA through the LED. It glows a lot brighter than that. And measures 4.8V ... So I tried different INPUT, OUTPUT LOW and HIGH, and yes: With INPUT the 20K pullup just barley makes the onboard LED glow. It has to be OUTPUT. And that is what pin 13 is, by default. I think I am right here. Oh well, we could look at the init code at github, but I cant be bothered now.

Constructive critism is always welcome. If the worst happens I learn someting.

All IO pins are powered up as inputs at powerup, sketches must set it to Output. Including D13.
It is certainly usable as an input. Anything driving it High just needs to supply maybe 3mA to overcome the current limit resistor and LED (assuming it has Vforward of ~2V for an 0805 LED).

Including D13.

?

D13 is not limited to an output only as thought my Msquare:
"I thought from this (and some other stuff done previously) that all pins start as INPUT (re)boot, except #13 because of its LED wiring basically only is usable as OUTPUT."

sketches must set it to Output. Including D13.

The bootloader leaves pin 13 as an output.
There is no need for a sketch to set it as an output.

Okay, didn't know that.
I never assumed it was set to anything and made sure my sketches set it as an input or output as needed.

Tested as the shortest possible program to turn on LED13 (measured using normal Arduino source)
Code:

void setup(){}void loop(){digitalWrite(13,HIGH);}

I dosen't any smaller than this - I guess you say that to all the girls :stuck_out_tongue:

Same compiler size (694 bytes) but less writeing:

void setup(){}void loop(){digitalWrite(13,1);}

Smaller compiler size (440 bytes) and less writeing:

void setup(){}void loop(){PORTB=B100000;}

Smaller compiler size (440 bytes) and even lesser writeing:

void setup(){}void loop(){PORTB=1<<5;}

-Fletcher

AWOL:

sketches must set it to Output. Including D13.

The bootloader leaves pin 13 as an output.
There is no need for a sketch to set it as an output.

Well I can't say I didn't learn anything today then :slight_smile:

mowcius:

AWOL:

sketches must set it to Output. Including D13.

The bootloader leaves pin 13 as an output.
There is no need for a sketch to set it as an output.

Well I can't say I didn't learn anything today then :slight_smile:

Hmm... and I thought it was automatically input like all the others... /me tests

Just tested, and that is wrong, Pin 13 is no different than any other pin, it's set to Input unless programmed otherwise

AWOL:
The bootloader leaves pin 13 as an output.
There is no need for a sketch to set it as an output.

I'm glad I tested that. Because it doesn't (if you use setup and loop, which I assume you meant?).

But this is the Bar Sport section, right?

However this works:

int main(){PORTB=1<<5;}

Now that's short! (180 bytes).

However this works:

Code:

int main(){PORTB=1<<5;}

Now that's short! (180 bytes).

Does that count as Arduino code?

After a bit a thinking in the car to work this morning I can cook it down to:

void setup(){}void loop(){PORTB=32;}

That is 2 chars less than the privious code - still 440 bytes.
Unless there are some special woodoo bitwise operator that flip the intire PORTB from 0 to 1 I think we have hit the buttom. 36 chars of Arduino code to turn on led 13.

-Fletcher

It compiles under the normal Arduino IDE. It uploads to the Uno. It lights the LED. Are there other requirements?

void setup(){}void loop(){PORTB=32;}

This only lights it faintly because you haven't set the port to be output. However you gave me a clue ...

int main(){DDRB=32;PORTB=32;}

(182 bytes).

Strangely, my earlier sketch stopped lighting the LED fully, so it would appear a bit undefined whether pin 13 stays in output mode or not. Hence adding in DDRB=32.

Oh, and if you try this:

int main(){DDRB=PORTB=32;}

Rather than taking less memory it takes more (184 bytes). Somehow that defeated some compiler optimization.

AWOL:
The bootloader leaves pin 13 as an output.
There is no need for a sketch to set it as an output.

OK now I'm puzzled. Various tests (including by others) appear to show that pin 13 is not always left as an output. Thus, the minimal sketch of this:

void setup(){}void loop(){digitalWrite(13,1);}

... only makes the LED glow faintly.

However yesterday I was sure that, at least once, it glowed brightly.

Skimming through optiboot.c I see where it is set as an output:

 /* Set LED pin as output */
  LED_DDR |= _BV(LED);

But it doesn't seem to be set back as an input.

Skimming through init in wiring.c, I can't see where it sets pin 13 to an input either.

So it seems that AWOL is right, except for the evidence of my own eyes.

And here is something else odd. When you power up the board (eg. with a battery) that does a reset, right? Well when I do just that, the onboard LEDs (Tx and Rx) do not flash. But a moment later if I hit the reset button, they do flash. So it seems that the power-on reset is different to the "reset button" reset.

This is something to do with the Atmega8U2 isn't it? That is what the Tx and Rx LEDs are connected to.

Still, that doesn't explain the pin 13 problem.

Hi Nick

I get the following results:

MAC OS 10.5.8
Arduino IDE 0017
Arduino Duemilanove

void setup(){
  pinMode(13,OUTPUT);
}
void loop(){
  digitalWrite(13,1);
}

Bright LED.

void setup(){
  pinMode(13,INPUT);
}
void loop(){
  digitalWrite(13,1);
}

Dim LED.

But this

void setup(){}void loop(){PORTB=32;}

Bright LED.

Seems like the pin is set to output initally.

-Fletcher

Update:
Upgraded to Arduino IDE 0022

Same result with the led.

Though this:

int main(){PORTB=1<<5;}

Compiles with IDE 0022 - it did not compile with 0017.

-Fletcher

There is a bit of an undefined aspect here. Yesterday it worked for me a couple of times and then it didn't.

On my Mega2560 the sketch you mentioned:

void setup(){}void loop(){digitalWrite(13,1);}

... only blinks the light dimly.