Cov txheej txheem:

CSCI-1200 Qhov Kev Xeem Xeem zaum kawg 1: 3 Cov Kauj Ruam
CSCI-1200 Qhov Kev Xeem Xeem zaum kawg 1: 3 Cov Kauj Ruam

Video: CSCI-1200 Qhov Kev Xeem Xeem zaum kawg 1: 3 Cov Kauj Ruam

Video: CSCI-1200 Qhov Kev Xeem Xeem zaum kawg 1: 3 Cov Kauj Ruam
Video: Mathematics with Python! Sequences 2024, Hlis ntuj nqeg
Anonim
CSCI-1200 Qhov Kev Xeem Kawg Zaum Kawg 1
CSCI-1200 Qhov Kev Xeem Kawg Zaum Kawg 1

Hauv qhov kev sim no koj yuav siv lub zog ntsuas kom qhib thiab tua 5 LEDs. Cov LEDs yuav suav nrog qhov ploj mus thiaj li xaiv LED yog qhov ci tshaj plaws, thaum lwm LEDs tau tawm los yog dimmer me ntsis.

Kho vajtse xav tau rau txoj haujlwm no:

1. Arduino Uno

2. Potentiometer

3.5 LEDs

4. Cov qhob cij

5. Cov xov hlau/Cov Txuas Txuas

Kauj Ruam 1: Ntxiv Tsib LEDs

Ntxiv Tsib LEDs
Ntxiv Tsib LEDs

Rau txoj haujlwm no, 5 LEDs yuav txuas rau hauv daim phiaj. Cov LEDs yuav txuas nrog cov chaw nres nkoj ntawm Arduino uas siv Pulse Width Modulation (PWM). Cov chaw nres nkoj nrog PWM yog: 11, 10, 9, 6, thiab 5. PWM yog qhov sib piv tso tawm hauv thaj tsam 0-255 uas tau hloov pauv mus rau lub teeb liab.

Txhawm rau txuas LED mus rau lub khob cij:

1. Muab lub LED tso rau ntawm daim ntawv ci

2. Hauv daim duab, cov hauv paus hauv qab (-) ntawm LED tau muab tso ncaj qha rau hauv cov tsheb nqaj hlau hauv av ntawm lub khob cij. Ib lub xaim jumper kuj tseem tuaj yeem siv hauv cov kauj ruam no txhawm rau txuas LED mus rau txhua txoj haujlwm ntawm lub khob cij.

3. Txuas lub jumper hlau los ntawm qhov chaw nres nkoj ntawm Arduino mus rau lub khob cij. Muab 220 Ω (ohm) resistor nyob rau hauv kab ib yam li cov xaim thiab txuas nws mus rau sab saum toj txhuas (+) ntawm LED. Rau qhov haujlwm no, LEDs txuas nrog cov chaw nres nkoj: 11, 10, 9, 6, thiab 5.

4. Rov ua cov kauj ruam 1 - 3 txuas txuas ntxiv 4 LEDs mus rau lub khob cij

Kauj Ruam 2: Ntxiv Potentiometer

Ntxiv Potentiometer
Ntxiv Potentiometer

Lub hwj chim ntsuas yuav siv los hloov qhov LED tau xaiv, uas yuav yog qhov ci tshaj ntawm 5 LEDs. Nyob ntawm qhov kev taw qhia lub hwj chim tau tig yuav ua rau xaiv LED txav mus rau sab laug lossis sab xis.

Txhawm rau txuas lub potentiometer mus rau lub khob cij:

1. Muab lub potentiometer tso rau ntawm lub khob cij

2. Sab nrog ob tus pin, tus pin sab laug yuav txuas nrog lub jumper xaim mus rau txoj hlua hluav taws xob ntawm lub khob cij.

3. Txoj cai tus pin yuav txuas nrog rau hauv av tsheb nqaj hlau ntawm lub khob cij siv lub jumper xaim.

4. Ntawm sab nrog tsuas yog ib tus pin, txuas tus pin nrog jumper hlau mus rau ib qho ntawm cov chaw nres nkoj sib piv ntawm Arduino. Hauv daim duab analog chaw nres nkoj A5 tau xaiv.

Kauj Ruam 3: Txoj Cai rau LED Fade

Txuas nrog yog 1200_FinalExam_Project1.ino cov ntaub ntawv uas muaj tag nrho cov cai yuav tsum ua kom tiav txoj haujlwm no. Txoj cai nyeem tus nqi sib piv los ntawm lub hwj chim, thiab tom qab ntawd siv Cov Lus Hais Yog Yog xaiv qhov tseeb LED. Cov LEDs ncaj qha ntawm ib sab LED uas tau xaiv yuav raug teeb tsa mus rau qib qis, thiab LEDs ob qhov dhau los ntawm qhov xaiv LED yuav raug teeb tsa mus rau theem qis heev. Yog tias muaj LED 3 lossis 4 qhov chaw nyob deb ntawm LED xaiv, qhov LED ntawd yuav tsuas yog teeb tsa tawm.

Pom zoo: