Liyou Zhou
/
wheel_speed_sensor_board
blah
Fork of adxl335_mbed_serial by
Revision 4:18a440b7b1a5, committed 2013-12-12
- Comitter:
- lz307
- Date:
- Thu Dec 12 16:01:16 2013 +0000
- Parent:
- 3:b5f6dccb2c08
- Commit message:
- Tunable parameters now are at the start of the file.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b5f6dccb2c08 -r 18a440b7b1a5 main.cpp --- a/main.cpp Thu Dec 12 15:54:29 2013 +0000 +++ b/main.cpp Thu Dec 12 16:01:16 2013 +0000 @@ -12,6 +12,8 @@ DigitalOut redundant_2(p16); Ticker ticker; float acc_sampling_time = 1; // time between each sample in s +float offset_x=0,offset_y=0,offset_z=0; // calibration offsets +float scale_factor = 100; // calibration scale factor int no_of_spokes = 5; // 5 readings per rev int count_delay_time = 10; // minimum interval between spikes in ms @@ -88,15 +90,13 @@ can_msg_2.fl_data[0] = rpm_bl; can_msg_2.fl_data[1] = 0; can.write( CANMessage(can_id_rpm_front, can_msg_1.can_string, 8) ); - can.write( CANMessage(can_id_rpm_back, can_msg_2.can_string, 8) ); + can.write( CANMessage(can_id_rpm_back, can_msg_2.can_string, 8) ); } } void read_accelerometer_and_send() { - float offset_x=0,offset_y=0,offset_z=0; // variables offsets - float scale_factor = 100; // variable scale factor float x=0,y=0,z=0; // variables for x,y,z axes x=(inputx+offset_x)*scale_factor; y=(inputy+offset_y)*scale_factor;