Leds work simultanously. Version 3.1

Dependencies:   HCSR

Dependents:   bertl_led bertl_led bertl_led bertl_led ... more

Fork of Bertl by Bertl_Team_PE

BULME HTL Graz-Gösting

FSST - Hardwarenahe Programmierung

Created by Prof.Dr. Franz Pucher

Inhalt

Inhalt

Start mit folgendem Code in main.cpp eines neuen Projektes mbed_blinky:

#include "mbed.h"
#include "const.h"
#include "Robot.h"

Robot bertl;
    
int main()
{
    bertl.NibbleLeds(0x0F);
    wait(1);
    bertl.NibbleLeds(0x00);
    
    while(1)
    {
        if(bertl.IsButtonPressed(BTN_BL))
        {
            bertl.TurnLedOn(LED_BL1);
        }
        if(bertl.IsButtonPressed(BTN_BR))
        {
            bertl.TurnLedOff(LED_BL1);
        }
    }
}
Committer:
bulmecisco
Date:
Sun Apr 26 20:04:47 2015 +0000
Revision:
12:cedc088eaf05
Parent:
8:07e55b300ff1
Child:
17:308802267a62
Class Bertl with additional Methodes added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bulmecisco 8:07e55b300ff1 1 /***********************************
bulmecisco 12:cedc088eaf05 2 name: Robot.h Version: 1.0
bulmecisco 8:07e55b300ff1 3 author: PE HTL BULME
bulmecisco 8:07e55b300ff1 4 email: pe@bulme.at
bulmecisco 8:07e55b300ff1 5 WIKI: https://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/
bulmecisco 8:07e55b300ff1 6 description:
bulmecisco 8:07e55b300ff1 7 Definition portion of a new Robot class for objectivRobot
bulmecisco 8:07e55b300ff1 8
bulmecisco 8:07e55b300ff1 9 ***********************************/
bulmecisco 8:07e55b300ff1 10 #include "mbed.h"
bulmecisco 8:07e55b300ff1 11 #include "ur_Bertl.h"
bulmecisco 8:07e55b300ff1 12 #include "string"
bulmecisco 8:07e55b300ff1 13
bulmecisco 8:07e55b300ff1 14 #ifndef ROBOT_H
bulmecisco 8:07e55b300ff1 15 #define ROBOT_H
bulmecisco 8:07e55b300ff1 16
bulmecisco 8:07e55b300ff1 17 class Robot : public ur_Bertl
bulmecisco 8:07e55b300ff1 18 {
bulmecisco 8:07e55b300ff1 19 public:
bulmecisco 8:07e55b300ff1 20 Robot() {};
bulmecisco 8:07e55b300ff1 21 Robot(int x, int y, int dir, int beeper) {}
bulmecisco 8:07e55b300ff1 22 void move(); // nur Deklaration - Prototyping
bulmecisco 8:07e55b300ff1 23 void turnLeft();
bulmecisco 8:07e55b300ff1 24 bool frontIsClear();
bulmecisco 8:07e55b300ff1 25 void pickBeeper();
bulmecisco 8:07e55b300ff1 26 void putBeeper();
bulmecisco 8:07e55b300ff1 27 bool nextToABeeper(); //is there one or more beepers in the same corner?
bulmecisco 8:07e55b300ff1 28 bool nextToARobot(); //is there another robot in the corner?
bulmecisco 8:07e55b300ff1 29 bool facingNorth(); //is the robot facing North?
bulmecisco 8:07e55b300ff1 30 bool facingSouth(); // is the robot facing South?
bulmecisco 8:07e55b300ff1 31 bool facingEast(); // is the robot facing East?
bulmecisco 8:07e55b300ff1 32 bool facingWest(); // is the robot facing West?
bulmecisco 8:07e55b300ff1 33 bool anyBeepersInBeeperBag(); //are there any beepers in the bag?
bulmecisco 8:07e55b300ff1 34 };
bulmecisco 8:07e55b300ff1 35 #endif