Cov txheej txheem:

Merry Grinchmas Sweater, Thermal Printer + GemmaM0: 5 Cov Kauj Ruam (nrog Duab)
Merry Grinchmas Sweater, Thermal Printer + GemmaM0: 5 Cov Kauj Ruam (nrog Duab)

Video: Merry Grinchmas Sweater, Thermal Printer + GemmaM0: 5 Cov Kauj Ruam (nrog Duab)

Video: Merry Grinchmas Sweater, Thermal Printer + GemmaM0: 5 Cov Kauj Ruam (nrog Duab)
Video: Plan with Me feat. Avenue K Design 2024, Kaum ib hlis
Anonim
Merry Grinchmas Sweater, Thermal Printer + GemmaM0
Merry Grinchmas Sweater, Thermal Printer + GemmaM0
Merry Grinchmas Sweater, Thermal Printer + GemmaM0
Merry Grinchmas Sweater, Thermal Printer + GemmaM0
Merry Grinchmas Sweater, Thermal Printer + GemmaM0
Merry Grinchmas Sweater, Thermal Printer + GemmaM0
Merry Grinchmas Sweater, Thermal Printer + GemmaM0
Merry Grinchmas Sweater, Thermal Printer + GemmaM0

Lub tsho Merry Grinchmas yog khaub ncaws sib tham uas muab ntau yam ntawm tus kheej luam tawm cov lus raws li kev yws thaum twg ib tus neeg kov Grinch lub kaus mom pompon. Cov lus tiv thaiv-Christmasy los ntawm lub tshuab luam ntawv cua sov tswj los ntawm Gemma MO, Arduino, thiab Capacitive Sensing.

Kauj Ruam 1: Cov Khoom Npe

- Gemma MOJ

- Thermal tshuab luam ntawv Guts -

- Cov Ntaub Ntawv Xaj

- Lub tsho xoob

- Ua

- Roving + felting cov khoom siv

Cov Khoom Siv Hluav Taws Xob -

- Cov xov tooj liab

- Resistors (3.3k + 2.2k)

- Lub Hwj Huam - 7.5V, 3A

- Li-Po Roj teeb

- Tub Rog

- Cov ntaub nplaum

- Arduino Uno, Alligator Clips & breadboard (rau kev sim)

Kauj ruam 2: Kuaj + Teeb Tshuab Luam Ntawv

Kuaj + Teeb Tshuab Luam Ntawv
Kuaj + Teeb Tshuab Luam Ntawv
Kuaj + Teeb Tshuab Luam Ntawv
Kuaj + Teeb Tshuab Luam Ntawv
Kuaj + Teeb Tshuab Luam Ntawv
Kuaj + Teeb Tshuab Luam Ntawv

Ua ntej tshaj plaws, ntsuas lub tshuab luam ntawv kom pom tias nws muaj lub zog txaus, txwv tsis pub, thaum nias lub pob pib dua ntawm lub tshuab luam ntawv kom luam tawm nplooj ntawv sim nws yuav khaws cov kab ntawv tib yam ib zaug thiab dhau los (daim duab 1).

Thaum qhov kev xeem luam tawm los, nws yog lub sijhawm los tshuaj xyuas BaudRate raws li Lub Tshuab Luam Ntawv Ua Haujlwm ntawm 9600 thiab los ntawm lub neej ntawd Adafruits Library, siv 19200 zoo li lwm lub tshuab luam ntawv cua sov uas lawv muag. Txheeb nws ntawm no:

Daim duab 3 qhia meej txog yuav ua li cas xaim lub tshuab luam ntawv.

Qhov kev sim pab ntsuas ntsuas qhov sib txawv ntawm cov font los tsim txhua qhov kev tsim kho. (Duab 4).

Muaj tus lej tsis raug uas xaiv ntawm 12 kab lus sib txawv suav nrog cov ntawv sib txawv rau kab lus, lub cev thiab kos npe.

Thaum kawg, txhawm rau ntxiv ib daim duab, nws yuav tsum tau hloov pauv mus rau hauv daim duab Bitmap. (Duab 6). Ntawm no qhov kev xaiv yog Grinch. (Duab 7)

Ib daim ntawv kawg. Siv lub tshuab luam ntawv nrog Gemma M0, yuav tsum muaj qee qhov kev hloov kho kom siv Cov Khoom Kho Vajtse (Daim Duab 8).

Kauj Ruam 3: Tsim Txoj Haujlwm

Tsim Txoj Haujlwm
Tsim Txoj Haujlwm

Kuv xav tau dab tsi txog kuv qhov program?

