Bertl Robot with fiunctions

Dependencies:   mbed HCSR

Committer:
bulmecisco
Date:
Sun Jan 11 08:42:08 2015 +0000
Revision:
4:a975caedface
Child:
5:7b091d085c70
ur_Karel v 0.2 OK

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bulmecisco 4:a975caedface 1 /***********************************
bulmecisco 4:a975caedface 2 name: config.h v0.1
bulmecisco 4:a975caedface 3 author: PE HTL BULME
bulmecisco 4:a975caedface 4 email: pe@bulme.at
bulmecisco 4:a975caedface 5 description:
bulmecisco 4:a975caedface 6 Constants and wiring for ur_Karel
bulmecisco 4:a975caedface 7
bulmecisco 4:a975caedface 8
bulmecisco 4:a975caedface 9 ***********************************/
bulmecisco 4:a975caedface 10 #include "mbed.h"
bulmecisco 4:a975caedface 11
bulmecisco 4:a975caedface 12 #ifndef config_h
bulmecisco 4:a975caedface 13 #define config_h
bulmecisco 4:a975caedface 14 #define DEBUG 0
bulmecisco 4:a975caedface 15
bulmecisco 4:a975caedface 16 #if defined(DEBUG) && DEBUG > 0
bulmecisco 4:a975caedface 17 #define DEBUG_PRINT(fmt, args...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, \
bulmecisco 4:a975caedface 18 __FILE__, __LINE__, __func__, ##args)
bulmecisco 4:a975caedface 19 #else
bulmecisco 4:a975caedface 20 #define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */
bulmecisco 4:a975caedface 21 #endif
bulmecisco 4:a975caedface 22
bulmecisco 4:a975caedface 23 const int BTN_FLL = 0x80; // button front left outer
bulmecisco 4:a975caedface 24 const int BTN_FL = 0x04; // button front left
bulmecisco 4:a975caedface 25 const int BTN_FM = 0x01; // button front middle
bulmecisco 4:a975caedface 26 const int BTN_FR = 0x08; // button front right
bulmecisco 4:a975caedface 27 const int BTN_FRR = 0x40; // button front right outer
bulmecisco 4:a975caedface 28 const int BTN_BL = 0x10; // button back left
bulmecisco 4:a975caedface 29 const int BTN_BM = 0x02; // button back middle
bulmecisco 4:a975caedface 30 const int BTN_BR = 0x20; // button back right
bulmecisco 4:a975caedface 31
bulmecisco 4:a975caedface 32 const int LED_FL1 = 0x01; // front LED white
bulmecisco 4:a975caedface 33 const int LED_FL2 = 0x02; // front LED yellow
bulmecisco 4:a975caedface 34 const int LED_FR1 = 0x04; // front LED white
bulmecisco 4:a975caedface 35 const int LED_FR2 = 0x08; // front LED yellow
bulmecisco 4:a975caedface 36 const int LED_ALL_FRONT = 0x0F;
bulmecisco 4:a975caedface 37
bulmecisco 4:a975caedface 38 const int LED_BL1 = 0x20; // yellow LED back left outer
bulmecisco 4:a975caedface 39 const int LED_BL2 = 0x10; // red LED back left inner
bulmecisco 4:a975caedface 40 const int LED_BR1 = 0x80; // yellow LED back right outer
bulmecisco 4:a975caedface 41 const int LED_BR2 = 0x40; // red LED back right inner
bulmecisco 4:a975caedface 42 const int LED_ALL_BACK = 0xF0;
bulmecisco 4:a975caedface 43 const int LED_ALL = 0xFF;
bulmecisco 4:a975caedface 44
bulmecisco 4:a975caedface 45 const int addr = 0x40; // I2C-address PCA9555
bulmecisco 4:a975caedface 46
bulmecisco 4:a975caedface 47 Serial pc(USBTX, USBRX); // tx, rx
bulmecisco 4:a975caedface 48
bulmecisco 4:a975caedface 49 DigitalOut LED_D10(P1_8); // wiring LED D10 to D13
bulmecisco 4:a975caedface 50 DigitalOut LED_D11(P1_9);
bulmecisco 4:a975caedface 51 DigitalOut LED_D12(P1_10);
bulmecisco 4:a975caedface 52 DigitalOut LED_D13(P1_11);
bulmecisco 4:a975caedface 53
bulmecisco 4:a975caedface 54 DigitalOut MotorL_EN(p34); // wiring motor left
bulmecisco 4:a975caedface 55 DigitalOut MotorL_FORWARD(P1_1);
bulmecisco 4:a975caedface 56 DigitalOut MotorL_REVERSE(P1_0);
bulmecisco 4:a975caedface 57
bulmecisco 4:a975caedface 58 DigitalOut MotorR_EN(p36); // wiring motor right
bulmecisco 4:a975caedface 59 DigitalOut MotorR_FORWARD(P1_3);
bulmecisco 4:a975caedface 60 DigitalOut MotorR_REVERSE(P1_4);
bulmecisco 4:a975caedface 61
bulmecisco 4:a975caedface 62 I2C i2c(p28,p27);
bulmecisco 4:a975caedface 63 BusIn linesensor(p18, p16, p19, p17);
bulmecisco 4:a975caedface 64 DigitalIn SensorL(P1_12); // motor sensor left
bulmecisco 4:a975caedface 65 DigitalIn SensorR(P1_13); // motor sensor right
bulmecisco 4:a975caedface 66
bulmecisco 4:a975caedface 67 #endif