Leds work simultanously. Version 3.1
Dependents: bertl_led bertl_led bertl_led bertl_led ... more
Fork of Bertl by
BULME HTL Graz-Gösting
FSST - Hardwarenahe Programmierung
Created by Prof.Dr. Franz Pucher
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); } } }
Diff: ur_Bertl.h
- Revision:
- 7:e7f74f072564
- Parent:
- 5:6b667e2cb800
- Child:
- 12:cedc088eaf05
diff -r df6830254e8b -r e7f74f072564 ur_Bertl.h --- a/ur_Bertl.h Fri Apr 10 09:31:54 2015 +0000 +++ b/ur_Bertl.h Mon Apr 13 15:28:10 2015 +0000 @@ -1,11 +1,12 @@ /*********************************** -name: ur_Bertl.h Version: 2.0 +name: ur_Bertl.h Version: 2.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 the class ur_Bertl The Robot boolean commands added for if/else, while, ... + int ReturnButtonPressed() added which returns the int value of button pressed ***********************************/ #include "mbed.h" @@ -152,7 +153,8 @@ bool WaitUntilButtonPressed(); /**< wait until any button is pressed at the robot */ bool FrontIsClear(); /**< returns a boolean value true if front is free; if not false */ bool NextToABeeper(); /**< returns a boolean value true if the robot is on a black place or line; if not --> false */ - bool IsButtonPressed(const int btn); + bool IsButtonPressed(const int btn); /**< returns true if Button btn is pressed, else false */ + int ReturnButtonPressed(); /**< returns the int value of button pressed */ int AnyBeeperInBag(); /**< returns an int value (if > 0 equal true) how many beepers in bag; if zero --> false */ void NibbleLeds(int value); /**< methode for the 4 (half byte) yellow LEDs at the back left side; ie. you can show how many beeper a robot has in his bag with: karel.NibbleLeds(karel.AnyBeeperInBag())*/ void TurnLedOn(int16_t led);/**< turns the specified one or more LEDs ON; description and name in const.h, such as LED_FL1 = 0x01; front LED white */