Cov txheej txheem:

SpookyEyes Skull: 8 Kauj Ruam
SpookyEyes Skull: 8 Kauj Ruam

Video: SpookyEyes Skull: 8 Kauj Ruam

Video: SpookyEyes Skull: 8 Kauj Ruam
Video: Я работаю в Страшном музее для Богатых и Знаменитых. Страшные истории. Ужасы. 2024, Kaum ib hlis
Anonim
SpookyEyes Pob txha taub hau
SpookyEyes Pob txha taub hau

Nov yog qhov kev hloov kho yooj yim Kuv tau ua rau yas yas Halloween taub hau. Kuv drilled qhov muag qhov muag thiab ntxiv ob peb ntawm LEDs liab. Cov LEDs txuas nrog lub microcontroller rau cov teebmeem tshwj xeeb (ploj hauv/tawm, ntsais, qhov zoo li ntawd). Muaj qee qhov tshwj xeeb ntxiv ntawm qhov tsim qauv no:

  • Roj teeb powered
  • Ua kom zoo rau lub neej ntev (Kuv xam 200 teev lossis ntau dua ntawm txheej 3 Alkaline AA roj teeb.

    • Qhib rau thaum tsaus ntuj.
    • Ua haujlwm rau N teev (teeb tsa los ntawm tus programmer), tom qab ntawv tua.
    • Nyob twj ywm thaum nruab hnub.
  • Siv ATtiny84 microcontroller nti.

Yog tias koj yog Arduino tus neeg txaus siab thiab txhua yam koj tau ua haujlwm nrog yog cov chips uas tau teeb tsa ua ntej ntawm Arduino board, tom qab ntawv qhov no yuav yog txoj haujlwm zoo rau koj los nthuav koj lub qab ntug me ntsis. Muaj ntau qhov dav ntawm ATmega chips ntawm ntau qhov ntau thiab tsawg uas nyob twj ywm rau 2 lossis 3 cov cuab yeej uas tau muab los ntawm qhov ib txwm ua Arduino muab yog qhov txwv. Rau ib yam, txoj haujlwm no yuav ua tiav ntau yam sib txawv yog tias kuv yuav tsum tau siv Uno Rev. 3. Pawg tswj hwm nws tus kheej yog $ 22; Kuv tab tom ua txoj haujlwm no tsuas yog $ 1.50! Ntxiv rau, txij li nws qeeb dua (txawm hais tias txaus txaus rau lub teeb LEDs), nws siv lub zog tsawg. Qhov no txhais tau tias nws zoo dua rau kev ua haujlwm ntawm lub roj teeb.

Kauj Ruam 1: Lub Hom Phiaj

Lub Hom Phiaj
Lub Hom Phiaj

Ntawm no lawv yog:

  1. Tsim kom muaj qhov muag liab nyob hauv qhov muag qhov muag ntawm lwm yam humdrum pheej yig yas yas Xus taub hau.
  2. Txhawm rau lub zog los ntawm roj teeb.
  3. Kom nws ua haujlwm tau zoo 2 lub lis piam lossis ntau dua ntawm cov roj teeb hais.
  4. Kom muaj hnub tas sij hawm. Kuv nyob hauv ib cheeb tsam uas cov khoom txias tso rau pem hauv ntej muaj qhov nyiam mus kev deb. (Zoo txaus ntshai? Kuv txhais tau tias, Xus taub hau tam sim ntawd ntsiag to thiab tawm mus. Kuv tsis tau pom dua, tab sis kuv paub nws tshwm sim thiab lub tswv yim ua rau kuv txaus ntshai.) Yog li:

    • Kuv tsis xav kom qee lub taub hau txaus siab rau cov txiv ntawm kuv lub zog. Yog tias lawv tau txais kuv pob txha taub hau, nws yuav tsis muaj txiaj ntsig rau lawv sai sai! MWAH-hah-hah-HAH-HAH-HAH-HAAAHHHH !!!
    • Lub pob txha taub hau no tsuas yog teeb rau X tus lej ua ntej nws tso dab, yog li tham.

  5. Yam tsawg kawg nkaus (saib tus lej naj npawb 2, saum toj no).
  6. Kom tau txais kev paub hauv lwm tus AVR microcontrollers, ntxiv rau ATmega328p hauv Arduino Uno thiab lwm yam.
  7. Txhawm rau kawm paub siv USBASP li cas. Saib https://www.fischl.de/usbasp/. Raws li Thomas hais, "USBasp yog USB program-circuit programmer rau Atmel AVR cov tswj hwm … Tus programmer siv lub khoos phis tawj nkaus xwb USB tsav tsheb, tsis xav tau USB tshwj xeeb tswj hwm."

Raws li koj tuaj yeem paub, Arduino Uno, Leonardo, thiab lwm yam AVR-raws cov laug cam tuaj nrog ntau pawg ntxiv, xws li FT232RL USB-rau-serial nti, lub zog tswj hwm, siv lead ua oscillator, ntau yam txuas thiab teeb, headers rau kev thaiv kab, thiab lwm yam. Thiab tom qab lub nti tau teeb tsa hauv USB interface, IC ntxiv yog tsuas yog lub zog ntws. Ib qho ntxiv, yog tias koj tab tom muab hluav taws xob los ntawm roj teeb, tus tswj hluav taws xob tsis zoo tshaj thiab tsis zoo tshaj ntawm kev tso dej ntawm koj cov khoom. Yog tias koj xav tsuas yog tswj ob peb lub LEDs, zoo nkauj npaum li txhua yam ntxiv nrog rau cov txheej txheem yog qhov tsis muaj txiaj ntsig rau feem ntau ntawm koj txoj haujlwm hauv lub neej.

Ib qho ntxiv, feem ntau yog tsis yog txhua daim AVR chips tuaj nrog lub moos oscillator built-in. Nws tsis yog nrawm lossis raug raws li qhov siv lead ua, tab sis rau rooj plaub siv yooj yim, nws muaj teeb meem dab tsi?

Los ntawm kev siv tus txheej txheem tsim los ntawm cov npe tsim nyog "ATtiny" kab, koj tau txais lub peev xwm me me uas muaj peev xwm ua tau zoo uas rub lub zog me me, muab tag nrho cov txiaj ntsig koj xav tau, muaj ntau dua qhov nrawm, yog qhov pheej yig tiag tiag, thiab ua rau koj suav ib feem qis, rau khau raj.

Kev sib pauv yog tias koj yuav tsum nqa koj tus kheej lub cuab yeej ntaus ntawv. Hmoov zoo, muaj ib qho hu ua "USBASP". Xav txog nws zoo li Arduino tus builtin USB-rau-serial nti tab sis cais thiab tshem tau. Koj tuaj yeem siv nws rau tag nrho koj cov haujlwm. Txawm tias zoo dua, nws tshem tawm qhov xav tau rau bootloader. Koj tau txais lub cim xeeb ntawd rov qab, yog tias koj xav tau.

Thiab tsis txhob ntshai- USBASP yooj yim heev rau siv. Ntau tus pioneer ua ntej koj tau siv nws, yog li nws paub zoo thiab txhawb nqa zoo rau txoj haujlwm. Hauv qhov kev qhia no peb yuav siv nws thiab, raws li txoj haujlwm yooj yim rau ua kom koj txhais taw ntub hauv ntiaj teb ntawm ATtiny cov txheej txheem, qhov no yuav yog lub sijhawm zoo rau koj kom paub.

8. Lub hom phiaj kawg: Kuv vam tias koj yuav txaus siab rau Cov Lus Qhia!

Kauj ruam 2: Cov khoom xyaw

Cov khoom xyaw
Cov khoom xyaw
Cov khoom xyaw
Cov khoom xyaw
Cov khoom xyaw
Cov khoom xyaw
  • 3 x AA roj teeb (Walgreens)
  • Lub roj teeb tuav rau 3 AA roj teeb (eBay)
  • 9V roj teeb clip (eBay)
  • Breadboard rau kev xeem (eBay)
  • PC board (solderrable breadboard)
  • 0.1 "(0.254 mm) poj niam lub taub hau (rau koj ATtiny84a. Yog tias koj muaj kev ntseeg siab, tsuas yog siv lub ATtiny rau lub PC board). (EBay)
  • 2x5mm Liab LEDs (eBay)
  • 100 uF electrolytic capacitor (eBay)
  • 0.1 uF ceramic capacitor (eBay)
  • 2.2 megohm resistor (eBay)
  • lub teeb-rhiab resistor (eBay)
  • 2x 82 ohm resistors (eBay)
  • ATtiny84a microcontroller nti (eBay)
  • 24 ntsuas cov khoom sib txuas hlau (eBay)
  • soldering hlau (Amazon lossis Radio Shack)
  • solder (Amazon lossis Xov Tooj Cua Shack. Lead-free yog qhov zoo tshaj plaws.)
  • kua nplaum
  • yas Halloween taub hau, tsis dhau me me, hollow (Walmart, Dollar Store, thiab lwm yam)
  • usbasp programmer (eBay)

Cov lus qhia thiab cov tswv yim rau kev yuav khoom siv hluav taws xob rau cov neeg hauv Asmeskas:

Rau ib qho ntawm koj qhov pib (resistors, transistors, capacitors, LEDs, thiab lwm yam), mus rau eBay. Koj cov phiaj xwm hluav taws xob feem ntau yuav siv qhov ntau thiab tsawg (raws li qhov xwm txheej ntawm no); qhov no yog lub sijhawm zoo los khaws cia. Tshawb nrhiav ib puag ncig thiab nrhiav pob nrog 20, 40, 100 daim hauv lawv. Yuav cov ntawd; feem ntau koj tuaj yeem pom lawv rau qis dua 10 daus las thiab xa khoom dawb. Qhov no pheej yig dua Mouser/Digi-Key/Newark. Muaj, koj yuav tau txais tus nqi tsim nyog ntawm cov khoom tab sis tom qab ntawd lawv tsoo koj 9 bucks rau kev xa khoom; cov nqi qis no maj nrawm! Koj tuaj yeem pom cov khoom tshwj xeeb thiab xaiv tau zoo ntawm cov khw tshwj xeeb, tab sis koj raug mob los ntawm kev xa khoom ntawd. Ntawm qhov tod tes, Kuv pom pob ntawm 5 ATtiny84a tus rau $ 7.50 ntawm eBay, nrog thauj dawb. 5 MCUs rau tus nqi qis dua tus nqi thauj khoom 1 los ntawm Mouser! Yowser! Thiab eBay muaj tag nrho cov khoom ntim sib txawv uas koj xav tau, thiab koj paub tias yog koj xav tau ib tus neeg tawm tsam, koj yuav xav tau kaum ob!

Kauj ruam 3: USBasp

The USBasp
The USBasp
The USBasp
The USBasp

Ua ntej peb pib, cia peb tham me ntsis txog USBasp. Lawv yooj yim mus nrhiav hauv eBay, yog li mus txais ib qho. Tsis txhob txhawj, kuv yuav tos …

Koj tau txais nws? Zoo! Koj puas tau yuav nws los ntawm Suav teb? Tsis xav tias nws siv sijhawm ntev li ntawd.:-) Ok, nws yog qhov pheej yig dua li ntawd kuv paub tseeb. Pub dawb, ib yam nkaus.

