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.
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.
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).
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."
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.
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.