Cov txheej txheem:
- Kauj ruam 1: Hookup Cov Lus Qhia
- Kauj ruam 2:
- Kauj ruam 3:
- Kauj ruam 4:
- Kauj ruam 5:
- Kauj Ruam 6:
- Kauj ruam 7:
- Kauj ruam 8:
- Kauj Ruam 9: Cov Lus Qhia Ua Haujlwm
- Kauj ruam 10:
- Kauj ruam 11:
- Kauj ruam 12:
- Kauj ruam 13:
- Kauj ruam 14:
Video: Arduino Tswb Tswb Project: 14 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv txoj haujlwm no, peb yuav siv Arduino Uno los tswj lub vijtsam LCD los qhia lub sijhawm tam sim no thiab lub sijhawm uas lub tswb tau teeb tsa. Peb yuav siv cov nyees khawm los teeb tsa txhua lub sijhawm.
Cov ntaub ntawv:
- Arduino Uno -
- Breadboard -
- Jumper Wires (x13+) -
- 10 kohm resistors (x4) -
- LCD npo -
- 7 Khawm-https://vilros.com/collections/raspberry-pi-acces…
- Piezo Speaker -
Kauj ruam 1: Hookup Cov Lus Qhia
1. Txuas lub jumper hlau los ntawm 5V tus pin ntawm Arduino mus rau ib qho ntawm + cov ntsia ntawm lub khob cij.
Kauj ruam 2:
2. Txuas lub jumper xaim los ntawm GND tus pin ntawm Arduino mus rau - txoj kev tsheb nqaj hlau nyob ib sab ntawm + txoj kev tsheb nqaj hlau uas koj tau xaiv ntawm lub khob cij.
Kauj ruam 3:
3. Txuas lub vijtsam LCD mus rau lub zog, hauv av, thiab tus pin TX (tus pin 1).
Kauj ruam 4:
4. Muab 7 khawm tso rau ntawm lub khob cij nrog ob txhais ceg hla qhov sib txawv hauv lub khob cij.
Kauj ruam 5:
5. Tso 10 kohm resistors los ntawm txoj kab tsheb nqaj hlau nrog GND tus pin txuas rau nws mus rau hauv qab sab laug ntawm tus khawm.
Kauj Ruam 6:
6. Muab cov xov hluav taws xob tso rau nruab nrab ntawm tus hauv qab txoj cai tus pin ntawm cov nyees khawm thiab 5V txoj kev tsheb nqaj hlau ntawm koj lub khob cij.
Kauj ruam 7:
7. Muab cov xov hlau txuas ntawm tus pin 6, tom qab ntawd 8-13, thiab tus pin ntawm lub pob uas tus tiv thaiv tau txuas nrog.
Kauj ruam 8:
8. Tom ntej no, tso koj tus neeg hais lus Piezo ntawm lub khob cij thiab txuas tus pin 7 rau tus pin fais fab, tom qab ntawd 100 ohm resistor rau hauv av.
Kauj Ruam 9: Cov Lus Qhia Ua Haujlwm
1. Txheej txheem cej luam: Txoj haujlwm no yuav nug tus neeg siv teeb tsa lub sijhawm tam sim no ntawm lub zog pib ntawm cov zaub tam sim no thiab lub sijhawm lub tswb tau teeb tsa. Cov nyees khawm txuas nrog saum toj no yuav raug siv los teeb tsa txhua lub sijhawm. Los ntawm sab laug mus rau sab xis, lawv tau teev teev tam sim no, teev feeb tam sim no, teev AM tam sim no lossis yav tsaus ntuj, teeb tsa lub tswb teev, teev tswb tswb, teeb tsa tswb AM lossis PM. Khawm kawg yog siv los ntsiag to lub tswb thaum nws nrov nrov.
Kauj ruam 10:
2. Thawj qhov peb yuav tsum tau ua yog pib peb qhov sib txawv uas peb yuav siv.
// Initialize variables to useint teev = 0; // Teev rau lub sijhawm tam sim no feeb feeb = 0; //
Feeb rau lub sijhawm tam sim no int thib ob = 0; // Thib ob rau lub sijhawm tam sim no
int teev_a = 0; int // Teev rau lub sijhawm ceeb toom
feeb_a = 0; // feeb rau lub sijhawm ceeb toom
bool am_pm = tsis tseeb; // AM/PM toggle chij. Tsis tseeb yog AM, Tseeb yog PM
bool am_pm_a = tsis tseeb; // AM/PM toggle chij rau tswb. Tsis tseeb yog AM, Tseeb yog PM
int set_hr = 13; // Siv tus pin 13 teev teev
int set_min = 12; // Siv tus pin 12 los teev feeb int
set_am_pm = 11; // Siv tus pin 11 teev am/pm
int set_hr_a = 10; // Siv tus pin 10 teev teev rau tswb int set_min_a = 9; // Siv tus pin 9 los teev feeb rau tswb int set_am_pm_a = 8; // Siv tus pin 8 teev teev/teev tsaus ntuj rau lub tswb
tus neeg hais lus = 7; // Pin siv los hais lus ntsiag to = 6; // Pin kom nres tus hais lus
bool tswb = tsis tseeb; // Chij to toggle kom alarming
bool ntsiag to = tsis tseeb; // Chij qhia ntsiag to tsis tau nias
int cur_time = 0; // Hloov pauv rau lub sijhawm tam sim no
int ua = 0; // Hloov pauv rau lub sijhawm dhau los
Kauj ruam 11:
3. Tom ntej no, peb yuav tsum teeb tsa lub vijtsam LCD thiab qhia rau tus neeg siv teeb tsa lub sijhawm tam sim no. Txij li qhov no tsuas yog xav tau ua tiav ib zaug, peb yuav ua nws hauv kev teeb tsa niaj hnub.
void teeb tsa () {
// Teeb tsa lub vijtsam LCD
Serial.begin (9600); // Initialize Serial ntawm 9600 baud
Serial.write (17); // Qhib lub teeb nraub qaum
Serial.write (24); // Qhib cov zaub rau, nrog tus cursor thiab tsis ntsais muag
Serial.write (12); // Tshem qhov screen
Serial.write (128); // Txav tus cursor mus rau kaum sab laug saum // teeb pinModes pinMode (set_hr, NTAWV); pinMode (set_min, INPUT);
pinMode (set_am_pm, INPUT);
pinMode (set_hr_a, INPUT);
pinMode (set_min_a, INPUT);
pinMode (set_am_pm_a, INPUT);
pinMode (tus hais lus, NTAWV);
pinMode (ntsiag to, INPUT);
// Thaum pib lub zog, kom cov neeg siv teeb tsa lub sijhawm tam sim no. Serial.print ("Teeb tsa lub sijhawm tam sim no"); ncua (2000);
Serial.write (12);
printTimes ();
cur_time = millis (); // Khaws lub sijhawm tam sim no}
Kauj ruam 12:
4. Tom qab ntawd, hauv lub voj kev niaj hnub, peb taug qab lub sijhawm thiab nyeem cov xwm txheej khawm kom pom tias tus neeg siv teeb tsa ib qho ntawm lub sijhawm.
void voj () {
// Khaws Sijhawm
keepTime ();
// Txheeb xyuas seb nws yog lub sijhawm tswb!
yog ((teev == teev_a && feeb == feeb_a &&! ntsiag to) || tswb) {suab nrov (hais lus, 2000, 500); // Tso lub suab 2000 Hz rau tus hais lus rau 500 ms
ncua (500); // Ncua 500 ms yog tias (! Tswb) {// Yog tias lub tswb raug kaw, qhib nws
}
}
// Yog tias tus neeg siv ntsiag to lub tswb los ntawm nias lub pob ntsiag to, tsis txhob ceeb yog tias (tswb &&! Ntsiag to && digitalRead (ntsiag to)) {
tswb = tsis tseeb;
ntsiag to = muaj tseeb; }
// Rov pib lub tswb yog (! Tswb && ntsiag to && feeb! = Feeb_a) {ntsiag to = tsis tseeb;
}
// Txheeb xyuas seb lub teeb pins mus siab, thiab yog li ntawd, nce tus nqi sib xws (digitalRead (set_hr) && teev <12) {
teev ++;
printTimes ();
debounce ();
}
lwm tus yog (digitalRead (set_hr) && teev == 12) {teev = 1;
printTimes ();
debounce ();
}
lwm tus {}
yog (digitalRead (set_min) && feeb <59) {
feeb ++; printTimes ();
debounce ();
}
lwm yog (digitalRead (set_min) && feeb == 59) {feeb = 0;
printTimes ();
debounce ();
}
lwm {} yog (digitalRead (set_am_pm) && am_pm) {
am_pm = tsis tseeb;
printTimes ();
debounce ();
}
lwm yog (digitalRead (set_am_pm) &&! am_pm) {am_pm = muaj tseeb; printTimes ();
debounce ();
}
lwm {} yog (digitalRead (set_hr_a) && hour_a <12) {
teev_a ++;
printTimes ();
debounce ();
}
lwm tus yog (digitalRead (set_hr_a) && hour_a == 12) {hour_a = 1;
printTimes ();
debounce ();
}
lwm {} yog (digitalRead (set_min_a) && feeb_a <59) {
feeb_a ++;
printTimes ();
debounce ();
}
lwm tus yog (digitalRead (set_min) && feeb_a == 59) {feeb_a = 0;
printTimes ();
debounce ();
}
lwm {} yog (digitalRead (set_am_pm_a) && am_pm_a) {
am_pm_a = tsis tseeb;
printTimes ();
debounce ();
}
lwm yog (digitalRead (set_am_pm_a) &&! am_pm_a) {am_pm_a = tseeb;
printTimes ();
debounce ();
}
lwm tus {}
}
Kauj ruam 13:
5. Ntawm no, koj yuav pom ob peb subroutines kuv tsim - debounce () thiab printTimes (). Debounce () yog siv los xyuas kom peb tsuas yog nyeem cov nyees khawm ib zaug. Txij li Arduino tshuaj xyuas ntau txhiab zaus hauv ib pliag, nws yuav xav tias lub pob raug nias ntau zaus thaum koj tsuas yog xav kom nws nyeem ib zaug. Debounce () yuav khov txoj haujlwm kom txog thaum lub pob tawm. printTimes () hloov kho lub vijtsam LCD, tab sis txij li qhov ntawd yog ob peb lo lus txib, Kuv ntaus lawv ib zaug thiab tom qab ntawd tuaj yeem hu rau subroutine txhua lub sijhawm lub sijhawm hloov pauv.
// Thaum ib qho ntawm cov nyees khawm raug nias, nyob hauv txoj haujlwm no tom qab ncua sijhawm 250 ms.
void debounce () {
thaum (digitalRead (set_hr) || digitalRead (set_min) ||
digitalRead (set_am_pm) || digitalRead (set_hr_a) ||
digitalRead (set_min_a) || digitalRead (set_am_pm_a)) {} ncua (250);
}
// Luam tawm cov sijhawm tshiab yog tias muaj kev hloov pauv
tsis muaj dab tsi printTimes () {
Serial.write (12);
Serial.print ("Lub Sijhawm Tam Sim No:");
Serial.write (148);
yog (teev <10) {
Serial.print ("0");
}
Serial.print (teev);
Serial.print (":");
yog (feeb <10) {
Serial.print ("0");
}
Serial.print (feeb); Serial.print (":");
yog (thib ob <10) {
Serial.print ("0");
}
Serial.print (thib ob);
yog (am_pm) {
Serial.print ("PM");
}
lwm tus {
Serial.print ("AM");
}
Serial.write (168);
Serial.print ("Tswb Teeb rau:");
Serial.write (188);
yog (teev_a <10) {
Serial.print ("0");
}
Serial.print (teev_a);
Serial.print (":");
yog (feeb_a <10) {
Serial.print ("0");
}
Serial.print (feeb_a);
yog (am_pm_a) {
Serial.print ("PM");
}
lwm tus {
Serial.print ("AM");
}
}
// Ua kom lub sijhawm tsis muaj nuj nqis
keepTime () {
etime = millis () - cur_time;
yog (etime> = 1000 && thib ob <59) {
thib ob ++;
cur_time = millis ();
printTimes ();
}
lwm yog (etime> = 1000 && thib ob == 59 && feeb <59) {thib ob = 0;
feeb ++;
cur_time = millis ();
printTimes ();
}
lwm yog (etime> = 1000 && thib ob == 59 && feeb == 59 && teev <12) {
thib ob = 0; feeb =
0; teev ++; cov_time =
millis (); printTimes ();
}
lwm tus yog (etime> = 1000 && thib ob == 59 && feeb == 59 && teev == 12) {
thib ob = 0; feeb =
0; teev = 1; am_pm = np
am_pm;
cur_time = millis ();
printTimes ();
}
lwm tus {}
}
Kauj ruam 14:
6. Nws yog nws!
Ua ke thiab upload thiab koj tau ua tiav!
Pom zoo:
Tswb Tswb Tswb Tswb Tswb: 3 Kauj Ruam
Lub Tswb Tswb Tswb Tswb: Kuv yog menyuam kawm ntawv 13 xyoos hauv Taiwan.Kuv ua yam nrog Arduino thawj zaug yog tias koj tuaj yeem qhia kuv yuav ua li cas txhim kho txoj haujlwm no, thov tawm lus rau kuv kom kuv tuaj yeem ua qhov zoo dua. (Ua tsaug ) Lub moos no tuaj yeem tsa koj thaum koj tsaug zog, tab sis kuv
Tswb Tswb Tswb Tswb Tswb Ntse Teeb: 8 Kauj Ruam (nrog Duab)
Tswb Tswb Tswb Tswb Tswb Lub Teeb: Hauv qhov haujlwm no kuv tau siv lub tshuab cua-tsoo lub tswb tawg tag. Lub ntsej muag ntawm lub moos tau hloov pauv los ntawm 12 LEDs, teeb pom kev los ntawm LED kab ib ncig ntawm ntug ntawm lub moos. 12 LEDs qhia lub sijhawm thiab cov hlua LED tau teeb tsa los ua lub tswb, tig
Arduino Push Alerts rau Lub Tswb, Tswb Tswb, Tswb Tswb Tswb Thiab Lwm Yam: 8 Kauj Ruam
Arduino Push Alerts rau Tswb, Tswb Tswb, Tswb Tswb Tswb thiab lwm yam: IoT Cov Ntawv Ceeb Toom los ntawm koj lub Tswb, Tswb Tswb, Tswb Tswb thiab lwm yam siv Arduino Uno thiab Ethernet Shield. Cov ncauj lus kom ntxaws ntawm kuv lub vev xaib ntawm no Hais txog Arduino Push Alert Box Siv Arduino Uno thiab Ethernet Shield raws li Wiznet W5100 nti rau
Lub Tswb Tswb Tswb Tswb Siv Super Tiny Arduino Compatible Board !: 10 Cov Kauj Ruam
Lub Tswb Tswb Tswb Tswb Siv Super Tiny Arduino Compatible Board!: Nyob zoo, hnub no peb yuav ua qhov haujlwm me me txias. Peb tab tom tsim lub tswb me me uas ntsuas qhov nrug nruab nrab ntawm nws tus kheej thiab cov khoom nyob rau ntawm nws xub ntiag. Thiab thaum cov khoom txav mus los yav dhau los teeb tsa, lub cuab yeej yuav ceeb toom rau koj nrog
LED Tswb Tswb Tswb Tswb Tswb Tswb Tsa Tswm Tsa: 7 Kauj Ruam (nrog Duab)
LED Tswb Tswb Tswb Tswb Tswb Tswb Tsa Tswm Tsa Tswm Tswm: Tsa Kuv Lub Caij Ntuj No Lub caij ntuj no kuv tus hluas nkauj muaj teeb meem sawv thaum sawv ntxov thiab zoo li raug kev txom nyem los ntawm SAD (Lub Caij Caij Nyoog Muaj Teeb Meem). Kuv txawm pom tias nyuaj npaum li cas kom sawv thaum lub caij ntuj no vim lub hnub tsis tuaj