Lab4-01_measure_acceleration_lite
Dependencies: mbed HEPTA_SENSOR_lite HEPTA_EPS_lite
main.cpp@3:b5809ec2a8cd, 2021-08-24 (annotated)
- Committer:
- heptasat2021
- Date:
- Tue Aug 24 02:32:37 2021 +0000
- Revision:
- 3:b5809ec2a8cd
- Parent:
- 2:48467db233ff
For Hepta-Sat Lite
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
heptasat2021 | 0:da0f6aca15b8 | 1 | #include "mbed.h" |
heptasat2021 | 2:48467db233ff | 2 | #include "HEPTA_EPS.h" |
heptasat2021 | 2:48467db233ff | 3 | #include "HEPTA_SENSOR.h" |
heptasat2021 | 2:48467db233ff | 4 | HEPTA_EPS eps(PA_0,PA_4); |
heptasat2021 | 2:48467db233ff | 5 | HEPTA_SENSOR sensor(PA_7,PB_7,PB_6,0xD0); |
heptasat2021 | 0:da0f6aca15b8 | 6 | Serial pc(USBTX,USBRX,9600); |
heptasat2021 | 0:da0f6aca15b8 | 7 | int main() |
heptasat2021 | 2:48467db233ff | 8 | { |
heptasat2021 | 2:48467db233ff | 9 | float ax,ay,az; |
heptasat2021 | 2:48467db233ff | 10 | pc.printf("Acceleration Sensor\r\n"); |
heptasat2021 | 2:48467db233ff | 11 | eps.turn_on_regulator(); //Turn on 3.3V converter |
heptasat2021 | 3:b5809ec2a8cd | 12 | sensor.setup(); |
heptasat2021 | 2:48467db233ff | 13 | for(int i=0;i<50;i++){ |
heptasat2021 | 3:b5809ec2a8cd | 14 | // |
heptasat2021 | 2:48467db233ff | 15 | sensor.sen_acc(&ax,&ay,&az); |
heptasat2021 | 2:48467db233ff | 16 | pc.printf("%f,%f,%f\r\n",ax,ay,az); |
heptasat2021 | 2:48467db233ff | 17 | wait_ms(1000); |
heptasat2021 | 0:da0f6aca15b8 | 18 | } |
heptasat2021 | 0:da0f6aca15b8 | 19 | } |