Skip to content

Commit d5c0f56

Browse files
Merge pull request #492 from oss-slu/422-various-issues-in-fan-documentation
Fix issues with fan documentation
2 parents 88edb11 + 8ea554d commit d5c0f56

2 files changed

Lines changed: 15 additions & 20 deletions

File tree

  • components/src/main/java/com/opensourcewithslu/components/controllers
  • pi4micronaut-utils/src/docs/asciidoc/components/outputComponents

components/src/main/java/com/opensourcewithslu/components/controllers/FanController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.micronaut.http.annotation.PathVariable;
88
import jakarta.inject.Named;
99

10+
//tag::ex[]
1011
@Controller("/fan")
1112
public class FanController {
1213
private final FanHelper fanHelper;
@@ -29,4 +30,5 @@ public void stop() {
2930
public void setSpeed(@PathVariable int speed) {
3031
fanHelper.setSpeed(speed);
3132
}
32-
}
33+
}
34+
//end::ex[]

pi4micronaut-utils/src/docs/asciidoc/components/outputComponents/fan.adoc

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This section provides comprehensive details about the Fan Controller component,
2121
* 1 x Fan (PWM-controlled or simple DC fan)
2222
* Jumper wires
2323
* Breadboard
24+
* T-extension board
2425
* Power source
2526

2627
===== Circuit Setup
@@ -46,38 +47,30 @@ The following YAML configuration is used to set up the Fan Controller in `applic
4647

4748
[source, yaml]
4849
----
49-
# tag::fan[]
50+
pwm:
5051
fan:
51-
controller:
52-
name: "Raspberry Pi Fan Controller"
53-
pwm-pin:
54-
name: Fan PWM Pin
55-
address: 18
56-
frequency: 25000
57-
shutdown: LOW
58-
initial: LOW
59-
provider: pigpio-pwm-output
60-
speed-settings:
61-
low: 30
62-
medium: 60
63-
high: 100
64-
# end::fan[]
52+
name: FAN
53+
address: 18
54+
pwm-type: SOFTWARE
55+
provider: pigpio-pwm
56+
initial: 0
57+
shutdown: 0
6558
----
6659

6760
===== Functionality
6861
The Fan Controller allows the Raspberry Pi to control the speed of a fan using PWM (Pulse Width Modulation) or simple on/off states. It supports predefined speed levels (e.g., low, medium, high).
6962

7063
===== Testing
7164

72-
To test the Fan Controller component with the Micronaut API, use the following commands:
65+
To test the Fan Controller component with the Micronaut API, use the following commands with our example controller:
7366

7467
[source, bash]
7568
----
76-
$ curl http://localhost:8080/fan/speed/high
69+
$ curl http://localhost:8080/fan
7770
----
78-
* `/speed/{level}` - Sets the fan speed to the specified level (`low`, `medium`, or `high`).
71+
* `/start` - Turns on the fan at full speed.
72+
* `/setSpeed/{speed}` - Sets the fan speed to the specified integer speed.
7973
* `/stop` - Turns off the fan.
80-
* `/shutdown` - Deactivates the fan completely and resets settings.
8174

8275
===== Troubleshooting
8376
- **Fan not working**: Verify the fan is connected to the correct GPIO pins and ensure power is supplied to the fan.

0 commit comments

Comments
 (0)