Übung
Fork of Bertl by
config.h@15:43d6a7e6e64a, 2015-05-08 (annotated)
- Committer:
- bulmecisco
- Date:
- Fri May 08 08:39:12 2015 +0000
- Revision:
- 15:43d6a7e6e64a
- Parent:
- 13:3ce84646fd74
Version 3.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bulmecisco | 0:66e9a0afcbd6 | 1 | /*! \file config.h |
bulmecisco | 0:66e9a0afcbd6 | 2 | \brief A Documented file. |
bulmecisco | 13:3ce84646fd74 | 3 | * name: config.h Version: 3.0 \n |
bulmecisco | 4:76acfddc26fb | 4 | * author: PE HTL BULME \n |
bulmecisco | 4:76acfddc26fb | 5 | * email: pe@bulme.at \n |
bulmecisco | 0:66e9a0afcbd6 | 6 | * description: |
bulmecisco | 0:66e9a0afcbd6 | 7 | * Wiring for ur_Bertl The Robot |
bulmecisco | 0:66e9a0afcbd6 | 8 | */ |
bulmecisco | 0:66e9a0afcbd6 | 9 | |
bulmecisco | 0:66e9a0afcbd6 | 10 | #include "mbed.h" |
bulmecisco | 0:66e9a0afcbd6 | 11 | #include "hcsr04.h" |
bulmecisco | 0:66e9a0afcbd6 | 12 | #include "const.h" |
bulmecisco | 0:66e9a0afcbd6 | 13 | |
bulmecisco | 0:66e9a0afcbd6 | 14 | #ifndef CONFIG_H |
bulmecisco | 0:66e9a0afcbd6 | 15 | #define CONFIG_H |
bulmecisco | 0:66e9a0afcbd6 | 16 | /*! \def DEBUG |
bulmecisco | 0:66e9a0afcbd6 | 17 | \brief Turns debugging infos off (0) and on (3) which are send to serial pc.uart */ |
bulmecisco | 0:66e9a0afcbd6 | 18 | #define DEBUG 0 |
bulmecisco | 13:3ce84646fd74 | 19 | //#define FRONTBUTTON /**< Error shutoff if Bertl moves against a wall*/ |
bulmecisco | 13:3ce84646fd74 | 20 | #define HCSR /**< if ultrsonic is installed*/ |
bulmecisco | 15:43d6a7e6e64a | 21 | #define MOTORENC P1_13 /**< P1_12: left encoder P1_13: rigth encoder (motor) */ |
bulmecisco | 0:66e9a0afcbd6 | 22 | |
bulmecisco | 12:cedc088eaf05 | 23 | 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 */ |
bulmecisco | 0:66e9a0afcbd6 | 24 | DigitalOut LED_D10(P1_8); /**< wiring first LED_D10 */ |
bulmecisco | 0:66e9a0afcbd6 | 25 | DigitalOut LED_D11(P1_9); /**< wiring second LED_D11 */ |
bulmecisco | 0:66e9a0afcbd6 | 26 | DigitalOut LED_D12(P1_10); /**< wiring thired LED_D12 */ |
bulmecisco | 0:66e9a0afcbd6 | 27 | DigitalOut LED_D13(P1_11); /**< wiring fourth LED_D13 */ |
bulmecisco | 0:66e9a0afcbd6 | 28 | |
bulmecisco | 0:66e9a0afcbd6 | 29 | DigitalOut LED_blue(P1_28); /**< all blue LEDs are on Port 1_28 */ |
bulmecisco | 0:66e9a0afcbd6 | 30 | |
bulmecisco | 0:66e9a0afcbd6 | 31 | DigitalOut RGB_blue(P1_24); /**< RGB blue component of the color uP -> Port 1_24 */ |
bulmecisco | 0:66e9a0afcbd6 | 32 | DigitalOut RGB_red(P1_23); /**< RGB red component of the color uP -> Port 1_23 */ |
bulmecisco | 0:66e9a0afcbd6 | 33 | DigitalOut RGB_green(P1_25); /**< RGB green component of the color uP -> Port 1_25 */ |
bulmecisco | 0:66e9a0afcbd6 | 34 | |
bulmecisco | 0:66e9a0afcbd6 | 35 | //------------------ CHANGE ONLY IF NESSESARY ------------------------------------- |
bulmecisco | 0:66e9a0afcbd6 | 36 | |
bulmecisco | 15:43d6a7e6e64a | 37 | DigitalOut MotorL_EN(p34); // wiring motor left |
bulmecisco | 15:43d6a7e6e64a | 38 | DigitalOut MotorL_FORWARD(P1_1); // change to P1_0 for Bertl 2015 |
bulmecisco | 15:43d6a7e6e64a | 39 | DigitalOut MotorL_REVERSE(P1_0); // change to P1_1 for Bertl 2015 |
bulmecisco | 0:66e9a0afcbd6 | 40 | |
bulmecisco | 15:43d6a7e6e64a | 41 | DigitalOut MotorR_EN(p36); // wiring motor right |
bulmecisco | 15:43d6a7e6e64a | 42 | DigitalOut MotorR_FORWARD(P1_3); // change to P1_4 for Bertl 2015 |
bulmecisco | 15:43d6a7e6e64a | 43 | DigitalOut MotorR_REVERSE(P1_4); // change to P1_3 for Bertl 2015 |
bulmecisco | 0:66e9a0afcbd6 | 44 | |
bulmecisco | 0:66e9a0afcbd6 | 45 | I2C i2c(p28,p27); |
bulmecisco | 0:66e9a0afcbd6 | 46 | BusIn linesensor(p18, p16, p19, p17); |
bulmecisco | 0:66e9a0afcbd6 | 47 | DigitalIn SensorL(P1_12); /**< motor sensor left on Port P1_12 */ |
bulmecisco | 0:66e9a0afcbd6 | 48 | DigitalIn SensorR(P1_13); /**< motor sensor right on Port P1_13 */ |
bulmecisco | 0:66e9a0afcbd6 | 49 | HCSR04 usensor(p21,p22); // HC-SR04 ultrasonic sensor |
bulmecisco | 0:66e9a0afcbd6 | 50 | PwmOut mg1(P1_15); // PWM out motor left |
bulmecisco | 0:66e9a0afcbd6 | 51 | PwmOut mg2(P0_21); // PWM out motor right |
bulmecisco | 0:66e9a0afcbd6 | 52 | |
bulmecisco | 0:66e9a0afcbd6 | 53 | Serial pc(USBTX, USBRX); // tx, rx |
bulmecisco | 0:66e9a0afcbd6 | 54 | |
bulmecisco | 15:43d6a7e6e64a | 55 | // Bertl 2015 |
bulmecisco | 15:43d6a7e6e64a | 56 | DigitalOut MotorSpg (p30); |
bulmecisco | 15:43d6a7e6e64a | 57 | DigitalOut IncrementalgeberSpg (P1_7); |
bulmecisco | 15:43d6a7e6e64a | 58 | DigitalOut LinienSensorSpg (P1_6); |
bulmecisco | 15:43d6a7e6e64a | 59 | |
bulmecisco | 0:66e9a0afcbd6 | 60 | #if defined(DEBUG) && DEBUG > 0 |
bulmecisco | 0:66e9a0afcbd6 | 61 | #define DEBUG_PRINT(fmt, args...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, \ |
bulmecisco | 0:66e9a0afcbd6 | 62 | __FILE__, __LINE__, __func__, ##args) |
bulmecisco | 0:66e9a0afcbd6 | 63 | #else |
bulmecisco | 0:66e9a0afcbd6 | 64 | #define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */ |
bulmecisco | 0:66e9a0afcbd6 | 65 | #endif |
bulmecisco | 0:66e9a0afcbd6 | 66 | |
bulmecisco | 0:66e9a0afcbd6 | 67 | #endif |