Spark_FanMotor/FanMotor.ubl
2025-05-27 10:35:35 +03:00

20 lines
440 B
Plaintext

module FanMotor
author unknown
version 1 0
description ''
variables PWM
spec ' ' 'MotorFan' 'MotorFan _ _ _' 'num bool auto' 23 true 50
to MotorFan Pin State Speed {
if (and (Speed > 0) (Speed <= 100)) {
PWM = (absoluteValue (((Speed - 1) * ((1023 - 1) / 99)) + 1))
if (State == (booleanConstant true)) {
if (and (PWM > 0) (PWM < 1024)) {analogWriteOp Pin PWM}
} else {
digitalWriteOp Pin false
}
}
}