Personally I use byte, because pin numbers are indeed unsigned, and don't go over 255.
Actually pin numbers, as used with 'digitalWrite(12, HIGH)', are in fact specified as being of type 'uint8_t' so the compiler will down convert the 'int' to an 'uint8_t' for you.But technically you should be specifying pins as 'const uint8_t pinANALOG = A0' as an example.
But technically you should be specifying pins as 'const uint8_t pinANALOG = A0' as an example.
Quote from: lloyddean on Feb 03, 2013, 06:54 amBut technically you should be specifying pins as 'const uint8_t pinANALOG = A0' as an example.In other words, "const byte".
/** \ingroup avr_stdint 8-bit unsigned type. */typedef unsigned char uint8_t;
I much prefer 'uint8_t' as it's easier to know what you're getting and is the same everywhere I want to be.
That's fine, but the core type is "unsigned char" as shown here in stdint.h:Code: [Select]/** \ingroup avr_stdint 8-bit unsigned type. */typedef unsigned char uint8_t;You just have to remember that "unsigned char" is an 8-bit unsigned type.Using uint8_t is one typedef away from the core type.This is obviously a style issue, but for me, I prefer to remember that. It's like saying:"I want to call a dog a MammalWith2LegsThatBarks because that tells me more about it."OK, but it's really a dog.I don't want to start a "style war" here, hey next we'll be arguing about GOTO.
I'm only upset that I thought a dog had two legs.
Well they do have two legs, plus two more.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16