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.
Dependencies: mbed
Diff: BreakS_Check.cpp
- Revision:
- 1:188a7eaafba6
- Child:
- 2:a43c7329a8e6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BreakS_Check.cpp Wed Nov 11 18:04:44 2020 +0000 @@ -0,0 +1,69 @@ +#include "mbed.h" +#include "math.h" + +CAN can(CANRD,CANTD); +DigitalOut canS(CANS,1); +DigitalOut LED_1(P2_4,0); +AnalogIn Ana0(P0_23); +AnalogIn Ana1(P0_24); +AnalogIn Ana2(P0_25); +AnalogIn Ana3(P0_26); + + + +int main() +{ + + wait(0.5); + can.frequency(250000); + + canS=0; + + + + //CANMessage cn(CAN_ID, can_msg, 8, CANData,CANExtended); + while(1) + { + float A0_Read = Ana0.read(); + int A0_Converted = floor(A0_Read*100); + + float A1_Read = Ana1.read(); + int A1_Converted = floor(A1_Read*100); + + float A2_Read = Ana2.read(); + int A2_Converted = floor(A2_Read*100); + + float A3_Read = Ana3.read(); + int A3_Converted = floor(A3_Read*100); + + char Air_Pressure_01 = A0_Converted; + char Air_Pressure_02 = A1_Converted; + char Air_Pressure_03 = A2_Converted; + char Air_Pressure_04 = A3_Converted; + + + //Air_Pressure_01 = 0x15; + + //printf("AIR: %x \n\r",Air_Pressure_01); + //printf("AIR: %f \n\r",A0_Read*20); + + char can_msg[8]; + can.reset(); + can_msg[0] = Air_Pressure_01; + can_msg[1] = Air_Pressure_02; + can_msg[2] = Air_Pressure_03; + can_msg[3] = Air_Pressure_04; + can_msg[4] = 0xff; + can_msg[5] = 0xff; + can_msg[6] = 0xff; + can_msg[7] = 0xff; + + int CAN_ID= 0x18ff4103; + + can.write(CANMessage(CAN_ID, can_msg, 8, CANData,CANExtended)); + LED_1 = !LED_1; + //wait(1); + wait(0.01); + + } +} \ No newline at end of file