Yog tias koj yog Linux aficionado zoo li kuv USBasp ua haujlwm tawm ntawm-lub-lub thawv. Rau Windows 10, nws nyuaj me ntsis. Yog li cia peb hla nws:

USBasp lub vev xaib ntawm https://www.fischl.de/usbasp/ taw qhia peb mus rau "Zadig" cov cuab yeej teeb tsa kev teeb tsa ntawm

  • Download tau nws. Kuv tau rub tawm version 2.4.
  • Windows 10 yuav nug koj yog tias koj xav kom nws hloov pauv koj lub cuab yeej. Yog lawm Yog, koj ua.
  • Txiav txim siab yog tias koj xav kom Zadig tshuaj xyuas daim ntawv thov hloov tshiab. Kuv hais yog lawm.
  • Tam sim no kuv ua raws cov lus qhia los ntawm https://rayshobby.net/dead-simple-driver-installa…. Ntawd yog,
  • Txuas rau hauv USBasp ntaus ntawv. Tej zaum koj yuav pom lub teeb liab liab ci rau ntawm nws.
  • Hauv Zadig, hauv lub npov tsuas yog rau sab xis ntawm tus xub ntsuab loj, nyem me ntsis los yog nqes xub kom txog thaum koj pom libusbK (v3.0.7.0). Qhov no yog rau Windows 10.
  • Nyem rau qhov loj Install Driver button.
  • Tos. Hauv ob peb feeb, koj yuav pom "Tus neeg tsav tsheb tau teeb tsa tiav." lub thawv Kaw nws.

