So far I have working a srf08, a TMP102, a Magnevation dual motor driver board and an LCD display. I'd like some advice please on how to access the character data from the srf08. What I want to do is as the distance towards an object decreases I want to slow down the motors by modulating the pwm output then at a set value reverse the output. Can someone please offer some programming advice as to the best way of doing this? The next step for me is to add a compass module but I'm looking to have a some control of the motors first.
Kind Regards
Degs
So far I have working a srf08, a TMP102, a Magnevation dual motor driver board and an LCD display. I'd like some advice please on how to access the character data from the srf08. What I want to do is as the distance towards an object decreases I want to slow down the motors by modulating the pwm output then at a set value reverse the output. Can someone please offer some programming advice as to the best way of doing this? The next step for me is to add a compass module but I'm looking to have a some control of the motors first.
Kind Regards
Degs
Just noticed that on the lcd display I'm using (which is a Powertip 1604A) The 16th character a capital C remains on the display is this because I have to clear the screen between cycles?
Here's the code I'm using.
Just noticed that on the lcd display I'm using (which is a Powertip 1604A) The 16th character a capital C remains on the display is this because I have to clear the screen between cycles?
Here's the code I'm using.
<<code>>
#include "mbed.h"
#include "SRF08.h"
#include "TMP102.h"
#include "TextLCD.h"
SRF08 srf08(p9, p10, 0xE0);
TMP102 temperature(p9, p10, 0x90);
TextLCD lcd(p15, p16, p17, p18, p19, p20);
int main() {
while (1) {
lcd.printf("Range: %.2f cm\n",srf08.read());
lcd.printf("Temp: %.2f degC\n", temperature.read());
wait(5);
}
}
<</code>>
Loving this! Getting there following code is much clearer with the lcd.cls(); added
Incidentally as with the srf08 I found the Powertip only started working at the higher voltage as 3.3v from the mbed was to low.
Loving this! Getting there following code is much clearer with the lcd.cls(); added
Incidentally as with the srf08 I found the Powertip only started working at the higher voltage as 3.3v from the mbed was to low.
<<code>>
#include "mbed.h"
#include "SRF08.h"
#include "TMP102.h"
#include "TextLCD.h"
SRF08 srf08(p9, p10, 0xE0);
TMP102 temperature(p9, p10, 0x90);
TextLCD lcd(p15, p16, p17, p18, p19, p20);
int main() {
while (1) {
lcd.cls();
lcd.printf("Range: %.2f cm\n",srf08.read());
lcd.printf("Temp: %.2f degC\n", temperature.read());
wait(5);
}
}
<</code>>
Solved it by playing around as usual........to get the value from srf08 ............I can now use the float distance variable.
<<code>>
#include "mbed.h"
#include "SRF08.h"
#include "TMP102.h"
#include "TextLCD.h"
SRF08 srf08(p9, p10, 0xE0);
TMP102 temperature(p9, p10, 0x90);
TextLCD lcd(p15, p16, p17, p18, p19, p20);
float RangeReading()
{float value;
value = srf08.read();
return (value);}
int main() {float distance;
while (1) {lcd.cls();
distance = RangeReading();
// lcd.printf("Range: %.2f cm\n",srf08.read());
lcd.printf("Range: %2.f cm\n",distance);
lcd.printf("Temp: %.2f degC\n", temperature.read());
wait(5);
}
}
<</code>>
Important Information for this Arm website
This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.
Access Warning
You do not have the correct permissions to perform this operation.
So far I have working a srf08, a TMP102, a Magnevation dual motor driver board and an LCD display. I'd like some advice please on how to access the character data from the srf08. What I want to do is as the distance towards an object decreases I want to slow down the motors by modulating the pwm output then at a set value reverse the output. Can someone please offer some programming advice as to the best way of doing this? The next step for me is to add a compass module but I'm looking to have a some control of the motors first. Kind Regards Degs