Offline
Sr. Member
Karma: 15
Posts: 463
|
 |
« Reply #30 on: February 26, 2013, 10:43:49 am » |
There's always running... Gets you warm in cold weather, and gets you further distance in a shorter time. It also gives you heart attacks and knackered knees.
Most of the traces in my left knee are burned open from playing hockey. Running isn't an option for me anymore! 
|
|
|
|
|
Logged
|
|
|
|
|
Pakistan
Offline
Sr. Member
Karma: 5
Posts: 318
Arduino rocks
|
 |
« Reply #31 on: February 26, 2013, 11:21:57 am » |
I can not listen bad about Arduino... I am very thankful to the guys who gave us Free IDE and lot of libraries... And all those are very very simple to use... I love you guys 
|
|
|
|
|
Logged
|
|
|
|
|
Birmingham, AL
Offline
Jr. Member
Karma: 2
Posts: 61
Arduino, disobey me.
|
 |
« Reply #32 on: February 26, 2013, 12:14:41 pm » |
The real answer to the original question:
Why use int instead of byte for pin numbers?
1. The programmer's time is much more expensive than the computer or compiler's time.
2. 95% of the time you are not going to need the extra few bytes saved.
3. The C++ optimizer is so good that it will rarely make any difference in code size anyway.
Two practices that will save some resources were already mentioned by majenko and Krupski in the first page of this thread:
const int instead of int for constants will some a couple bytes, and Serial.print(F("string const")); instead of Serial.print("string const");
The latter will use more flash, but save RAM. Conservation of RAM is usually a bigger concern than conversation of flash, in my experience. If your code starts acting flaky you are probably running out of RAM, not flash.
-transfinite
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10138
|
 |
« Reply #33 on: February 26, 2013, 10:21:51 pm » |
The latter will use more flash... By a constant eight bytes for the entire sketch. Hardly worth mentioning. 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 15
Posts: 463
|
 |
« Reply #34 on: February 27, 2013, 10:34:49 am » |
The latter will use more flash... By a constant eight bytes for the entire sketch. Hardly worth mentioning.  Ah but don't you know? Everyone's sketch compiles to 32767 bytes and not a single one more will fit! (the reason for crippling sprintf and sscanf for floating point). /saracsm off.
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3619
@ssh0le
|
 |
« Reply #35 on: February 28, 2013, 12:45:42 am » |
I can not listen bad about Arduino... I am very thankful to the guys who gave us Free IDE and lot of libraries... And all those are very very simple to use... I love you guys  you mean the wiring guys? ] http://wiring.org.co/
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #36 on: February 28, 2013, 08:07:32 am » |
I can not listen bad about Arduino... I am very thankful to the guys who gave us Free IDE and lot of libraries... And all those are very very simple to use... I love you guys  you mean the wiring guys? ] http://wiring.org.co/Sure, along with the AVRDUDE guys, the gcc guys, the processing guys, and the java guys (I'm probably leaving others out?). The arduino platform design stands on the shoulders of many open source projects, it wasn't designed in a vacuum or a ground up effort, more like assembled from many other's open source contributions. I think arduino's main unique contribution was their decision to open source their hardware design also which really spurred on a strong 3rd party 'compatible' and shield market that few other hardware/software micro-controller enjoy. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Pittsburgh, PA, USA
Offline
Faraday Member
Karma: 30
Posts: 2901
I only know some basic electricity....
|
 |
« Reply #37 on: February 28, 2013, 08:09:58 am » |
Why do we use: int led = 13; instead of byte led = 13; If you would never need to define more than 256 pins, why use the extra space for int? Is there a reason? Thanks. That's what I do. 2k ram really isn't much, and then you try an ATtiny....
|
|
|
|
|
Logged
|
Examples can be found at Learning in the Main Site and at the Playground
|
|
|
|
Pittsburgh, PA, USA
Offline
Faraday Member
Karma: 30
Posts: 2901
I only know some basic electricity....
|
 |
« Reply #38 on: February 28, 2013, 08:15:36 am » |
An "int" is an unsigned 16 bit variable (uses two bytes of memory).
Type int has always been signed in every version of C or C++ I ever used, including Arduino. http://arduino.cc/en/Reference/Int
|
|
|
|
|
Logged
|
Examples can be found at Learning in the Main Site and at the Playground
|
|
|
|
|