Servo
Smart HomeThe house’s servo motor (the door); angles are in degrees, 0 to 180.
How you reach it
Section titled “How you reach it”The Servo class is reached through this attribute of home.
home.servo
Section titled “home.servo”Always there.
All the attributes of home are in its table.
Properties
Section titled “Properties”The angle last set, in degrees from 0 to 180.
angle: intRead only.
Used in examples: Hello, house
Methods
Section titled “Methods”set_angle(angle)
Section titled “set_angle(angle)”Turns the servo to an angle from 0 to 180 degrees at once.
set_angle(angle)Used in examples: Doorbell
move_to(angle, step, delay_ms)
Section titled “move_to(angle, step, delay_ms)”Turns the servo slowly to an angle (0 to 180 degrees), step degrees every delay_ms milliseconds.
move_to(angle, step: int, delay_ms: int)You can leave out step and delay_ms.
Used in examples: Hello, house
center()
Section titled “center()”Turns the servo to the middle, 90 degrees.
center()Used in examples: Hello, house
sweep(start, end, step, delay_ms, cycles)
Section titled “sweep(start, end, step, delay_ms, cycles)”Swings the servo from start to end degrees and back, cycles times, step degrees every delay_ms milliseconds.
sweep(start: int, end: int, step: int, delay_ms: int, cycles: int)You can leave out start, end, step, delay_ms and cycles.
Used in examples: Hello, house
move_to_min()
Section titled “move_to_min()”Turns the servo to its smallest angle (0 degrees unless the house set another limit).
move_to_min()Used in examples: Hello, house
move_to_max()
Section titled “move_to_max()”Turns the servo to its largest angle (180 degrees unless the house set another limit).
move_to_max()Used in examples: Hello, house