Skip to content

Commit d5becd5

Browse files
committed
Corrected 1Mhz operating frequency
1 parent bf7372e commit d5becd5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

libraries/MySensors/examples/SensebenderMicro/SensebenderMicro.ino

+8-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
5858
int measureCount = 0;
5959
int sendBattery = 0;
6060
boolean isMetric = true;
61+
boolean highfreq = true;
6162

6263
// Storage of old measurements
6364
float lastTemperature = -100;
@@ -73,12 +74,11 @@ RunningAverage raTemp(AVERAGES);
7374
*
7475
****************************************************/
7576
void 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;

0 commit comments

Comments
 (0)