Introduction: Meals Selection Machine

It can help people who hardly select their meals. Press the start button then the machine will help you to decide what will you eat tonight. In addition, it can train the user to make decisions by themself. The following link shows how the machine works.

Step 1: Design the Program

Use five LEDs and one switch to make the machine. Following the steps to control the shining order of the LEDs'.

Step 2: Prepare Arduino

According to the program, connect the LEDs and the circuit.

void setup(){ // put your setup code here, to run once:
pinMode( 2 , INPUT); // sets the digital pin as input pinMode( 4 , OUTPUT); // sets the digital pin as output pinMode( 5 , OUTPUT); // sets the digital pin as output pinMode( 6 , OUTPUT); // sets the digital pin as output pinMode( 7 , OUTPUT); // sets the digital pin as output pinMode( 8 , OUTPUT); // sets the digital pin as output pinMode( random( 4 , 9 ) , OUTPUT); // sets the digital pin as output }

void loop(){ // put your main code here, to run repeatedly: if (digitalRead( 2 )) { for (int i = 0 ; i < 2 ; ++i ) { digitalWrite( 4 , HIGH ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 5 , HIGH ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 6 , HIGH ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 7 , HIGH ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 8 , HIGH ); // sets the digital pin on/off digitalWrite( 4 , LOW ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 5 , LOW ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 6 , LOW ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 7 , LOW ); // sets the digital pin on/off delay( 100 ); // waits a few milliseconds digitalWrite( 8 , LOW ); // sets the digital pin on/off } digitalWrite( random( 4 , 9 ) , HIGH ); // sets the digital pin on/off delay( 500 ); // waits a few milliseconds } else { } }

Step 3: Decorate

Connect the LEDs to the extension cord. Then put it into the box and decorate it.

Step 4: Finish