Koj lub cuab yeej USBasp tam sim no npaj txhij!

Kauj Ruam 4: Arduino Txhawb rau ATtiny

Arduino Txhawb rau ATtiny
Arduino Txhawb rau ATtiny
Arduino Txhawb rau ATtiny
Arduino Txhawb rau ATtiny

Arduino IDE tsis txhawb nqa ATtiny series ntawm cov chips tawm ntawm lub thawv. Koj yuav tsum tau ntxiv nws rau IDE siv tus tswj hwm pawg thawj coj. Saib

Piv txwv tias koj twb tau rub tawm Arduino software, kuv yuav rov tsim cov kauj ruam los ntawm URL saum toj no. Yooj yim

  • Qhib Arduino software (Kuv siv 1.8.7 raws li kev sau ntawv no).
  • Qhib cov ntawv qhia zaub mov: Cov Ntaub Ntawv -> Nyiam. Nrhiav lub thawv "Tus Thawj Saib Xyuas Ntxiv URLs" ze rau hauv qab.
  • Luam thiab paste cov hauv qab no:

raw.githubusercontent.com/damellis/attiny/…

  • Ntawd
  • Nyem OK
  • Qhib cov ntawv qhia zaub mov: Cov cuab yeej -> Pawg thawj coj: "" -> Tus Thawj Saib Xyuas Haujlwm (nyob rau sab saud)
  • Scroll rau hauv qab. Koj yuav tsum nrhiav "attiny los ntawm David A. Mellis".
  • Nyem rau Nruab Nruab.
  • Nkag mus rau hauv qab ntawm daim ntawv. Koj yuav tsum pom "INSTALLED" tam sim no.
  • Qhib cov ntawv qhia zaub mov: Cov cuab yeej -> Pawg: ""
  • Koj yuav tsum pom ATtiny hauv qab ntawm daim ntawv teev npe. Nyem rau ntawm "ATtiny24/44/84".
  • Qhib cov ntawv qhia zaub mov: Cov cuab yeej -> Tus Txheej Txheem: "". Xaiv ATtiny84.
  • Hauv qab Cov cuab yeej ntawv qhia zaub mov koj yuav tsum pom lub moos nkag. Lub neej ntawd zoo. Qhov no yog li cas ATtiny cov txheej txheem xa khoom, nrog 1 MHz lub moos sab hauv.
  • Hauv qab Cov Cuab Yeej ntawv qhia zaub mov xaiv Chaw nres nkoj. Koj xav tau "COM1".

