File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
libraries/MySensors/examples/SensebenderMicro Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
5858int measureCount = 0 ;
5959int sendBattery = 0 ;
6060boolean isMetric = true ;
61+ boolean highfreq = true ;
6162
6263// Storage of old measurements
6364float lastTemperature = -100 ;
@@ -73,12 +74,11 @@ RunningAverage raTemp(AVERAGES);
7374 *
7475 ****************************************************/
7576void setup () {
76- // clock_prescale_set(clock_div_8); // Switch to 1Mhz right after powerup.
7777
7878 pinMode (LED_PIN, OUTPUT);
7979 digitalWrite (LED_PIN, LOW);
8080
81- Serial.begin (19200 );
81+ Serial.begin (115200 );
8282 Serial.print (F (" Sensebender Micro FW " ));
8383 Serial.print (RELEASE);
8484 Serial.flush ();
@@ -131,6 +131,12 @@ void loop() {
131131 sendBattery ++;
132132 bool forceTransmit = false ;
133133
134+ if ((measureCount == 5 ) && highfreq)
135+ {
136+ clock_prescale_set (clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
137+ highfreq = false ;
138+ }
139+
134140 if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
135141 forceTransmit = true ;
136142 measureCount = 0 ;
You can’t perform that action at this time.
0 commit comments