Projects:Spacestate: verschil tussen versies

445 bytes toegevoegd ,  10 jan 2023
geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
 
Regel 19: Regel 19:
The state of the switch is measured by pulling the bottom to ground (green wire in the image to the right), and then measuring the voltage at the top using the D5 pin with an internal pull-up (yellow wire). This will be ground when the space is OPEN (the two sides connect), and internal pull-up when the space is CLOSED.
The state of the switch is measured by pulling the bottom to ground (green wire in the image to the right), and then measuring the voltage at the top using the D5 pin with an internal pull-up (yellow wire). This will be ground when the space is OPEN (the two sides connect), and internal pull-up when the space is CLOSED.


Then, the D2/D4/D5 control the LEDs in such a way that they switch colors using some nice animation when the state changes.
The LED board is powered by a 14V adapter (should be 12V but we didn't have any lying around), +12V (brown) to the 'P' pin of the LED board, and GND (blue) to the 'G' pin. They are connected to the 'in' array of pins, and then the 'out' array of the first LED board connects to the 'in' array of the second LED board.
 
Then, the Arduino's D2/D4/D5 pins are connected to the first LED board (then through the shift register and onwards to the second LED board) and control the LEDs in such a way that they switch colors using some nice animation when the state changes.


=Spacestate publishing=
=Spacestate publishing=