|
34 | 34 |
|
35 | 35 |
|
36 | 36 | // BLOCK: LIS3DH initialize SCK(dropdown: pin), SDI(dropdown: pin), CS(dropdown: pin) |
| 37 | + // + Optional Temperature Calibration setting (appears when temp block added to project - see below) |
| 38 | + // + Optional Tilt Averaging Factor setting (appears when tilt block added to project - see below) |
37 | 39 |
|
38 | 40 | // Example: |
39 | 41 | LIS3DH initialize SCK 8, SDI 7, CS 6 |
|
43 | 45 |
|
44 | 46 |
|
45 | 47 |
|
46 | | - // BLOCK: LIS3DH read(dropdown: accelerometer 1000ths of g's ; adc mV) |
| 48 | + // BLOCK: LIS3DH read(dropdown: accelerometer 1000ths of g's ; adc mV ; tilt degrees) |
47 | 49 | *if accel* store X-axis in (item), store Y-axis in (item), store Z-axis in (item) |
48 | 50 | *if adc* store AD1 in (item), store AD2 in (item), store AD3 in (item) |
| 51 | + *if tilt* store X-axis in (item), store Y-axis in (item), store Z-axis in (item), store Motion Intensity in (item) |
49 | 52 |
|
50 | 53 | // Examples: (Assuming variables x, y, and z have been created with blocks) |
51 | 54 | LIS3DH read accelerometer (1000ths of g), store x axis in x, y axis in y, z axis in z |
52 | 55 | LIS3DH read adc (mV), store ad1 in x, ad2 in y, ad3 in z |
53 | 56 |
|
| 57 | + // Examples: (Assuming variables x, y, z and m have been created with blocks) |
| 58 | + LIS3DH read tilt (degrees), store x axis in x, y axis in y, z axis in z, motion intensity in m |
| 59 | + |
| 60 | + |
54 | 61 | // Emits: (assuming global pointer name is LIS3DH_1) |
55 | 62 | lis3dh_accel_mg(LIS3DH_1, &x, &y, &z); |
56 | 63 | lis3dh_adc_mV(LIS3DH_1, &x, &y, &z); |
| 64 | + lis3dh_tilt(LIS3DH_1, &x, &y, &z, &m); |
57 | 65 |
|
58 | 66 |
|
59 | | - |
60 | | - // BLOCK: Temperature calibrate units(dropdown: F or C), ambient temperature(actualTempC/actualTempF) |
| 67 | + |
| 68 | + // BLOCK: (OPTIONAL INIT ITEM - Appears when temperature read block added to project) |
| 69 | + // Set ambient temperature to ambient temperature(actualTempC/actualTempF), (dropdown: F or C) |
61 | 70 |
|
62 | 71 | // Examples: |
63 | | - Temperature calibrate units C, ambient temperature 23 |
64 | | - Temperature calibrate units F, ambient temperature 85 |
| 72 | + Set ambient temperature to 23, C |
| 73 | + Set ambient temperature to 85, F |
65 | 74 |
|
66 | 75 | // Emits: (assuming global pointer name is LIS3DH_1) |
67 | 76 | lis3dh_tempCal_C(LIS3DH_1, 23); |
|
70 | 79 |
|
71 | 80 |
|
72 | 81 | // BLOCK: Temperature read units(dropdown: F or C), store in (item) |
73 | | - * WARN! * MUST SET AMBIENT TEMPERATURE WITH CALIBRATION BLOCK |
| 82 | + * WARN! * MUST SET AMBIENT TEMPERATURE IN INIT BLOCK |
74 | 83 |
|
75 | 84 | // Examples: (Assuming variable t has been created with a block) |
76 | 85 | Temperature read units F, store in t |
77 | 86 |
|
78 | 87 | // Emits: (assuming global pointer name is LIS3DH_1) |
79 | 88 | t = lis3dh_temp_C(LIS3DH_1); |
80 | 89 | t = lis3dh_temp_F(LIS3DH_1); |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + // BLOCK: Tilt, store in (x, y, z, motion) |
| 95 | + * WARN! * MUST SET TILT AVERAGE FACTOR IN INIT BLOCK |
| 96 | + |
| 97 | + // Examples: (Assuming variables x, y, z, motion have been created with a block) |
| 98 | + LIS3DH read tilt angles x, y, z, motion, store in x, y, z, motion |
| 99 | + |
| 100 | + // Emits: (assuming global pointer name is LIS3DH_1) |
| 101 | + lis3dh_tilt(LIS3DH_1, x, y, z, motion); |
| 102 | + |
| 103 | + @details Angle to each axis in degrees, |
| 104 | + X relative to ground (-90 to 90) |
| 105 | + Y relative to ground (-90 to 90) |
| 106 | + Z relative to gravity (-90 to 90) |
| 107 | + Motion is the sum of g-force on all axis relative to gravity at ground level (1G). |
| 108 | + 0 is motionless, larger positve or negative values represent more intense motion. |
| 109 | + The motion value could be used on it's own for projects requiring vibration sensing. |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + // BLOCK: (OPTIONAL INIT ITEM - Appears when tilt read block added to project) |
| 114 | + // Set Tilt Averaging Factor value percent |
| 115 | + // |
| 116 | + // note for Block creator- default value is 100 which means averaging disabled. (ie. 100% of new data) |
| 117 | + |
| 118 | + // Examples: |
| 119 | + Set Tilt Averaging Factor to 100 |
| 120 | + Set Tilt Averaging Factor to 50 |
| 121 | + |
| 122 | + // Emits: (assuming global pointer name is LIS3DH_1) |
| 123 | + lis3dh_tiltConfig(LIS3DH_1, 100); |
| 124 | + lis3dh_tiltConfig(LIS3DH_1, 50); |
| 125 | + |
81 | 126 |
|
82 | 127 |
|
83 | 128 | */ |
|
0 commit comments