File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -2453,6 +2453,53 @@ void Logger::Barometer_BMP180(){
2453
2453
}
2454
2454
else Serial.println (F (" BMP180 init fail" ));
2455
2455
}
2456
+
2457
+ void Logger::_sensor_function_template (int pin, float param1, float param2,
2458
+ bool flag){
2459
+ /* *
2460
+ * @brief
2461
+ * Function to help lay out a new sensor interface.
2462
+ * This need not be "void": it may return a value as well.
2463
+ *
2464
+ * @details
2465
+ * Details about sensor go here
2466
+ *
2467
+ * @param pin You often need to specify interface pins
2468
+ *
2469
+ * @param param1 A variable for the sensor or to interpret its value
2470
+ *
2471
+ * @param param2 A variable for the sensor or to interpret its value
2472
+ *
2473
+ * @param flag Something that helps to set an option
2474
+ *
2475
+ * Example (made up):
2476
+ * ```
2477
+ * logger.Example(A2, 1021.3, 15.2, True);
2478
+ * ```
2479
+ *
2480
+ */
2481
+
2482
+ float Vout_normalized_analog_example = analogReadOversample (xPin, \
2483
+ ADC_resolution_nbits) / 1023 .)
2484
+
2485
+ float Some_variable = Vout_normalized_analog_example * param1 / param2
2486
+ if (flag){
2487
+ Some_variable /= 2 .
2488
+ }
2489
+
2490
+ // /////////////
2491
+ // SAVE DATA //
2492
+ // /////////////
2493
+
2494
+ // SD write
2495
+ datafile.print (Some_variable);
2496
+ datafile.print (F (" ," ));
2497
+
2498
+ // Echo to serial
2499
+ Serial.print (Some_variable);
2500
+ Serial.print (F (" ," ));
2501
+
2502
+ }
2456
2503
2457
2504
2458
2505
void Logger::sleepNow_nap () // here we put the arduino to sleep between interrupt readings
Original file line number Diff line number Diff line change @@ -148,6 +148,8 @@ class Logger {
148
148
void Pyranometer (int analogPin, float raw_mV_per_W_per_m2, \
149
149
float gain, float V_ref, uint8_t ADC_resolution_nbits=14 );
150
150
void Barometer_BMP180 ();
151
+ void _sensor_function_template (int pin, float param1, float param2, \
152
+ bool flag=false );
151
153
152
154
// Sensors - triggered
153
155
// Camera on/off function; decision made in end-user Arduino script
You can’t perform that action at this time.
0 commit comments