ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [gpiozero] RGBLED, MotionSensor
    ๋กœ๋ด‡๊ต์œก/4ํšŒ์ฐจ_๋ผ์ฆˆ๋ฒ ๋ฆฌGPIO 2021. 6. 25. 22:46

    1. RGBLED

    ์ถœ์ฒ˜: https://gpiozero.readthedocs.io

      RGBLED๋Š” ์„ธ ๊ฐœ์˜ ์‹ ํ˜ธ(R, G, B)๋ฅผ ์กฐํ•ฉํ•˜์—ฌ LED ์ƒ‰์„ ํ‘œํ˜„ํ•ฉ๋‹ˆ๋‹ค. F-F์„ ์„ ์ด์šฉํ•˜์—ฌ ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด GPIO์— ์—ฐ๊ฒฐํ•˜์—ฌ LED ์ƒ‰์„ ์ œ์–ดํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๋นจ๊ฐ„์„ ์„ R์— ๋…น์ƒ‰์„ ์„ G์— ํŒŒ๋ž€์„ ์„ B์— ์—ฐ๊ฒฐํ•˜๊ณ  ๊ฒ€์ •์„ ์„ Gnd(-)์— ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.

      ๊ทธ๋ฆฌ๊ณ  ์—ฐ๊ฒฐ๋œ ์„ ์€ ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด 34, 36, 38, 40๋ฒˆ์— ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค. ์‹ค์ œ R์„ ์€ GPIO 16๋ฒˆ, G์„ ์€ GPIO 20๋ฒˆ, B์„ ์€ GPIO 21๋ฒˆ์— ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค. GPIO ๋ฒˆํ˜ธ๋Š” LED๋ฅผ ์ œ์–ดํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ๊ผญ ๊ธฐ์–ตํ•ฉ๋‹ˆ๋‹ค.

     

    2. RGBLED ์ œ์–ดํ•˜๊ธฐ

     

     

     

     

     

     

     

    3. MotionSensor

    ์ถœ์ฒ˜: https://gpiozero.readthedocs.io

      ๋ชจ์…˜์„ผ์„œ์— ์—ฐ๊ฒฐ๋œ ๋ฐ˜๊ตฌ๋ฅผ ์ œ๊ฑฐํ•˜๋ฉด ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด VCC, OUT, GND๊ฐ€ ๋ชจ๋“ˆ์— ์ ํžŒ ๋ถ€๋ถ„์ด ๋ณด์ž…๋‹ˆ๋‹ค. VCC์— ๋นจ๊ฐ„์„ , OUT์— ํŒŒ๋ž€์„ , GND์— ๊ฒ€์ •์„ ์„ ์—ฐ๊ฒฐํ•˜์—ฌ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค. GPIO ๋ฒˆํ˜ธ๋Š” ๋ชจ์…˜์„ผ์„œ์˜ ์ž…๋ ฅ ๊ฐ’์„ ๋ฐ›์•„์˜ฌ ๋•Œ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ๊ผญ ๊ธฐ์–ตํ•ฉ๋‹ˆ๋‹ค.

      ๋ชจ์…˜์„ผ์„œ์— ์—ฐ๊ฒฐ๋œ ์„ ์„ ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด 2, 6, 12๋ฒˆ์— ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด์—์„œ ๋นจ๊ฐ„์„ ์€ 5v, ๊ฒ€์ •์„ ์€ Gnd, ํŒŒ๋ž€์„ ์€ GPIO 18๋ฒˆ์— ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.

     

    4. MotionSensor ์ž…๋ ฅ

     

     

    5. RGBLED - MotionSensor ์—ฐ๊ฒฐ ๋ฐ ํ”„๋กœ๊ทธ๋ž˜๋ฐ

     

    ๋Œ“๊ธ€

Designed by Tistory.