Inspired by Mr. Jeff G.'s Mini Project LCD Maze, I hacked my version for FRDM-KL25Z. This one utilizes the MMA8451Q on the FRDM and my vt100 lib. By editing "maze.h" you can create your own maze.

Dependencies:   MMA8451Q mbed vt100

Another sample project to show how to use my vt100 lib along with MMA8451Q lib.

You can tailor the maze by editing "maze.h."

先にパブリッシュした vt100 ライブラリと、FRDM-KL25Zに搭載された加速度センサを使用した簡単な迷路プログラムです。

“maze.h” を編集することで独自の迷路を作成していただけます。

/media/uploads/Rhyme/maze_start.jpg

After download and reset, the point "@" is located at the start point. Goal is the green "G."

ダウンロードしてリセットすると、画面のスタート位置に“@”が置かれます。 ゴールは緑色の“G”です。

/media/uploads/Rhyme/maze_walking.jpg

Move the FRDM-KL25Z board to let the "@" go.

FRDM-KL25Z を動かして、“@”を移動させます。

/media/uploads/Rhyme/maze_goal.jpg

When "@" arrives at the goal with the "goal" banner, game ends.

“@”がゴールにたどり着くと“goal”というバナーが出てゲーム終了です。

maze.h

Committer:
Rhyme
Date:
2014-12-08
Revision:
1:6fab471dffd5
Parent:
0:f2f2c76b9816

File content as of revision 1:6fab471dffd5:

#ifndef _MAZE_H_
#define _MAZE_H_ defined

#define MAZE_W 20
#define MAZE_H 20

#define POS_PATH  0
#define POS_WALL  1
#define POS_START 2
#define POS_GOAL  3

uint8_t maze[MAZE_H][MAZE_W] = {
 {1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
 {1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
 {1,0,1,0,1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1},
 {1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1},
 {1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,0,1},
 {1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,1,1,0,1},
 {1,0,1,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1},
 {1,0,1,0,0,0,1,0,1,1,0,1,0,1,0,0,1,1,0,1},
 {1,0,1,0,1,1,1,0,0,1,0,1,0,1,0,1,1,1,0,1},
 {1,0,1,0,1,1,1,1,1,1,0,1,0,1,0,0,0,1,0,1},
 {1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1},
 {1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1},
 {1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1},
 {1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1},
 {1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1},
 {1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1},
 {1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1},
 {1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1},
 {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1},
 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1}
} ;      
#endif // _MAZE_H_