1) Kuv muaj RGB coj uas muab cov lus pom pom txog lub tshuab luam ntawv. Ntsuab rau npaj, liab rau luam ntawv

Raws li Gemme M0 muaj ib qho Neopixel kos, txhawm rau ua kom nws, coj yuav tsum tau hais qhia zoo li nws yog ib qho LED sawb.

#define NUMPIXELS 1 // Tus naj npawb ntawm LEDs hauv kab txaij

void teeb tsa () {

strip.begin (); // Pib pins rau cov zis strip.show (); // Tig tag nrho cov LEDs ASAP

}

void voj () {

strip.setPixelColor (0, 255, 127, 0);

strip.show ();

}

2) Lub peev xwm ua tau zoo uas ua rau lub kaw lus.

Capacitive sensing xav tau lub tsev qiv ntawv thiab txhais qee qhov sib txawv. Nws siv ib qho Analog Input uas yuav tsum tau ntsuas. Kuv yuav xav tau qee qhov kev sim los hloov qhov txiaj ntsig ntawm kev kov.

#suav nrog "Adafruit_FreeTouch.h"

int kov = 1000; #define CAPTOUCH_PIN A0

ntev oldState = 0;

void checkpress () {// Tau txais lub xeev khawm tam sim no. ntev newState = qt_1.measure (); Serial.println (qt_1.measure ()); yog (newState> kov && oldState <kov) {// Ncua sij hawm luv rau debounce khawm. ncua (20); // Txheeb xyuas yog tias khawm tseem qis tom qab kev tshaj tawm. ntev newState = qt_1.measure (); } yog (newState <kov) {// Tsis ua dab tsi} ntxiv {// Ua qhov no}

3) Luam tawm cov lus sib txawv txhua lub sijhawm ua haujlwm

Qhov kev zov me nyuam yuav xaiv tus lej txhua lub sijhawm qhov program ua haujlwm

void printChristmas () {

randomSeed (analogRead (0)*analogRead (1));

randomNumber = random (1, 12);

tshuab luam ntawv.inverseOn ();

printer.println (F ("Xmas Inc. Presents")); tshuab luam ntawv.inverseOff ();

hloov (randomNumber) {

rooj plaub 1: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Qhov ntawd yog txhua yam hais txog, tsis yog? Qhov ntawd yog qhov nws ib txwm yog *txog *. Khoom plig, khoom plig … khoom plig, khoom plig, khoom plig, khoom plig, khoom plig, khoom plig! Koj xav paub tias yuav ua li cas rau koj cov khoom plig? Lawv txhua tus tuaj rau kuv. Hauv koj lub thoob khib nyiab. Koj pom kuv hais dab tsi? Hauv koj *cov khib nyiab *. Kuv tuaj yeem dai kuv tus kheej nrog txhua qhov kev tsis zoo Christmas Christmas kuv pom ntawm qhov pov tseg. Thiab qhov kev tsis nkag siab.. ")); tawg; rooj plaub 2: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Huag, leej twg-txiv neej.")); rooj plaub 3: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Auj, tsis yog, tus swb, khoom plig, lawv yuav raug rhuav tshem, thiab kuv mob siab rau!")); tawg; rooj plaub 4: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Blast this Christmas music. It'sjoyful and triumphant.")); tawg; rooj plaub 5: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Kuv tsuas yog noj vim kuv nkees?")); tawg; rooj plaub 6: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Muaj, txawm li cas los xij, ib qho me me Christmas me me kev lig kev cai kuv pom muaj txiaj ntsig heev … [tuav tuav mistletoe] Mistletoe. Boi-yoi-yoi-yoing! ")); tawg; rooj plaub 7: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Tam sim no koj mloog kuv, hluas nkauj! Txawm hais tias peb *txaus ntshai heev *, yuav tsis muaj lub ntsej muag tu siab rau Christmas.")); tawg; rooj plaub 8: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Hnub so uas-yog dab tsi?")); tawg; rooj plaub 9: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Puas yog koj muaj kev lom zem, lom zem Christmas?")); tawg; rooj plaub 10: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Thiab lawv yuav noj peb caug, tsiab peb caug, tsiab peb caug, Lawv yuav noj lawv cov Who-Pudding thiab tsis tshua muaj leej twg-Roast Beast. Kuv tab tom tham hauv RHYME! ")); tawg; rooj plaub 11: // nqe lus luam ntawv.println (F ("")); // Teeb cov ntawv kom raug (txoj cai, nruab nrab, sab laug) - lees txais 'L', 'C', 'R' tshuab luam ntawv.justify ('L'); printer.println (F ("Qhov avarice tsis muaj qhov kawg! Kuv xav ntaus golf. Kuv xav tau pob zeb diamond. Kuv xav tau nees nees yog li kuv tuaj yeem caij nws ob zaug, tau txais kev txaus siab thiab muag nws los ua kua nplaum. Saib, Kuv tsis xav ua nthwv dej., tab sis qhov * tag nrho * Christmas lub caij yog … ")); tawg; }

