Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Bertl by
Revision 3:01b183fe8b41, committed 2015-03-26
- Comitter:
- bulmecisco
- Date:
- Thu Mar 26 13:06:00 2015 +0000
- Parent:
- 2:1cd559ff516b
- Child:
- 4:76acfddc26fb
- Commit message:
- I2C Updated for LED problems
Changed in this revision
| const.h | Show annotated file Show diff for this revision Revisions of this file |
| ur_Bertl.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/const.h Thu Mar 26 12:39:40 2015 +0000 +++ b/const.h Thu Mar 26 13:06:00 2015 +0000 @@ -8,7 +8,7 @@ */ #ifndef CONST_H #define CONST_H -//#define TIME +#define TIME const int MOVE=500; const int TURN=500;
--- a/ur_Bertl.cpp Thu Mar 26 12:39:40 2015 +0000
+++ b/ur_Bertl.cpp Thu Mar 26 13:06:00 2015 +0000
@@ -15,6 +15,10 @@
ur_Bertl::ur_Bertl() : _interrupt(P1_12) // left sensor P1_13
{
i2c.frequency(40000); // I2C Frequenz 40kHz
+ char init1[2] = {0x6, 0x00};
+ char init2[2] = {0x7, 0xff};
+ i2c.write(0x40, init1, 2);
+ i2c.write(0x40, init2, 2);
mg1 = mg2 = SPEED;
_interrupt.rise(this, &ur_Bertl::increment); // attach increment function of this counter instance ie. motor sensor
_count = 0;
@@ -24,6 +28,10 @@
ur_Bertl::ur_Bertl(PinName pin) : _interrupt(pin) // create the InterruptIn on the pin specified to Counter
{
i2c.frequency(40000); // I2C Frequenz 40kHz
+ char init1[2] = {0x6, 0x00};
+ char init2[2] = {0x7, 0xff};
+ i2c.write(0x40, init1, 2);
+ i2c.write(0x40, init2, 2);
mg1 = mg2 = SPEED;
_interrupt.rise(this, &ur_Bertl::increment); // attach increment function of this counter instance ie. motor sensor
_count = 0;
@@ -39,7 +47,7 @@
MotorR_FORWARD = MotorL_FORWARD = 1; // both motor forward ON
#ifdef TIME
wait_ms(MOVE);
-#else
+#else
while(_count < count+DISTANCE) {
//if(!FrontIsClear()) // more convenient because there are no accidents :-)