Kauj Ruam 5: Xeem, Xeem: Breadboard Koj Lub Circuit Court

Xeem, Xeem: Breadboard Koj Lub Circuit Court
Xeem, Xeem: Breadboard Koj Lub Circuit Court
Xeem, Xeem: Breadboard Koj Lub Circuit Court
Xeem, Xeem: Breadboard Koj Lub Circuit Court

Yog tias koj tsis paub nrog cov laug cam … zoo, tau txais ib qho. Nov yog tib txoj hauv kev los ntsuas koj cov kev sib tw thiab xyuas kom lawv ua qhov koj xav tau. Kuv pom zoo nws txawm hais tias koj tab tom tsim cov kev sib tham zoo li no, uas tau sim thiab ua haujlwm. Koj yuav ua rau koj tus kheej paub txog kev teeb tsa cov khoom kom yog thiab yog tias qee yam ua tsis tiav, koj yuav muaj lub sijhawm daws teeb meem yooj yim dua.

Txuas nrog yog qhov ua tau rau ntawm daim ntawv qhia zaub mov, thiab cov txheej txheem ntawm qhov me me hauv Circuit Court ib yam. Hlau koj lub voj voog raws li qhia.

Thaum tso cov LEDs thiab cov electrolytic capacitor, nco ntsoov tias cov lus qhia suav: koj yuav tsum tso qhov tsis zoo rau lub roj teeb tsis zoo, thiab sab zoo rau ntawm qhov zoo ntawm yam. Hauv cov teeb ntawm LEDs, lawv yuav nyob rau thaum ATTiny84a tus pin tig zoo (lossis "HIGH"). Yog li qhov zoo ntawm LEDs yuav tsum txuas rau tus pin tsim nyog ntawm ATTiny84a.

