Skip to content

Commit

Permalink
Provided the requested changes: bullet points, omegas, and corrected …
Browse files Browse the repository at this point in the history
…image path. Added a second method to the LEDController to take care of Led2. Added LED_circuit.png to the img file.
  • Loading branch information
adelgadoj3 committed Nov 6, 2023
1 parent 9d755e1 commit c3e685b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@
@Controller("/led")
public class LEDController {
private final LEDHelper ledHelper;
private final LEDHelper ledHelper2;

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

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

ledHelper.deviceOff();
}
@Get("/led2")
public void checkLed2(){
ledHelper2.deviceOff();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,37 @@ https://github.com/oss-slu/Pi4Micronaut/edit/develop/micronautpi4j-utils/src/doc
This section provides details of the LED, including its components and assembly instructions.

===== Components
- 1 x RaspberryPi
- 1 x Breadboard
- 1 x T-Extension Board
- 1 x LED
- 2 x Jumper wires
- 1 x Resistor (220:omega:)
- Power source (appropriate voltage, typically 3.3V)
* 1 x RaspberryPi
* 1 x Breadboard
* 1 x T-Extension Board
* 1 x LED
* 2 x Jumper wires
* 1 x Resistor (220Ω)
* Power source (appropriate voltage, typically 3.3V)

===== 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 positive side
of the Breadboard.

* Place a single LED onto the Breadboard.
* The LED will have two pins, a cathode and an anode.
* Connect the cathode (short pin) of the LED to GPIO 17.
* Connect the anode (long pin) to a 220Ω resistor on the positive side of the Breadboard.
* Connect the other end of the resistor to 3.3V
* Connect a jumper wire from GPIO 17 to the cathode of the LED.
* Connect another jumper wire from 3.3V to the positive side of the Breadboard.
* Two jumper wires should be connected to separate positions on the Breadboard and T-Extension Board.


===== Circuit Diagram

image::https://github.com/oss-slu/Pi4Micronaut/tree/main/micronautpi4j-utils/src/docs/asciidoc/image49.png
image::https://github.com/oss-slu/Pi4Micronaut/tree/main/micronautpi4j-utils/src/docs/asciidoc/LED_circuit.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 is too dim: Resistor value may be too high. Verify you're using 220:omega: or adjust according to the power source your using
- LED is too dim: Resistor value may be too high. Verify you're using 220Ω or adjust according to the power source your using
as well as the LED specifications.

===== YAML
Expand All @@ -44,6 +49,13 @@ led: # <1>
shutdown: HIGH # <4>
initial: HIGH # <5>
provider: pigpio-digital-output # <6>
led2:
name: LED Output
address: 26
shutdown: HIGH
initial: HIGH
provider: pigpio-digital-output
----

===== Constructors
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c3e685b

Please sign in to comment.