Why use int instead of byte for pin numbers?

I will neither praise nor criticize the many arduino design points (hardware and software, of which some seem valid to me and some silly) being brought up in this post, but rather just celebrate the vast popularity of the arduino platform and the huge membership of this forum, even consisting of some members that think they got it all wrong. :smiley:

If I was to add to the critic list, I would be tempted to add:

Auto-reset circuit that has had many revisions and cannot be defeated with an easy switch or jumper clip selection.

Auto-voltage selection circuit that is complex, forces the priory selection if both voltage sources are available. Should have been a simple jumper clip like an early arduino board had.

Latest rev 3 uno and mega boards that use pin 13 led opamp driver/buffer that has a floating input pin condition allowing the led to randomly be on or off if not forced low by a pin 13 output mode and digital output LOW commands.

Lefty

retrolefty:
I will neither praise nor criticize the many arduino design points (hardware and software, of which some seem valid to me and some silly) being brought up in this post, but rather just celebrate the vast popularity of the arduino platform and the huge membership of this forum, even consisting of some members that think they got it all wrong. :smiley:

It's just like Windows. Just because everyone uses it, doesn't make it good.

majenko:

retrolefty:
I will neither praise nor criticize the many arduino design points (hardware and software, of which some seem valid to me and some silly) being brought up in this post, but rather just celebrate the vast popularity of the arduino platform and the huge membership of this forum, even consisting of some members that think they got it all wrong. :smiley:

It's just like Windows. Just because everyone uses it, doesn't make it good.

Yea, many seem to hate all oil companies but still buy their gasoline. :wink:

Disclaimer, retired oil company employee. Great job, great company, some great supervisors, some piss poor ones also. :smiley:

Lefty

Osgeld:
yea, I am getting close to the edge of ram in one of my project, changed all my const X's to #defines and freed up almost 2 dozen bytes of ram

Proof? Constants don't take up RAM.

Well now that we are dissing Arduino, allow me to add my gripes!

Yes, very good, but the design is good enough that they are selling tens of thousands. The good points are that it is aimed at the beginner market, the shields are a useful add-on, and it was an excellent decision to use the open-source g++ compiler.

Compare that to other boards where you have to buy their own (dodgy) compilers, or get a cut-down "beginner" version, and put up with an IDE that is so complex it's almost impossible to get a project up quickly.

Yeah I figure, maybe they weren't the best programmers or engineers but they did create the best, most successful beginner development board and IDE so there's something to be said about that.

@majenko and Krupski
All the above gripes have been posted many times, some even by me. I don't understand many of the design decisions made by Arduino either but the often dubious "features" haven't stopped it becoming a success.

As someone who has never had such a runaway success despite spending a lifetime trying to produce good hardware and software design I find it quite discouraging and another case of both marketing over function and being in the right place at the right time with the right product. Also the fact that most users don't give a rodent's posterior as long as they can get a LED to blink in time with the music :slight_smile:


Rob

Wait, you can get the LEDs to blink in time with music? I must try that ...

the shields are a useful add-on

...and difficult for beginners to plug in the wrong way round :wink:

Exactly! And that is what was so brilliant about the original design. :slight_smile:

I think it's fair to say that the Arduino is designed for and marketed towards people who don't know any better. Obviously there are people here who can see ways to improve the development environment, runtime library (and its documentation) and the hardware. (No matter how good it was, that would always be the case.) But these are not the people that Arduino targets.

retrolefty:
Yea, many seem to hate all oil companies but still buy their gasoline. :wink:

There is little choice other than to bicycle or walk (both of which are impractical in cold weather and/or long distances).

Krupski:

retrolefty:
Yea, many seem to hate all oil companies but still buy their gasoline. :wink:

There is little choice other than to bicycle or walk (both of which are impractical in cold weather and/or long distances).

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.

I'm not saying Arduino is "bad", I just have gripes about the design. The ONLY reason I use Arduino is because of the great GCC support.

The boards, at the very least, should have usable mounting holes. People actually do build REAL projects with Arduino boards and it's ridiculous to either need special plastic standoffs or double sided foam tape to mount the board!

And, the Atmel AVR line certainly isn't the best choice for a microcontroller, but it's good enough for most uses.

I personally prefer the "Motorola" style (von Neumann) CPU architecture. The Harvard / Intel / AVR style architecture is a nightmare to work with. Thankfully, the C libraries shield me from most of that grief...

majenko:
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! :slight_smile:

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 :slight_smile:

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

transfinite:
The latter will use more flash...

By a constant eight bytes for the entire sketch. Hardly worth mentioning. :wink:

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.

Khalid:
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 :slight_smile:

you mean the wiring guys?

]:slight_smile: