Go Down

Topic: Please HELP me NOW!!!!!! (Read 2 times) previous topic - next topic

perhof


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.

bld


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.


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.
captain-slow.dk | non contagious!

Msquare


Msquare


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. <Gets out the DVM> 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.

CrossRoads

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).
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

AWOL

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

CrossRoads

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."
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

AWOL

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

CrossRoads

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.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Fletcher Chr

#24
May 01, 2011, 11:41 pm Last Edit: May 01, 2011, 11:49 pm by Fletcher Chr Reason: 1
Quote
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  :P


Same compiler size (694 bytes) but less writeing:
Code: [Select]
void setup(){}void loop(){digitalWrite(13,1);}

Smaller compiler size (440 bytes) and less writeing:
Code: [Select]
void setup(){}void loop(){PORTB=B100000;}
 
Smaller compiler size (440 bytes) and even lesser writeing:
Code: [Select]
void setup(){}void loop(){PORTB=1<<5;}

-Fletcher

mowcius


Quote
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 :)

Valalvax

#26
May 02, 2011, 04:10 am Last Edit: May 02, 2011, 04:14 am by Valalvax Reason: 1


Quote
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 :)



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

Nick Gammon


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:

Code: [Select]
int main(){PORTB=1<<5;}

Now that's short! (180 bytes).

Fletcher Chr

Quote
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:
Code: [Select]
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

Nick Gammon


Does that count as Arduino code?


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

Quote
Code: [Select]
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 ...

Code: [Select]
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:

Code: [Select]
int main(){DDRB=PORTB=32;}


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

Go Up