Cov txheej txheem:

Project1 LED: 9 Kauj Ruam
Project1 LED: 9 Kauj Ruam

Video: Project1 LED: 9 Kauj Ruam

Video: Project1 LED: 9 Kauj Ruam
Video: Motor LED connection with 9v battery and switch - Fan Light project tutorial 2024, Kaum ib hlis
Anonim
Qhov project 1 LED
Qhov project 1 LED

Kev tshoov siab rau txoj haujlwm no tau los ntawm lub teeb ci hauv cov vis dis aus hauv qab no los ntawm 0: 22-0: 28

Thiab hauv qab no koj tuaj yeem rub tawm cov vis dis aus ntawm kuv qhov tshwm sim.

Kauj Ruam 1: Kauj Ruam 1: Txheeb Xyuas Qhov Zoo Ntawm Koj Cov LED

Kauj Ruam 1: Txheeb Xyuas Qhov Zoo Ntawm Koj Cov LED
Kauj Ruam 1: Txheeb Xyuas Qhov Zoo Ntawm Koj Cov LED

Qhov zoo yuav muaj cov ceg hlau ntev dua qhov tsis zoo.

Kauj Ruam 2: Kauj Ruam 2: Muab LED tso rau hauv Breadboard

Kauj Ruam 2: Muab LED tso rau hauv Breadboard
Kauj Ruam 2: Muab LED tso rau hauv Breadboard

Muab cov LED tso rau hauv koj lub rooj noj mov nrog cov ceg tsis zoo hauv txoj kab hauv av.

Kauj Ruam 3: Kauj Ruam 3: Ntxiv Resistor

Kauj ruam 3: Ntxiv Resistor
Kauj ruam 3: Ntxiv Resistor

Txog qhov ua piv txwv no kuv tso 100 ohm resistor hauv tib kab ntawv ib yam li LED. Txhawm rau suav qhov xav tau tus tiv thaiv dab tsi rau koj LED siv cov qauv pom ntawm

Kauj Ruam 4: Kauj Ruam 4: Txuas Hlau rau Breadboard

Kauj Ruam 4: Txuas Hlau rau Breadboard
Kauj Ruam 4: Txuas Hlau rau Breadboard

Txuas ib lub xaim mus rau kab lus uas LED thiab tus tiv thaiv nyob hauv.

Kauj Ruam 5: Kauj Ruam 5: Ntxig Hlau Rau Hauv Tus Pin

Kauj Ruam 5: Ntxig Hlau Rau Hauv Tus Pin
Kauj Ruam 5: Ntxig Hlau Rau Hauv Tus Pin

Nrog koj lub Rooj Tswjhwm Saib Arduino tshem tawm ntsaws lwm qhov kawg ntawm xaim rau tus pin 3 ntawm koj lub rooj tsavxwm.

*Nco tseg rau txoj haujlwm no kuv tab tom siv tus pin 3, 5, 6, 9, 10, 11 vim lawv yog tus pin ntawm kuv li Arduino Uno board uas muaj PWM qhia los ntawm ~ tom ntej ntawm tus lej, txheeb xyuas koj lub rooj tsav xwm tshwj xeeb los xaiv pins uas PWM.

Kauj Ruam 6: Kauj Ruam 6: Rov Ua Dua

Rov ua cov kauj ruam 2-5, 5 zaug ntxiv

Kauj Ruam 7: Kauj Ruam 6: Hauv av

Kauj ruam 6: Hauv av
Kauj ruam 6: Hauv av

Muab ib txoj hlua hlau tso rau hauv txoj kab hauv av xiav.

Kauj Ruam 8: Kauj Ruam 8: Av Tshooj 2

Kauj Ruam 8: Av Tshooj 2
Kauj Ruam 8: Av Tshooj 2

Ntxig cov xaim av rau hauv tus pin hauv av ntawm koj lub rooj tsavxwm.

Kauj Ruam 9: Kauj Ruam 9: Upload Code

Tam sim no koj tuaj yeem ntsaws koj Arduino rau hauv koj lub computer thiab xa koj cov lej rau nws, lossis luam cov cai hauv qab no.

/* Project1 LED Effect

Dims ntau LEDs ib zaug, tom qab dims tag nrho, tom qab ntawd caum ntau LEDs hauv ib ntu.

Lub voj voog:

- LEDs los ntawm tus pin 2 txog 7 rau hauv av

tsim xyoo 2018

los ntawm Steven Johnson */

tus timer = 80; // Tus lej siab dua, lub sijhawm qeeb dua.

void teeb tsa () {

// siv lub voj los pib txhua tus pin raws li qhov tso tawm: rau (int thisPin = 2; thisPin <12; thisPin ++) {pinMode (thisPin, OUTPUT); }}

void voj () {

// iterate over the pins: for (int thisPin = 2; thisPin <12; thisPin ++) {// fade the LED on thisPin from off to brightest: for (int brightness = 0; brightness <255; brightness ++) {analogWrite (thisPin, ci ntsa iab); }} // ncua ntawm LEDs: ncua (1250);

// Fade lub LED ntawm qhov noPin los ntawm qhov ci tshaj plaws mus rau:

rau (int ci ci = 255; ci ntsa iab> = 0; ci ci-) {analogWrite (3, ci ntsa iab); analogWrite (5, ci ntsa iab); analogWrite (6, ci ntsa iab); analogWrite (9, ci ntsa iab); analogWrite (10, ci ntsa iab); analogWrite (11, ci ntsa iab); ncua (2); }

// voj los ntawm tus lej qis tshaj rau siab tshaj:

// Tig tus pin rau:

analogWrite (3, 255); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (5, 255); analogWrite (3, 180); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (6, 255); analogWrite (5, 180); analogWrite (3, 80); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (9, 255); analogWrite (6, 180); analogWrite (5, 80); analogWrite (3, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (10, 255); analogWrite (9, 180); analogWrite (6, 80); analogWrite (5, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (11, 255); analogWrite (10, 180); analogWrite (9, 80); analogWrite (6, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (3, 255); analogWrite (11, 180); analogWrite (10, 80); analogWrite (9, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (5, 255); analogWrite (3, 180); analogWrite (11, 80); analogWrite (10, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (6, 255); analogWrite (5, 180); analogWrite (3, 80); analogWrite (11, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (9, 255); analogWrite (6, 180); analogWrite (5, 80); analogWrite (3, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (10, 255); analogWrite (9, 180); analogWrite (6, 80); analogWrite (5, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (11, 255); analogWrite (10, 180); analogWrite (9, 80); analogWrite (6, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (11, 180); analogWrite (10, 80); analogWrite (9, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (11, 80); analogWrite (10, 0); ncua sij hawm (timer); // tig tus pin tawm:

// Tig tus pin rau:

analogWrite (11, 0); ncua sij hawm (timer); // tig tus pin tawm:}

Pom zoo: