When I try typecasting a float to int I get nonsense numbers like -0.000000 and mbed is not recognizing round trunc floor and the and so on as functions. Anyone have any Ideas whats going on? I'm running on a FRDM-KL25Z if that helps. Also the Blue LED lights up when I try to do this.
here is my code
- include "mbed.h"
- include "math.h"
- include "BMP085.h"
BMP085 barom(PTC9, PTC8);
Serial pc(USBTX, USBRX);
DigitalOut myled(LED_GREEN);
int main() {
barom.init();
while (true) {
wait(2);
pc.printf("%d\r\n", barom.get_temperature());
pc.printf("%d\r\n", barom.get_pressure());
pc.printf("%f\r\n", (int)(barom.get_altitude_ft()));
pc.printf("%f\r\n", barom.get_altitude_ft());
myled = !myled;
}
}
Hello all,
I am trying to use round in mbed not sure why is not working.
I am porting some code from arduino:
#include "mbed.h"
void myFunction( int myInt, long time){
int _rounded = round( time / myInt);
}
I get a: Identifier round not defined.
mbed.h already includes math.h and stdio.h no?
Thank you!
Angel