Skip to main content
Use an Arduino and three LEDs to make an electronic, binary die to teach students about data representation, programming basics, and Arduino in an engaging introductory activity.
- This is a great first programming exercise for introductory courses, because very little material needs to be covered before introducing this activity, and students begin problem solving in a programming context early on.
- This introductory activity also reinforces introductory Arduino lecture content (e.g., setting pinModes, manipulating LEDs to be on/off, running certain pieces of code when the button is pressed).
- Activity: Students will make a representation of a six-sided die (the singular version of dice).
- The activity involves students programming the Arduino’s button and 3 LEDs to make the electronic die.
- Activity Prep:
- Create pre-wired circuits on an Arduino with Arduino’s button and 3 LEDs.
- This makes it so students don’t need to worry about the hardware side of Arduino so they can jump straight to the programming aspect of this activity.
- Activity Goal: When the button is pressed, a random number from 1 to 6 will be represented in binary by the LEDs.
- Successful completion of this activity will result in boards that look like the picture below.
- This board shows a die representing the number 3.