Orodha ya maudhui:

Arduino: Potentio Kiashiria Matumizi Matrix Led MAX7219: 4 Hatua
Arduino: Potentio Kiashiria Matumizi Matrix Led MAX7219: 4 Hatua

Video: Arduino: Potentio Kiashiria Matumizi Matrix Led MAX7219: 4 Hatua

Video: Arduino: Potentio Kiashiria Matumizi Matrix Led MAX7219: 4 Hatua
Video: Using HT16K33 4 digit seven segment display with ESP8266 NodeMCU and D1 Mini 2024, Novemba
Anonim
Arduino: Potentio Kiashiria Matumizi Led Ledrix MAX7219
Arduino: Potentio Kiashiria Matumizi Led Ledrix MAX7219

Katika mafunzo ya awali nimefanya dalili ya potentiometer kutumia saizi za neo za pete za RGB zilizoongozwa. unaweza kuiona katika nakala hii "Kiashiria cha Potentio Hutumia RGB Neopixel"

Na leo nitaonyesha kiashiria cha potentiator kwa kutumia onyesho la metri iliyoongozwa na MAX7219.

Fuata hatua zifuatazo ili kuifanya.

Hatua ya 1: Vipengele vinavyohitajika

Vipengele vinavyohitajika
Vipengele vinavyohitajika
Vipengele vinavyohitajika
Vipengele vinavyohitajika
Vipengele vinavyohitajika
Vipengele vinavyohitajika

Vipengele vinavyohitajika:

  • Arduino nano
  • Potentiometer
  • Uonyesho wa Matrix ya Max7219
  • Jumper Wire
  • Bodi ya Mradi
  • Mini mini ya USB
  • kompyuta ndogo

Maktaba Inayohitajika

Kudhibiti

Hatua ya 2: Mpango

Mpango
Mpango
Mpango
Mpango
Mpango
Mpango

Ili kukusanya vifaa angalia mchoro wa skimu hapo juu, unaweza pia kuona habari hapa chini:

Arduino kwa Led & potentio

+ 5V ==> VCC & 3. Potentio

GND ==> GND & 1. Potentio

D6 ==> DataIn

D7 ==> CLK

D8 ==> CS / Mzigo

Hatua ya 3: Programu

Kupanga programu
Kupanga programu

Tumia nambari hapa chini kutengeneza:

# pamoja na "LedControl.h"

/*

Sasa tunahitaji LedControl kufanya kazi nayo. Nambari hizi za pini labda hazitafanya kazi na vifaa vyako. * /

LedControl lc = LedControl (6, 7, 8, 1);

kuchelewesha muda mrefu = 100;

usanidi batili () {

kuzima kwa lc (0, uwongo); lc.setIntensity (0, 8); lc Onyesha wazi (0); } kitanzi batili () {int val = analogRead (A0); val = ramani (val, 0, 1023, 0, 8);

ikiwa (val == 1)

{

lc.setRow (0, 0, B10000000);

}

ikiwa (val == 2)

{lc.setRow (0, 0, B10000000); lc. RetRow (0, 1, B10000000); } ikiwa (val == 3) {

lc.setRow (0, 0, B10000000);

lc. RetRow (0, 1, B10000000); lc. RetRow (0, 2, B10000000); } ikiwa (val == 4) {

lc.setRow (0, 0, B10000000);

lc. RetRow (0, 1, B10000000); lc. RetRow (0, 2, B10000000); lc. RetRow (0, 3, B10000000); } ikiwa (val == 5) {

lc.setRow (0, 0, B10000000);

lc. RetRow (0, 1, B10000000); lc. RetRow (0, 2, B10000000); lc. RetRow (0, 3, B10000000); lc. RetRow (0, 4, B10000000); } ikiwa (val == 6) {lc.setRow (0, 0, B10000000); lc. Retow (0, 1, B10000000); lc. RetRow (0, 2, B10000000); lc. RetRow (0, 3, B10000000); lc. RetRow (0, 4, B10000000); lc. RetRow (0, 5, B10000000); } ikiwa (val == 7) {lc.setRow (0, 0, B10000000); lc. Retow (0, 1, B10000000); lc. RetRow (0, 2, B10000000); lc. RetRow (0, 3, B10000000); lc. RetRow (0, 4, B10000000); lc. RetRow (0, 5, B10000000); lc. Retow (0, 6, B10000000); } ikiwa (val == 8) {lc.setRow (0, 0, B10000000); lc. RetRow (0, 1, B10000000); lc. RetRow (0, 2, B10000000); lc. RetRow (0, 3, B10000000); lc. RetRow (0, 4, B10000000); lc. RetRow (0, 5, B10000000); lc. Retow (0, 6, B10000000); lc. RetRow (0, 7, B10000000); } lc Onyesha wazi (0); }

Hatua ya 4: Matokeo

Mara tu ikipangwa, matokeo yataonekana kama hii.

Ikiwa potentio imezungushwa kulia, LED za moja kwa moja zitazidi kufuata idadi ya zamu.

Ikiwa sufuria imegeuzwa kushoto, LED ya moja kwa moja itakuwa chini na kidogo kufuatia nguvu ya kuzunguka.

Ilipendekeza: