C H A P T E R  8

Arrays and Memory

Arrays are an essential part of the Arduino programmer's toolbox. They are sometimes such a necessity that we have already thrown a few in our sketches and projects here and there. Arrays are essentially lists of variables that can contain multiple elements of the same data type. They can be used to store a list of pin numbers, sensor values, character strings, and even bitmaps for animations. While we could have introduced arrays earlier when we discussed variables and data types, the topic truly requires its own chapter to best understand how to use them. Because arrays can consume a large amount of the available memory on the Arduino microcontroller, we should also look at the types of memory space on the microcontroller chip and methods for how to access them, in addition to discussing how to declare arrays, accessing and using arrays, as well as using character and multidimensional arrays. But before tackling arrays in detail, let's jump in with our eighth project, Decision Machine, so that when we get to dicussing arrays in more depth you'll have already seen them in action.

What's needed for this chapter:

  • Arduino Uno
  • 16 × 2 character liquid crystal display HD44780 compatible
  • ADXL335 accelerometer (SparkFun breakout)
  • 5mm LED of any color
  • 1× 220 ohm and 1× 2.2 kilohm ¼ watt resistor or similar
  • Hookup wires
  • Solderless breadboard
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset