feat: Map power input 0-100 to 70-140
This commit is contained in:
parent
9080317882
commit
2978b12af6
|
@ -182,8 +182,13 @@ void onMqttMessage(int messageSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void processControlCommand(int64_t num) {
|
void processControlCommand(int64_t num) {
|
||||||
Serial.print("[MEGA] Setting power: ");
|
// Map the input value (0-100) to the output range (70-140)
|
||||||
Serial.println(num);
|
long mappedValue = map(num, 0, 100, 70, 140);
|
||||||
|
|
||||||
analogWrite(OUTPUT_PIN, num);
|
Serial.print("[MEGA] Received power: ");
|
||||||
|
Serial.print(num);
|
||||||
|
Serial.print(", Mapped to: ");
|
||||||
|
Serial.println(mappedValue);
|
||||||
|
|
||||||
|
analogWrite(OUTPUT_PIN, mappedValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user