TP ENSA Bus CAN
Revision 1:db4df4165d4a, committed 2019-12-25
- Comitter:
- bouaziz
- Date:
- Wed Dec 25 15:12:39 2019 +0000
- Parent:
- 0:c06e6d1972d6
- Child:
- 2:18732d3fb3a1
- Commit message:
- Version ENSA
Changed in this revision
--- a/MS5607.lib Tue Jul 03 08:58:18 2012 +0000 +++ b/MS5607.lib Wed Dec 25 15:12:39 2019 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/yamaguch/code/MS5607/#5760862143d1 +http://mbed.org/users/yamaguch/code/MS5607/#b7fffbf481e2
--- a/main.cpp Tue Jul 03 08:58:18 2012 +0000
+++ b/main.cpp Wed Dec 25 15:12:39 2019 +0000
@@ -1,13 +1,23 @@
#include "mbed.h"
-//#include "MS5607SPI.h"
#include "MS5607I2C.h"
+CAN can1(p9, p10);
+
+DigitalOut led1(LED1);
+CANMessage can_MsgRx;
int main() {
- //MS5607SPI ms5607(p11, p12, p13, p10);
- MS5607I2C ms5607(p9, p10, false);
-
- ms5607.printCoefficients();
- printf("Pressure = %.0f Pa\n", ms5607.getPressure());
- printf("Temperature = %.2f degC\n", ms5607.getTemperature());
- printf("Altitude = %.2f m\n", ms5607.getAltitude());
+
+ can1.frequency(1000000); //bus can 1Mbits/s
+ MS5607I2C ms5607(p28, p27, false); // capteur
+ ms5607.init(15.0,101325.); // initialiser capteur
+ led1=1;
+ // ms5607.printCoefficients();
+ can_MsgRx.id=0x1X0; // X compris entre 0 et 7 voir avec l'enseignant
+ can_MsgRx.len=4; // trame à 4 octets
+ while(1){ // boucle infinie
+ printf("P= %5.0f Pa ", ms5607.getPressure());
+ printf("T= %2.2f ", ms5607.getTemperature());
+ printf("Alt= %.2f m\n", ms5607.getAltitude());
+ wait(1);
+ }
}
\ No newline at end of file
--- a/mbed.bld Tue Jul 03 08:58:18 2012 +0000 +++ b/mbed.bld Wed Dec 25 15:12:39 2019 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479 +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912 \ No newline at end of file