Muaj ntau lub vev xaib uas tham txog LED polarity; ib qho kev qhia no tuaj yeem pom ntawm no: https://learn.sparkfun.com/tutorials/polarity/diod…. Thaum kawg, txoj hauv kev zoo tshaj plaws uas kuv tau pom los ntsuas qhov sib txawv yog ntsaws 120 ohm resistor rau hauv lub roj teeb tsis zoo, ntsaws ib tus pin ntawm LED mus rau lwm qhov kawg ntawm tus tiv thaiv, tom qab ntawd txuas lwm qhov kawg ntawm LED rau lub roj teeb zoo (tseem hu ua VCC). Yog tias LED teeb, koj paub tus pin yog qhov twg.

Rau 100 microfarad capacitor, qhov no yog hom electrolytic capacitor. Yeej yog qhov txhais tau tias nws txoj kev taw qhia tseem ceeb ib yam. Tus pin tsis zoo yuav tsum tau sau daim ntawv lo. Los ntawm cov txheej txheem tshem tawm, koj tuaj yeem txiav txim siab qhov twg yog tus pin zoo:-). Txuas nws kom raug.

Cov neeg tiv taus, lub photocell, thiab cov khoom me me uas tsis muaj lub ntsej muag tsis muaj qhov sib txawv. Txuas lawv nyob rau hauv cov lus qhia uas koj xav tau. Nco ntsoov tias koj txuas me me cov khoom siv hluav taws xob ze rau VCC thiab GND pins ntawm ATTiny84a. Nws txoj haujlwm yog txhawm rau tshem tawm txhua qhov nrawm nrawm hauv lub zog kos los ntawm ATtiny microcontroller. Nws tau sau nrog tus nqi me me los ntawm lub zog siv hluav taws xob (roj teeb), uas muaj sai heev yog tias lub microcontroller xav tau nws hauv lub sijhawm microsecond. Nws tiv thaiv cov khoom siv hluav taws xob rau lub nti los ntawm kev poob qis heev vim yog kev hloov pauv sai sai tam sim no.

100 microfarad electrolytic capacitor ua qhov zoo ib yam, tab sis nyob rau lub sijhawm sib txawv. Vim qhov tseeb tias nws yog cua daj cua dub ntawm cov ntawv hlau nyias nyias, nws muaj qee qhov kev tiv thaiv sab hauv thiab yog li nws cov nqi tsis yooj yim. Nws tuaj yeem nrawm, nws yog qhov tseeb, tab sis tsis yog ntawm tus nqi muab los ntawm cov khoom siv hluav taws xob ceramic.

Ob lub tshuab hluav taws xob cuam tshuam sai dua rau lub zog tam sim no rub ntau dua li cov roj teeb, uas yog vim li cas lawv tau suav nrog. Nws yog qhov xwm txheej uas kuv cov kab hluav taws xob tau coj txawv txawv yog tias lawv ploj lawm. Nws tuaj yeem yog qhov paub tsis meej, yog li lawv tseem ceeb.

Hloov tshiab

Tsis pom ntawm no, tab sis tsim nyog, yog 10K ohm resistor los ntawm tus pin 4 rau Vcc. Koj yuav ua tau zoo rau nruab ib qho. Txawm li cas los xij, kuv tsis ua thiab lub Circuit ua haujlwm tau zoo. Yog tsis muaj nws, txawm li cas los xij, koj yuav muaj kev pheej hmoo rov pib dua rau koj lub nti.

Kauj Ruam 6: Load Sketch

Load Sketch
Load Sketch

Tam sim no nws los txog sijhawm los thauj cov duab kos. Cia peb ua cov blinkenlights!

Koj yuav pom qhov chaws rau kos duab ntawm

  • Lob nws, thiab thauj nws mus rau hauv Arduino software.
  • NCO TSEG: Muaj ib seem hauv cov cai uas zoo li no:

// --- DEBUG DEBUG DEBUG DEBUG D-vvvv-UG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG // --- DEBUG DEBUG DEBUG DBUG DEBUG DEBUG / --- DEBUG DEBUG DEBUG DEBUG D-vvvv-UG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG // --- DEBUG DEBUG DEBUG DBUG

Kuv pom zoo hloov qhov

#undef DEBUG

rau

#define DEBUG

