diff --git a/board/driver/mpx5100.h b/board/driver/mpx5100.h index 60f0925..c8774c8 100644 --- a/board/driver/mpx5100.h +++ b/board/driver/mpx5100.h @@ -2,7 +2,7 @@ #define MPX5100_H #include "../driver/adc.h" -#define MAX_PRESSURE 120 // Pressure in KPa +#define MAX_PRESSURE 120.0 // Pressure in KPa float pascal, adc_val; void getPascal(void); diff --git a/board/mpx5100/mpx5100.c b/board/mpx5100/mpx5100.c index 5259818..751bfd2 100644 --- a/board/mpx5100/mpx5100.c +++ b/board/mpx5100/mpx5100.c @@ -2,6 +2,6 @@ void getPascal(void) { adc_val = adcRead(); - pascal = ((adc_val / 1023) * MAX_PRESSURE) * 1000; + pascal = ((adc_val / 1023.0) * MAX_PRESSURE) * 1000.0; printf("%.2f Pa\n" pascal); }