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: config.h
- Revision:
- 15:43d6a7e6e64a
- Parent:
- 13:3ce84646fd74
- Child:
- 18:e9bb4513ae3a
diff -r 3ce84646fd74 -r 43d6a7e6e64a config.h --- a/config.h Mon Apr 27 13:13:45 2015 +0000 +++ b/config.h Fri May 08 08:39:12 2015 +0000 @@ -18,7 +18,7 @@ #define DEBUG 0 //#define FRONTBUTTON /**< Error shutoff if Bertl moves against a wall*/ #define HCSR /**< if ultrsonic is installed*/ -#define MOTORENC P1_12 /**< P1_12: left encoder P1_13: rigth encoder (motor) */ +#define MOTORENC P1_13 /**< P1_12: left encoder P1_13: rigth encoder (motor) */ BusOut NibbleLEDs(P1_8, P1_9, P1_10, P1_11); /**< 4 yellow LEDs as a bus defined; use it i.e.: karel.NibbleLeds(karel.GetLineValues()); to show line sensor values */ DigitalOut LED_D10(P1_8); /**< wiring first LED_D10 */ @@ -34,13 +34,13 @@ //------------------ CHANGE ONLY IF NESSESARY ------------------------------------- -DigitalOut MotorL_EN(p34); // wiring motor left -DigitalOut MotorL_FORWARD(P1_1); -DigitalOut MotorL_REVERSE(P1_0); +DigitalOut MotorL_EN(p34); // wiring motor left +DigitalOut MotorL_FORWARD(P1_1); // change to P1_0 for Bertl 2015 +DigitalOut MotorL_REVERSE(P1_0); // change to P1_1 for Bertl 2015 -DigitalOut MotorR_EN(p36); // wiring motor right -DigitalOut MotorR_FORWARD(P1_3); -DigitalOut MotorR_REVERSE(P1_4); +DigitalOut MotorR_EN(p36); // wiring motor right +DigitalOut MotorR_FORWARD(P1_3); // change to P1_4 for Bertl 2015 +DigitalOut MotorR_REVERSE(P1_4); // change to P1_3 for Bertl 2015 I2C i2c(p28,p27); BusIn linesensor(p18, p16, p19, p17); @@ -52,6 +52,11 @@ Serial pc(USBTX, USBRX); // tx, rx +// Bertl 2015 +DigitalOut MotorSpg (p30); +DigitalOut IncrementalgeberSpg (P1_7); +DigitalOut LinienSensorSpg (P1_6); + #if defined(DEBUG) && DEBUG > 0 #define DEBUG_PRINT(fmt, args...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, \ __FILE__, __LINE__, __func__, ##args)