Category Archives: Uncategorized

Arduino Variable Types Explained

Here’s something for reference.
I can never find just quite the succinct reference to Arduino Variable types. Nowhere could i find a list of minimum and maximum values, the bits, and the memory used by each variable type.

Neither was there any clear definition of meaning of ‘unsigned’, which just means no plus or minus signs in this type – that is all numbers positive. This increases the highest number that can be stored in the same memory. (thank me in the comments).

Usage Variable type Bits Min value Max value Ram usage Comments
common boolean 8 TRUE FALSE 1 byte
common byte 8 0 255 1 byte
char 8 -128 127 1 byte ¬†A single ‘character’ e.g. ‘a’ is a single char.¬† Represented by chr(65) or the binary: 01000001
word 16 0 65535 2 byte
common int 16 -32768 32767 2 byte
unsigned long 32 0 4,294,967,295 4 byte
common long 32 -2,147,483,648 2,147,483,647 4 byte
common float 32 -3.4028235E+38 3.4028235E+38 4 byte
The below types are only included for compatibility or further study.
redundant unsigned char 8 0 255  1 byte use byte instead
redundant unsigned int 16 0 65535  2 bytes use word instead
redundant double 32 -3.4028235E+38  3.4028235E+38  4 bytes use float instead
The below types are special types (see arduino.cc)
special string variable  1 byte + x An array of chars
(used for storing strings to modify)
special enum variable  N/A Like boolean but custom fixed set of values allowed instead of TRUE/FALSE.
special struct variable  N/A Public sub variables
(as if you’d made a public class)
special pointer ¬†N/A I’ll be honest, I wasn’t sure the use of this one. Here for completeness though!
Source: https://learn.sparkfun.com/tutorials/data-types-in-arduino
Source: https://playground.arduino.cc/Code/DatatypePractices
Remark: “Unsigned” means no negative sign. This increases the range of positive numbers available.
Remark: Unsigned variables that exceed their capacity roll over back to zero. This could be useful to iterate through arrays of limited length

PPS If anyone can figure out how to properly format this table so it looks nice, with ‘center’ aligned text, please let me know wordpress was being frustrating!

(The formatting css is in the source, see the table tag)

Excel tip – adding two numbers where one is text

Just a quick tip as i couldn’t quickly find the answer in google.

If you have two cells of data and you want to add them when one might have text instead of a number, use the SUM function.

For instance

Class Section 1
QTY
Section 2
QTY
Totals
Robots 10,000 1,000 =sum(B2:C2)
=11,000
Humans 9,000,000,000 n/a =sum(B3:C3)
=9,000,000,000
Plants n/a n/a =sum(B4:C4)
=0

I also searched for: sum two values if isnumeric, excel add two numbers if text only include the non text and excel add two numbers if text.

Office music

isolation with headphones

or Togetherness by synchronised streaming?

​

Apps used: 

  • Logitech media server (aka squeezebox) – running on a  Raspberry Pi
  • Squeezer (Android) for remote control, queuing tracks, playlist management and synchronising the players
  • SB player (Android) to play the 

    Ps, it’s way past my bedtime! Insomnia is a pain. Goodnight all. 

    Nail surgery; aka needle phobia

    So, by the time this gets published, I’ll have had nail surgery. Partial nail avulsion, is the technical term. Part of my nail is getting cut off, then the nail bed killed with a chemical. This is actually the second time I’ve had this done on this particular toe, just the other side’s gone bad this time.

    Part of the process involves having local anaesthetic injected into the toe. It is really quite painful, and I’m told makes the toe swell quite impressively as the¬†anaesthetic goes in. I mention this, because I’m terrified of needles and injections. When I’m in the same room as one that I can see, I almost can’t take my eyes off it, it just seems like a thread. Nuts, but there we are.

    I’ve told this story a few times, but not to my blog I think. It goes back to when I was in hospital, going to have an appendectomy because my appendix was threatening to go pop. Junior doctor decided it would be a great idea to draw blood, and leave a port type thing in my elbow so that they could push¬†anaesthetic in later at need.

    So, in went the needle.. and ow. Very ow. Very very ow. Apparently, I’ve inherited veins that seem to move, and don’t like to be pinned with needles very easily. Eventually, he gave up and pull it out. The needle that’d been very straight going in, was now bent 90 degrees. I don’t know how he did it, but ow ow ow ow.

    Refused to let him try again, refused to let a senior doctor try again. In the end they agreed to use¬†anaesthetic cream on my palm, then take the blood they needed from there. Anyway, ever since I’ve been scared of injections and needles. Yay! Surgery’ll be fun ūüėČ

    Daily blog

    Just because, I’m gunna try to blog daily again. Obviously, I’m cheating, loading multiple blogs in at once and having them post automagically, but still. Something for every day. Even if it’s something short like this!

    Bodies are stupid. Soon, I’m going to have surgery on my foot, because apparently nails sometimes curl and cut into the nailbed. This is pleasant… \s