You know the drill, let's begin by making a High-Level block diagram of this project. It is shown in the following diagram:
Let's now outline how this will all work together. When your toy senses someone in front of it, a smile made of LED's lights up, and when it doesn't sense anything, its LED smile goes away.
We will be using conditional statements again and the flow chart is as follows:
According to our flow chart, the sensor will constantly check if someone is close. If there is nothing in front of the sensor, the Arduino will make sure the LED's are off, and continue checking the proximity sensor. When an object is in front of the sensor, the LED's will light up.