From the course: Arduino: Prototyping

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implement buttons

Implement buttons - Arduino Tutorial

From the course: Arduino: Prototyping

Start my 1-month free trial

Implement buttons

- [Instructor] Our updated pseudocode has added setting up the invaders on the display, checking the button, and if the button is pressed when the laser is below an invader, the invader is destroyed. The first new feature there is to set up the invaders. Following our keep it simple mantra, one approach is to simply use LCD set cursor and LCD print to display a string of invaders at the top of our display. One thing that will be useful to know when we get to our sketch is that individual characters in a string can be accessed directly. For example let's say you set up your invaders string as a variable, and set its value equal to 16 characters to fit our display. You can then reference the first character in this string as invaders with a zero between square brackets. And it is an invader. The fourth character in this string is invaders with three between square brackets, and it is not an invader, it's a space. Counting…

Contents