// Kuaj ntau yam

tshuab luam ntawv.boldOn (); tshuab luam ntawv.justify ('R'); tshuab luam ntawv.println (F ("Grinch")); tshuab luam ntawv.boldOff (); tshuab luam ntawv.println (F ("")); tshuab luam ntawv.justify ('L'); // Ntsuas tus cwj pwm ob-siab rau & tawm lub tshuab luam ntawv.doubleHeightOn (); printer.println (F ("Zoo siab Grinchmas!")); tshuab luam ntawv.doubleHeightOff (); tshuab luam ntawv.println (F ("")); tshuab luam ntawv.println (F (""));

// Luam lub logo 75x75 pixel hauv adalogo.h:

print.printBitmap (grinch_width, grinch_height, grinch_data);

tshuab luam ntawv.println (F (""));

tshuab luam ntawv.println (F (""));

tshuab luam ntawv.sleep (); // Qhia lub tshuab luam ntawv kom tsaug zog

ncua (3000L); // Pw tsaug zog rau 3 vib nas this tshuab luam ntawv.wake (); // YUAV TSUM () ua ntej luam dua, txawm tias rov pib dua lub tshuab luam ntawv.setDefault (); // Rov qab lub tshuab luam ntawv mus rau qhov qub}

Kauj Ruam 4: Cov Hluav Taws Xob

Mos Circuit Court
Mos Circuit Court
Mos Circuit Court
Mos Circuit Court
Mos Circuit Court
Mos Circuit Court
Mos Circuit Court
Mos Circuit Court

Raws li cov xov hluav taws xob xav tau yuav tsum tau muab tso rau hauv lub tsho muaj kev nyab xeeb, Kuv tau them nyiaj tshwj xeeb rau kev tsim hluav taws xob (Daim duab 1) thiab cov khoom tso rau hauv.

Tom qab ntsuas qhov ua tiav ntawm Circuit Court siv cov kais dej thiab cov ntawv ci (Daim duab 2 & 3), Kuv dhia mus rau hauv qhov chaw ib ntus ntawm qhov kev xav, ua ntej xaws thiab xau (Daim duab 4 & 5).

Nco tseg tseem ceeb: Kev thaiv kab mob suav nrog tus tiv thaiv yog qhov tseem ceeb vim tias lub voj voog no xav tau kev faib hluav taws xob txhawm rau tiv thaiv kev puas tsuaj tam sim no ntawm lub rooj tsavxwm. (Duab 6)

Kauj ruam kawg ntawm no, ntsuas txhua yam (Daim duab 7)

Kauj Ruam 5: Muab Txhua Yam Ua Ke

Muab Txhua Yam Ua Ke
Muab Txhua Yam Ua Ke
Muab Txhua Yam Ua Ke
Muab Txhua Yam Ua Ke
Muab Txhua Yam Ua Ke
Muab Txhua Yam Ua Ke

1) Tsim lub ntsej muag zoo nkauj (Daim duab 1 & 2)

2) Xaws Ntawv (Duab 3)

3) Tsim lub hnab rau ntawv yob thiab tus qauv rau lub tshuab luam ntawv thiab lub roj teeb Li-po (Daim duab 4 & 5). Txhua yam yog xaws rau lub tsho loj.

4) Tsim lub ntsej muag Grinch uas ua haujlwm li lub tshuab luam ntawv npog. Lub voj voos txuas ntxiv hauv qab lub kaus mom nrog txheej txheej ntawm cov ntaub qhwv cov ntaub uas txuas rau pompon. Pompon yog ua los ntawm cov ntaub plaub rov rov qab los thiab ua kom muaj fiber ntau. (Duab 6).

5) Raws li lub zog xa hluav taws xob xav tau lub qaum kom muaj zog Kuv tau tsim lub npog uas ua los ntawm cov xov paj uas siv tus kauv Fab Kis. (Daim duab 7 Yeem tau).

6) Kauj ruam kawg, nco ntsoov tias txhua yam nyob hauv qhov chaw thiab sim nws!

Pom zoo: