Bertl Robot with fiunctions

Dependencies:   mbed HCSR

Committer:
bulmecisco
Date:
Thu Feb 05 12:37:47 2015 +0000
Revision:
7:cb6947e1f1d3
Parent:
6:be710baf53ec
Child:
9:8e3392380915
FrontIsClearU for ultra sonic sensor

Who changed what in which revision?

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