Skip to content

Commit

Permalink
Made the requested changes to the .adoc file (Testing section with cu…
Browse files Browse the repository at this point in the history
…rl commands) & added path for the controller. Also created the LEDController.java file in the controllers directory.
  • Loading branch information
adelgadoj3 committed Nov 6, 2023
1 parent bc47e3b commit 9d755e1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.opensourcewithslu.components.controllers;

import com.opensourcewithslu.outputdevices.LEDHelper;
import com.pi4j.io.gpio.digital.DigitalOutput;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import jakarta.inject.Named;


@Controller("/led")
public class LEDController {
private final LEDHelper ledHelper;

public LEDController(@Named("Led")DigitalOutput led){
this.ledHelper = new LEDHelper(led);
}

@Get("/led")
public void checkLed(){
/*deviceOff method turns on the LED after checking the output. This
will turn on the LED
*/

ledHelper.deviceOff();
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
==== LED
:icons: //Icons attribute is needed for the Omega symbol
:omega: //Attribute is needed for the Omega symbol
[.text-right]
https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/docs/asciidoc/components/outputComponents/led.adoc[Improve this doc]

===== Overview
This document provides details of the LED, including its components and assembly instructions.
This section provides details of the LED, including its components and assembly instructions.

===== Components
- 1 x RaspberryPi
Expand All @@ -18,17 +18,20 @@ This document provides details of the LED, including its components and assembly
===== Assembly
- To assemble, place a single LED onto the Breadboard. The LED will have two pins, a cathode and an anode. Place a 220:omega: resistor on the positive side of the Breadboard to the anode (the long pin of the LED),
then the resistor to 3.3V, and connect the cathode (the short pin) of the LED to GPIO 17 of the RaspberryPi. In addition, there need to be two jumper cables connected to
separate positions on the Breadboard and T-Extension Board. The first will go from the GPIO17 pin to the cathode. Then place the second wire from the 3.3V pin to the positve side
separate positions on the Breadboard and T-Extension Board. The first will go from the GPIO17 pin to the cathode. Then place the second wire from the 3.3V pin to the positive side
of the Breadboard.


===== Circuit Diagram

image::https://github.com/oss-slu/Pi4Micronaut/tree/main/micronautpi4j-utils/src/docs/asciidoc/image49.png

===== Testing

Use: `curl http://localhost:8080/LED/LEDOn` to test the component. This will cause the LED to light.

===== Troubleshooting
- LED not lighting: Check the connections, and ensure the LED is placed correctly. Double check the power source.
- LED not lighting: Check the connections, and ensure the LED is placed correctly. Double-check the power source.
- LED is too dim: Resistor value may be too high. Verify you're using 220:omega: or adjust according to the power source your using
as well as the LED specifications.

Expand Down Expand Up @@ -60,3 +63,6 @@ include::../../../../../../micronautpi4j-utils/src/main/java/com/opensourcewiths
===== An Example Controller

[source, java]
----
include:: ../../../../../../components/src/main/java/com/opensourcewithslu/components/controllers/LEDController.java[tags=method]
----

0 comments on commit 9d755e1

Please sign in to comment.