raws li lub sijhawm sijhawm luv tau luv heev. Koj yuav tsum hloov nws rov qab thiab rov tso dua thaum koj npaj txhij los tso saib SpookyEyes rau tiag.

  • Mus tom ntej thiab ua qhov ntawd tam sim no. Tus so ntawm nplooj ntawv no xav tias koj tau ua li ntawd.
  • Nco ntsoov tias koj tau ua raws cov theem hauv Kauj Ruam 4: Arduino Txhawb rau ATtiny
  • Tam sim no ntsaws rau hauv usbasp's Arduino sab rau koj lub rooj tsavxwm. Koj xav txuas nws raws li hauv qab no:

    • GND rau koj lub roj teeb tsis zoo
    • MOSI txhawm rau pin 7 ntawm ATtiny
    • MISO los pin 0 ntawm ATtiny
    • SCK los pin 9 ntawm ATtiny
    • RST txhawm rau pin 4 ntawm ATtiny
  • Txuas lwm qhov kawg ntawm USBasp rau koj lub PC USB chaw nres nkoj
  • Txuas lub roj teeb lossis lwm lub zog 5v rau koj lub Circuit Court.
  • Xa cov duab kos siv Arduino IDE (Sketch-> Upload). Cov LEDs yuav flicker txij li qee tus pin uas tau siv rau hauv Circuit Court kuj tseem siv rau USBasp.

Sketch Ua Haujlwm Li Cas

Nco ntsoov tias koj nyob hauv chav me me ci ntsa iab, lossis coj lub teeb los ntawm lub teeb nyem mus rau lub teeb pom kev me me. Fais fab Circuit Court, thiab saib qhov muag LEDs. Nov yog hom "nruab hnub nrig". Tam sim no qhov kos duab tau ua tiav, koj yuav tsum pom cov hauv qab no. Nco ntsoov tias thaj chaw hauv cov cai uas tau piav qhia ntawm no tau cim nrog "BooKmarks", tsis yog kab lej, yog li koj tuaj yeem ua raws. Cov no muaj daim ntawv: #BK.descriptive_string ("Phaus BK Sijhawm" tom qab ntawd qee yam ntawm txoj hlua piav qhia). Piv txwv li, thawj phau ntawv cim npe hu ua "#BK. Hello" thiab tuaj yeem pom hauv cov cai uas LEDs txuas ntxiv rau ib pliag, tom qab ntawd plam ib pliag:

  • Ob qho LEDS yuav txuas ntxiv mus ib pliag, tom qab ntawd plam ib pliag. #BK. Nyob zoo
  • Nkawd ob leeg ntsais muag qeeb 3 zaug. Qhov no qhia tias ATtiny tau teeb tsa rau 1MHz nrawm. #BK.check_time * Saib NOTE A hauv qab no.
  • Ncua rau ib pliag.
  • Tom qab ntawd lawv ntsais sai sai ob zaug.
  • Ncua rau ib pliag.
  • Tam sim no koj nyob hauv lub voj () #BK.loop. Nco ntsoov, ib teev tsuas yog 10 vib nas this tam sim no.

Qhov "latch" tau tawm. Thiab HOUR_millis (== 1 teev, nyob rau hauv hom ib txwm) lub sijhawm tseem tsis tau dhau mus. Yog li, peb hla dhau txhua yam kom txog thaum peb mus rau #BK.indicate_duration. Txog tam sim no peb nyob hauv xoom 'teev, yog li peb nyem qhov muag 0 zaug.

  • Qhov no txuas ntxiv mus txog thaum peb mus txog HOUR_millis vib nas this (10 vib nas this, hauv DEBUG hom).
  • Tom qab ntsais muag peb zaug sai. #BK.time_ kev tswj hwm
  • Ntxiv lwm "teev" los ntawm kev nce qhov latch_time_off sib txawv
  • Tom qab ntawd dhia txhua txoj hauv kev mus rau #BK.indicate_duration. Muaj, peb nyem tus lej "teev" peb tau ua haujlwm. Tus lej no tau khaws cia hauv EEPROM, yog li nws muaj txawm tias lub zog raug tshem tawm ntawm lub nti.

    • Peb thawj teev hauv qhov pom kev tau ua tiav. Yog li peb nyem ib zaug, luv luv.
    • Tom qab ntawd ncua 2 vib nas this.
  • Rov qab mus rau lub voj ():

    • Txhua qhov rov ua dua los ntawm lub voj tam sim no, peb tshawb xyuas seb HOURS_milli lub sijhawm dhau los lawm. Rau thawj ob peb zaug (hauv DEBUG), nws tsis tau. Yog li peb tsis nyem 3 zaug.
    • Peb hla mus rau #BK.indicate_duration, thiab peb nyem nrawm suav ntawm cov teev uas peb tau nyob hauv qhov pom kev, uas tau rov khaws dua hauv EEPROM qhov chaw 0.
    • Qhov no txuas ntxiv mus ntev.
    • Nco ntsoov tias ib zaug tus lej hauv EEPROM qhov chaw 0 yog loj txaus, lub voj yooj yim dhau los ua:

      • Nyem 3 zaug ntawm qhov nrawm,
      • Flash nrawm tus naj npawb ntawm HOURS_millis uas peb tau nyob hauv qhov pom kev,
      • Tos 2 vib nas this,
      • rov hais dua.

