Cov txheej txheem:

Ntse Sib Tham Sib Teeb Tsheb: 5 Cov Kauj Ruam (nrog Duab)
Ntse Sib Tham Sib Teeb Tsheb: 5 Cov Kauj Ruam (nrog Duab)

Video: Ntse Sib Tham Sib Teeb Tsheb: 5 Cov Kauj Ruam (nrog Duab)

Video: Ntse Sib Tham Sib Teeb Tsheb: 5 Cov Kauj Ruam (nrog Duab)
Video: Dais thiab nab qa sib xeem tsheb kauj vab 2024, Hlis ntuj nqeg
Anonim
Ntse Sib Tham Sib Teeb Tsheb
Ntse Sib Tham Sib Teeb Tsheb

Npaj los tsim lub ntiaj teb qhov zoo tshaj plaws thiab cuam tshuam ntau tshaj plaws kev sib tham sib teeb? Zoo! Hauv qhov kev qhia no, peb yuav piav qhia koj yuav tsim ib qho los ntawm koj tus kheej siv Arduino.

Yam khoom xav tau:- Arduino (..duh)- LM317 Mosfet- 2x 60cm Analog RGB LED Strips (12V)- PVC tube (1m x 125mm)- Cables (liab thiab dub)- Hlau daim hlau rau lub teeb-lub kaus mom-Acryl rau lub teeb -icons (kos flaticon.com rau.svg cov cim)- Spraycan xim dub thiab dawb.- Cov kab xev hluav taws xob- Txhua yam yuav tsum tau siv cov khoom sib txuas- Zaub nrog cov ntaub thaiv npog (tsis siv hauv kev qhia)

Kauj Ruam 1: Kauj Ruam 1: Ua Lub Teeb-lub kaus mom

Kauj Ruam 1: Ua lub teeb-lub kaus mom
Kauj Ruam 1: Ua lub teeb-lub kaus mom

Tus tsim yog tiag tiag rau koj. Peb tau ua lub hau 15x15cm los tuav lub teeb. Peb tau txiav cov phaj hlau kom raug qhov loj me thiab siv lub raj hlau (tsis yog, tsis yog los ntawm Avatar) khoov lub kaus mom kom haum. Cov thaub qab tau tsim los ntawm cov khoom sib txawv.

Kauj Ruam 2: Kauj Ruam 2: Npaj PVC Ncej

Kauj Ruam 2: Npaj PVC Ncej
Kauj Ruam 2: Npaj PVC Ncej

Txiav 2 qhov hauv PVC ncej kom haum rau lub teeb ci. Tom qab ntawd siv cov xim pleev xim dub los pleev xim tag nrho cov dub. Yog tias koj xav tau, koj tuaj yeem ntxiv kab txaij dawb nyob hauv qab ntawm tus ncej (ib txwm nyob hauv Netherlands).

Kauj Ruam 3: Kauj Ruam 3: Sib dhos RGB LED Sawb thiab Sandblasting Acrylic Plates

Kauj Ruam 3: Sib sau ua ke RGB LED Sawb thiab Sandblasting Acrylic Plates
Kauj Ruam 3: Sib sau ua ke RGB LED Sawb thiab Sandblasting Acrylic Plates
Kauj Ruam 3: Sib sau ua ke RGB LED Sawb thiab Sandblasting Acrylic Plates
Kauj Ruam 3: Sib sau ua ke RGB LED Sawb thiab Sandblasting Acrylic Plates

Tom ntej no koj yuav tsum sib sau ua ke RGB LED strips hauv lub teeb-lub hau. Ua kom lawv nruj nyob ib ncig ntawm lub hau, thiab tso lawv kom ze rau pem hauv ntej li sai tau.

Tom ntej no koj yuav tsum tau zom cov cim uas tau xaiv rau ntawm cov phaj acrylic. Tau txais qee daim kab xev thiab npog tag nrho cov phaj acrylic. Tom qab ntawv txiav tawm cov duab/daim duab uas koj xav tau. Tom qab qhov no, koj tuaj yeem txhuam cov phaj kom tau txais cov dej khov-zoo li iav.

Kauj Ruam 4: Kauj Ruam 4: Txuas RGB LED Sawb rau Arduino

Kauj Ruam 4: Txuas RGB LED Sawb rau Arduino
Kauj Ruam 4: Txuas RGB LED Sawb rau Arduino

Tam sim no los txog qhov nyuaj: txuas RGB LED Sawb rau Arduino. Thaum koj txuas cov pins kom paub tseeb tias koj muab 12v rau ntawm 12v ntawm koj kab txaij. Nruab nrab ntawm txhua xim, yog li liab lossis ntsuab, koj yuav tsum muab mosfet tso. Txuas cov ntaub ntawv ntawm cov hlua coj mus rau tus pin nruab nrab ntawm mosfet, thiab tus pin sab laug rau koj Arduino. Txoj cai tus pin yuav tsum rov qab mus rau hauv av ntawm Arduino.

Kauj Ruam 5: Kauj Ruam 5: Sau Arduino Code

Kauj Ruam 5: Sau Arduino Code
Kauj Ruam 5: Sau Arduino Code

Txoj cai Arduino no yog tswj los ntawm bluetooth, vim tias peb tsis tau siv cov khoom siv sab hauv. Yog li txoj cai tau tswj hwm los ntawm bluetooth lus hauv lub voj () ua haujlwm.

#define r 6 #txhais g 11 #suav nrog

SoftwareSerial mySerial (10, 11); // RX, TX

#define npau tawsLength 4

#define fallLength 3 #define happyLength 4 #define onPhoneLength 13 #define tham lus ntev 5 #define taug kev Length 4 #define walkingOutLength 4 #define wavingLength 6

khawm khawm;

int tam sim noMillis; int yav dhau losMillis;

int animation1Delay;

int animation2Delay; int animation3Delay; int animation4Delay;

bool animation1Done = tsis tseeb;

bool animation2Done = tsis tseeb; bool animation3Done = tsis tseeb; bool animation4Done = tsis tseeb; bool animation5Done = tsis tseeb;

bool blockLight = tsis tseeb;

bool lightRed = tseeb;

int tam sim noAnimationDelay;

void teeb tsa () {

// muab koj cov cai teeb tsa ntawm no, kom khiav ib zaug: pinMode (r, OUTPUT); pinMode (g, OUTPUT);

Serial.begin (9600);

mySerial.begin (38400); Serial.setTimeout (25); buttonPressed = cuav; currentMillis = 0; PreviousMillis = 0;

animation1Delay = taug kev Length * 1000;

animation2Delay = wavingLength * 1000; animation3Delay = zoo siab ntev * 1000; animation4Delay = taug kev ntev * 1000;

// currentAnimationDelay = animation1Delay * 1000;

lightRed = tseeb; }

void voj () {

// ncua (20);

// tso koj tus lej tseem ceeb ntawm no, kom rov ua dua: tsis tau kos npe ntev tam sim no Millis = millis (); yog (buttonPressed == muaj tseeb) {yog (animation1Done == tsis tseeb) {yog (currentMillis - yav dhau losMillis> animation1Delay) {Serial.println ("0"); PreviousMillis = currentMillis; animation1Done = muaj tseeb; }} lwm yog (animation2Done == tsis tseeb thiab animation1Done == muaj tseeb) {yog (currentMillis - yav dhau losMillis> animation2Delay) {Serial.println ("1"); PreviousMillis = currentMillis; animation2Done = muaj tseeb; }} lwm yog (animation3Done == tsis tseeb thiab animation2Done == muaj tseeb) {yog (currentMillis - yav dhau losMillis> animation3Delay) {Serial.println ("2"); //Serial.println("sound:green "); PreviousMillis = currentMillis; animation3Done = muaj tseeb; lightRed = tsis tseeb; }} lwm yog (animation4Done == tsis tseeb thiab animation3Done == muaj tseeb) {yog (currentMillis - yav dhau losMillis> animation4Delay) {yav dhau losMillis = currentMillis; animation4Done = muaj tseeb; Serial.println ("FLSH"); }}}

yog (Serial.available ()) {

Txoj hlua str = Serial.readString (); yog (str == "CMD: BUTTON_PRESSED") {

animation1Done = tsis tseeb;

animation2Done = tsis tseeb; animation3Done = tsis tseeb; animation4Done = tsis tseeb; animation5Done = tsis tseeb;

animation1Delay = taug kev Length * 1000;

animation2Delay = wavingLength * 1000; animation3Delay = zoo siab ntev * 1000; animation4Delay = taug kev ntev * 1000;

// currentAnimationDelay = animation1Delay * 1000;

lightRed = tseeb; Serial.println ("3"); buttonPressed = tseeb; PreviousMillis = currentMillis; }

yog (str == "RED") {

blockLight = tsis tseeb; lightRed = tseeb; }

yog tias (str == "GREEN") {

blockLight = tsis tseeb; lightRed = tsis tseeb; }

yog tias (str == "LIGHT: GREEN: OFF") {

blockLight = tseeb; analogWrite (g, 255); } yog (str == "LIGHT: GREEN: ON") {blockLight = tseeb; analogWrite (g, 0); } //Serial.println(str); }

yog tias (blockLight == tsis tseeb) {

yog (lightRed == muaj tseeb) {

analogWrite (r, 0); analogWrite (g, 255); } yog (lightRed == tsis tseeb) {analogWrite (r, 255); analogWrite (g, 0); }}}

Pom zoo: