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);
        }
    }
}
Revision:
8:07e55b300ff1
Child:
12:cedc088eaf05
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robot.h	Fri Apr 17 06:59:34 2015 +0000
@@ -0,0 +1,35 @@
+/***********************************
+name:   Robot.h      Version: 0.1
+author: PE HTL BULME
+email:  pe@bulme.at
+WIKI:   https://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/
+description:
+        Definition portion of a new Robot class for objectivRobot
+         
+***********************************/
+#include "mbed.h"
+#include "ur_Bertl.h"
+#include "string"
+
+#ifndef ROBOT_H
+#define ROBOT_H
+
+class Robot : public ur_Bertl
+{
+public:
+    Robot() {};
+    Robot(int x, int y, int dir, int beeper) {}
+    void move();          // nur Deklaration - Prototyping
+    void turnLeft();
+    bool frontIsClear();
+    void pickBeeper();
+    void putBeeper();
+    bool nextToABeeper();      //is there one or more beepers in the same corner?
+    bool nextToARobot();        //is there another robot in the corner?
+    bool facingNorth();         //is the robot facing North?
+    bool facingSouth();      // is the robot facing South?
+    bool facingEast();       // is the robot facing East?
+    bool facingWest();       // is the robot facing West?
+    bool anyBeepersInBeeperBag();    //are there any beepers in the bag?
+};
+#endif
\ No newline at end of file