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:
5:6b667e2cb800
Parent:
4:76acfddc26fb
Child:
7:e7f74f072564
diff -r 76acfddc26fb -r 6b667e2cb800 ur_Bertl.h
--- a/ur_Bertl.h	Tue Apr 07 12:30:39 2015 +0000
+++ b/ur_Bertl.h	Fri Apr 10 07:12:07 2015 +0000
@@ -152,6 +152,7 @@
     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);
     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 */