Escape From Alcatraz Island

by Catgirlgogo in Living > Toys & Games

405 Views, 1 Favorites, 0 Comments

Escape From Alcatraz Island

DSCN7525
P_20200724_095336.jpg
P_20200724_095340.jpg
P_20200724_100426.jpg
抽籤吧

Escape from Alcatraz is a game book, plus the automatic drawing machine at the last level, makes it more interesting. Even though it is a game book for schoolchildren, it is difficult for adults to succeed. Therefore, if a child can complete the task, it means he (she) has infinite potential.

Supplies

Production materials and tools:

Paper: More than three sheets, the more the better.

Pen: A pencil and colored pen, the more colors the better, at least prepare three primary colors.

Box: carton, 21*14*5 one, 32*22*7 one.

Colored paper: pink and yellow.

A pair of scissors.

Two alligator clips.

LED lights: yellow one, blue one.

One LCD panel.

One each for arduino Leonardo board and breadboard.

There are several wires, and more than ten should be prepared in advance.

tape.

Design Game Cards

P_20200723_113133.jpg
P_20200723_143832.jpg
P_20200723_112852.jpg
P_20200723_143820.jpg
P_20200724_102301.jpg
P_20200724_102306.jpg
P_20200723_113134.jpg
P_20200723_132843.jpg
P_20200723_143816.jpg
P_20200723_113133.jpg
P_20200723_143831.jpg
P_20200723_145445.jpg
P_20200723_152859.jpg
P_20200723_112852.jpg

Use scissors to cut out the white paper, draw each level, and use text to explain the level test.

Here are some levels:

To the dining room: Draw 16 squares, write random numbers inside, and randomly draw soldiers, dogs and bones, to test the concept of space for children to walk the maze, and the ability to break through obstacles by allowing the dog to eat the bones and the dog will not bark.

Watch the love reminder: Draw a heartbreak pattern, and write "If the fox wants to escape from prison, the little fox heart black beaver jailer." Test the child's imagination and ability to break through obstacles.

Truth or Dare School Kids Edition:
Cut out several pieces of paper to make a card, write the action or title, and write "truth" or "adventure" in front of the card (truth is the title, and the big adventure is the action). Truth tests children's knowledge, big adventure tests children's physical fitness.Rules: Guess a boxing with a friend, the loser must draw a card, follow the card instructions, answer questions or make moves, do not refuse, or stand up to the ground eight hundred times.

Use your imagination to design more levels.

Write Code

P_20200723_110642.jpg
P_20200723_112841.jpg
P_20200723_112824.jpg
V 20200723 112738

Write out the program code that press the switch, the LCD panel will automatically draw lots, and the lights will light up according to the result, and the horn will sing.

The code:#include

#include

// For these LCD controls to work you MUST replace the standard LCD library from... // https://github.com/marcoschwartz/LiquidCrystal_I2C // Direct download https://github.com/marcoschwartz/LiquidCrystal_I2C/archive/master.zip // Your project will not compile until this is done. LiquidCrystal_I2C lcd_I2C_27(0x27, 16, 2); // set the LCD address for a 16 chars and 2 line display

int _mLID ; int _mState ; int _mLTime ; int _mLightTime ;

void setup() { // put your setup code here, to run once: lcd_I2C_27.init (); // initialize the lcd lcd_I2C_27.backlight(); // lcd_I2C_27.setCursor(0 , 0) ; // set the cursor, counting begins with 0 // lcd_I2C_27.print( "Hello" ); // Print a message to the LCD. pinMode( 4 , INPUT); // sets the digital pin as input

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

_mLTime = 0 ; _mLID = -1 ; _mState = -1 ; _mLightTime = 0 ;

}

void loop() { // put your main code here, to run repeatedly:

int a ;

// 按下 if ( 0 == _mState ) if ( digitalRead( 4 )) { mLCD( "randy" ); // play { int p[] = { 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 1 , 1 , 0 } ; mPlay( p , 100 ); }

a = random( 0 , 3 ); if ( a == 0 ) {

mLight( 6 ); mTouch( "win" ); // Print a message to the LCD. int p[] = { 5, 5, 3, 1, 5, 5, 3, 1 , 2, 3, 4, 4, 3, 4, 5, 5, 5, 3, 5, 3, 2, 3, 1 , 0 } ; mPlay( p , 200 ); } else if ( a == 1 ) { mLight( 2 ); mTouch( "try again" ); // Print a message to the LCD. int p[] = { 1 , 2 , 3 , 1 , 1 , 2, 3 , 1, 3, 4, 5, 3, 4, 5 , 0 } ; mPlay( p , 200 ); } else //if ( a == 2 ) { mLight( 1 ); mTouch( "lose" ); // Print a message to the LCD. int p[] = { 1 , 1 , 1 , 2 , 3, 3, 3, 3 , 0 } ; mPlay( p , 500 ); } _mState = -1 ; delay( 1000 ); }

// 燈 mFlashLight(); // 初始化 switch ( _mState ) { case 0 ://nomo delay( 10 ); mFlashLight();

break ; default : mLCD( "be friendly" ); int p[] = { 1 , 1 , 5 , 5 , 6 , 6 , 5 , 4 , 4 , 3 , 3 , 2 , 2 , 1 , 0 } ; mLight( 6 ); mPlay( p , 200 ); _mState = 0 ; break ; }

} // touch void mTouch( String inText ) { int i ; for ( i = 0 ; i < 3 ; ++i ) { mLCD( inText ); delay( 800 ); mLCD( "" ); delay( 800 ); } mLCD( inText ); // delay( 2000 ); } // lcd void mLCD( String inText ) { lcd_I2C_27.clear(); lcd_I2C_27.setCursor(0 , 0) ; // set the cursor, counting begins with 0 lcd_I2C_27.print( inText );//"be friendly" );

}

// Play // wave int aWav[] = { 0 , 262 , 294 , 330 , 349 , 392 , 440 , 494 , 524 , 558 , 660 , } ; void mPlay( int inPID[] , int inTime ) { int i , p ; for ( i = 0 ; ( p = inPID[i] ) > 0 ; ++i ) { tone(5 , aWav[p] , inTime - 50 ); delay( inTime ); } }

// 燈0紅,1黃2,藍 void mLight( int inLID ) { if ( inLID == _mLID ) return ; _mLID = inLID ; digitalWrite( 8 , (( inLID & 1 ) != 0 ) ? HIGH : LOW ); // sets the digital pin on/off digitalWrite( 7 , (( inLID & 2 ) != 0 ) ? HIGH : LOW ); // sets the digital pin on/off digitalWrite( 6 , (( inLID & 4 ) != 0 ) ? HIGH : LOW ); // sets the digital pin on/off

}

// 閃燈 void mFlashLight() { _mLightTime ++ ; if ( _mLightTime > 400 ) _mLightTime = 0 ; if ( _mLightTime > 200 ) mLight( 6 ); else mLight( 0 );

}

Connection Line

Connect the speaker, LCD panel and LED panel to the correct position.

Test

自動抽籤機
P_20200723_191917.jpg

Try it again, check the program code for errors, whether the horn can sound, and the LED light can shine.

Boxing

P_20200723_191159.jpg
P_20200723_191216.jpg

Put the finished product in the box and draw the drawing outside the box.