blah

Dependencies:   mbed

Fork of adxl335_mbed_serial by Sumit Pandey

Files at this revision

API Documentation at this revision

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
--- 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;