Tam sim no muab koj tus ntiv tes tso rau sab saum toj ntawm lub teeb tiv taus lub teeb. Lossis tsuas yog qhib lub teeb. Lub voj tam sim no dhau los:

  • Peb latch_time_off tau dhau ib teev, thiab nws tsaus ntuj, Yog li ntawm #BK.check_the_light, peb pom tias nws yog qhov tsaus ntuj tiag.
  • Peb tig lub latch rau. Qhov no pib cov khoom tsis txaus ntseeg txhua lub voj. Saib ntawm no NTAWV SAWV DAWS STUFF. Cov cai yuav tsum tau piav qhia ncaj ncees.
  • Thaum lub latch tau ntev txaus, peb yuav tua nws. Saib #BK.turn_spookiness_off.
  • Tam sim no peb rov qab mus rau #BK.time_management, raws li "ntsais sai peb zaug", saum toj no.

Khiav Rau Tiag

Tsis txhob hnov qab hloov qhov kos duab rau #undef DEBUG.

CEEB TOOM A

* NCO TSEG A: Txoj cai tau suav nrog teeb tsa nws mus rau 8 MHz. Saib CLKPR = 0x00; tawm tswv yim code. Yog tias koj xav ua qhov no (thiab tsis muaj laj thawj los ua rau lub voj voog no), nco ntsoov tias koj hloov pauv Arduino IDE, hauv Cov Cuab Yeej-> Clock menu menu item.

Kauj Ruam 7: Los ntawm Breadboard mus rau Soldered Circuit

Los ntawm Breadboard mus rau Soldered Circuit
Los ntawm Breadboard mus rau Soldered Circuit
Los ntawm Breadboard mus rau Soldered Circuit
Los ntawm Breadboard mus rau Soldered Circuit
Los ntawm Breadboard mus rau Soldered Circuit
Los ntawm Breadboard mus rau Soldered Circuit

Tam sim no nws yog lub sijhawm los tsim Circuit Court Production! Tau txais me ntsis perferable perfboard; Kuv nyiam Radio Shack Catalog #: 2760159, pom ntawm no: https://www.radioshack.com/collections/prototyping…. Muaj ntau qhov rau kev xa koj lub PC cov khoom sib dhos mus rau perfboard.

Tsis txhob hnov qab suav nrog qhov me me qhov (socket) rau ntxig rau USBasp cov xov hlau (rau kev ua haujlwm)! Koj yuav xav tau 5 ntawm lawv.

Npaj pob txha taub hau

Qhia koj lub taub hau li cas nws yuav zaum hauv av. Koj yuav tsum tau siv lub qhov rau tus kws yees duab, xws li nws tau txais lub teeb:-). … Cov kauj ruam tseem ceeb! Tsis tas li, siv koj cov cuab yeej txiav uas koj nyiam, txiav qhib hauv qab ntawm pob txha taub hau thiaj li ua rau chav nyob rau ntawm lub rooj sib tham thiab roj teeb. Txiav nws ntawm 3 sab nkaus xwb thiaj li ua lub qhov rooj.

Laum lub qhov kom tus photoresistor yuav yog qhov haum haum. Pom tseeb, koj tuaj yeem ntsuas qhov loj los ntawm sab nrauv ntawm pob txha taub hau kom nws raug. Ib txwm pib me me nrog koj cov kev xyaum, thiab tsis txhob xyaum nrawm kom tsis txhob tsim ntau qhov nyem nyob ib puag ncig lub qhov uas koj yuav tsum tau txiav tawm nrog rab riam.

Laum qhov hauv qhov muag rau cov LEDs. Loj lawv ua tib zoo, yog li cov LEDs yuav yog qhov haum haum. Kuv muab kuv cov LEDs los ntawm sab hauv, thiab vim tias tsis muaj ntau qhov kev tshem tawm los ua haujlwm sab hauv, Kuv tsuas yog tso me ntsis kub yaj kua nplaum rau sab nraum qab ntawm LEDs raws li kev pov hwm ntxiv me ntsis los tuav lawv.

Kuv kuj tau ceev faj kom qhwv ib qho ntawm cov xov hlau rau txhua LED hauv cov cua sov uas ua kom sov.

Tso lub Circuit hauv

Txij li pob txha taub hau tsuas yog nyob ntawd, Kuv tsis tau ceev faj txog kev teeb tsa lub rooj tsav xwm hauv Circuit Court. Kuv tau ua kom ntseeg tau tias lub roj teeb tau mus rau hauv qab thiab yuav tsis muaj kev luv luv. Ib zaug txuas, txuas, thiab siv hluav taws xob, Kuv kaw ipt thiab muab lub blob kub yaj kua nplaum rau hauv qab nrov plig plawg.

Nco ntsoov tias koj ua cov xov hlau rau LEDs thiab photoresistor ntev thiaj li tuaj yeem rub lub rooj tsav xwm tawm rau kev rov sau dua.

Kauj Ruam 8: Spoooooky Eyes !!!! Oooooooo !!

Spoooooky Qhov muag !!!! Oooooooo !!!!
Spoooooky Qhov muag !!!! Oooooooo !!!!

Ok, tam sim no yog nws. Koj Lub Qhov Muag Spooky yuav qhib thaum tsaus ntuj, tso saib rau cov neeg dag-lossis-kho rau 4 teev, tom qab ntawv kaw kom khaws cov roj teeb. Nws yuav nyob twj ywm kom txog thaum yav tsaus ntuj tom ntej. Nws yuav ua qhov no rau TOTAL_RUN_HOURS teev, yog li npaj tus nqi hauv daim duab kom zoo. Txij li thaum kuv muaj 4 teev default MAX_RUNTIME, 40 teev rau TOTAL_RUN_HOURS txhais tau tias nws yuav ua haujlwm rau 10 hnub.

Yog tias ib tus neeg txiav txim siab tias nws qab heev rau koj kom muaj, thiab coj nws mus tsev, SpookyEyes yuav ua tiav nws txoj kev khiav thiab tom qab ntawd ntsiag to, thiab nyob ib puag ncig lawv lub siab. Suffice nws hais, tub sab yuav ua zoo kom tsis txhob noj koj lub taub hau SpookyEyes!

Tso koj SpookyEyes tseg rau lub caij. Xyoo tom ntej, tsuas yog xa cov duab kos dua thiab SpookyEyes los rau lub neej! Yuav ua li cas spooky? Ooooooo !!!!

Txhim kho

Tej zaum kuv yuav tsum tau ua kom ATtiny tsaug zog thaum nruab hnub. Powered down, nws thim me me tam sim no.

Kuv yuav tsum tau muab 10K ohm resistor ntawm tus pin 4. Qhov no ua rau lub Circuit Court los ntawm kev rov pib dua yam tsis paub meej. Kuv tsis muaj teeb meem, txawm li cas los xij. Tab sis nws yuav tsum tau ua kom raug.

Roj teeb Powered

Kuv nyiam ATtiny84. Nws yog ib qho me me nti rau lub zog hluav taws xob qis. Tseeb, nws tsis muaj Serial.print () muaj peev xwm ntawm Arduino ATmega328p thiab nws cov ilk, tab sis koj tuaj yeem muaj lub teeb ntsais ntsais hauv qee txoj hauv kev los qhia koj tias muaj dab tsi tshwm sim hauv koj lub Circuit Court, rau kev debugging. Nws tsis nyuaj ua haujlwm nrog.

Kuv vam tias koj pom qhov no Qhia … qhia tau!

Pom zoo: