Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- el17arm
- Date:
- 2019-03-29
- Revision:
- 14:dc3524d11921
- Parent:
- 13:3bf02cb26d6d
- Child:
- 15:2bda80896a84
File content as of revision 14:dc3524d11921:
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Minerengine.h"
#include "Levelengine.h"
#include "Gameengine.h"
Vector2D p;
Gameengine game;
Levelengine level;
Minerengine miner;
Gamepad pad;
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
AnalogIn pot0(PTB2);
void contrast();
void init();
void start_screen();
int main()
{
    init();
    start_screen();
    miner.miner_init();
    
    while (1) {
        contrast();
        miner.get_pos();
        level.central_cavern(lcd);
        miner.miner_gravity(lcd);
        miner.miner_jump(lcd, pad);
        miner.read_direction(pad);
        miner.miner_move();
        miner.miner_draw(lcd);
        miner.miner_collision(lcd);
        level.collision_points(lcd, pad);
        game.collision();
        
        wait(0.1);
        
    }
}
void init()
{
    lcd.init();
    lcd.normalMode();      // normal colour mode
    lcd.setBrightness(0.5); // put LED backlight on 50%
    lcd.refresh();
    pad.init();
    pad.leds_off();
    contrast();
    
}
void contrast()
{
    lcd.refresh();
    float con = pot0.read();
    lcd.setContrast(con);
    lcd.clear();
}
void start_screen()
{   
    
    lcd.printString("*MANIC MILNER!*",0,1);
    lcd.printString(" Press start! ",0,4);
    lcd.refresh();
    while ( pad.check_event(Gamepad::START_PRESSED) == false) {
        pad.leds_on();
        wait(0.1);
        pad.leds_off();
        wait(0.1);
    }
}