Cov txheej txheem:

Fake Dynamic Price Tag: 6 Cov Kauj Ruam (nrog Duab)
Fake Dynamic Price Tag: 6 Cov Kauj Ruam (nrog Duab)

Video: Fake Dynamic Price Tag: 6 Cov Kauj Ruam (nrog Duab)

Video: Fake Dynamic Price Tag: 6 Cov Kauj Ruam (nrog Duab)
Video: 20 MOMENTS YOU WOULDN'T BELIEVE IF NOT FILMED 2024, Hlis ntuj nqeg
Anonim
Image
Image
Txhim Kho Cov Zaub
Txhim Kho Cov Zaub

Amazon tus nqi hloov pauv tas li. Yog tias koj tso cov khoom hauv koj lub tawb nqa khoom ntev dua ob peb teev, koj yuav muaj peev xwm ceeb toom txog qhov hloov pauv ntawm feeb - $ 0.10 ntawm no, $ 2.04 nyob ntawd. Amazon thiab nws cov tub lag luam tau pom tseeb siv qee hom kev ntsuas tus nqi los nyem qhov nyiaj npib kawg tawm ntawm kev ua lag luam.

Qhov ntawd yog txhua yam yuav tsum tau cia siab (peev peev txheej lig thiab txhua yam ntawd). Tab sis yuav ua li cas yog tias tej yam tsis zoo? Hauv xyoo 2011, kev ua tsov rog tus nqi tau tawm ntawm ob txoj kev sib tw. Qhov tshwm sim: phau ntawv hais txog kev ua neej nyob ntawm cov npua hauv tsev (tsis luam tawm, tab sis tsis tshwj xeeb yog qhov tsawg) nce mus rau tus nqi ntawm $ 23.6 lab.

Amazon qhov kev yuav khoom tam sim no ntawm Kev Lag Luam Zaub Mov tag nrho ua rau peb xav tsis thoob: dab tsi yog qhov txwv tsis pub tus nqi los ntawm kev nkag mus rau lub ntiaj teb lub cev ntawm kev muag khoom? Yuav ua li cas yog tias tus nqi hauv khw muag khoom tau yooj yim dua li cov online?

Yog li, hauv Cov Lus Qhia no, peb yuav tsim kho cov khoom lag luam zoo nrog Arduino thiab LCD me me. Peb tseem yuav tham luv luv txog kev zais thiab txhim kho nws hauv khw.

(Thiab, yog tias koj txaus siab, Chrome plugin no tuaj yeem qhia koj tus nqi keeb kwm ntawm ib yam khoom ntawm Amazon dhau 120 hnub dhau los.)

Xav Tau Cov Khoom

Nov yog yam peb tau siv los tsim txoj haujlwm no:

  • Ib Arduino Uno R3
  • Tus qauv 16x2 LCD zaub. Peb siv qhov no los ntawm Adafruit, tab sis tsuav yog nws tau sib xws nrog lub tsev qiv ntawv LiquidCrystal, koj yuav tsum yog qhov zoo. Koj yuav xav tau qee yam los xaim nws mus rau Arduino:

    • qee cov jumper cables
    • ib tug 220 ohm resistor
    • 10k ohm potentiometer (Qhov no yog rau kev tswj qhov sib piv ntawm cov zaub. Yog tias koj pom qhov sib txawv uas koj nyiam, koj tuaj yeem hloov lub potentiometer nrog tus tiv thaiv ruaj khov.)
  • Qee cov acrylic rau lub thawv. Peb siv cov yas dub matte dub acrylic, laser txiav thiab sib dhos nrog acrylic hnyav-nplaum thiab kub kua nplaum.
  • Cov hlau nplaum thiab/lossis cov hlua khi rau txuas lub thawv hauv khw. Yog tias koj mus rau txoj kab nuv ntses, koj tuaj yeem ntsuas thiab 3d-luam tawm ib qho, lossis sim nrhiav ib qho online (Alibaba, tej zaum?), Lossis… tau txais nws hauv qee qhov lwm yam, ntau yam tsis zoo. Nyob nyab xeeb.

Ua ntej tshaj, cia kom cov zaub mus!

Kauj Ruam 1: Txhim Kho Cov Zaub

Txhim Kho Cov Zaub
Txhim Kho Cov Zaub
Txhim Kho Cov Zaub
Txhim Kho Cov Zaub

Muaj tseeb muaj ntau tus pin nyob tom qab ntawm lub LCD. Hmoov zoo, cov ntaub ntawv rau lub tsev qiv ntawv software peb yuav siv muaj cov lus qhia zoo rau txuas nws. Txheeb nws tawm.

Hauv kev xaus, koj txoj hlua yuav tsum xaus li no:

  • Hwj chim:

    • LCD GND (tus pin 1), Arduino GND
    • LCD VDD (tus pin 2) → Arduino +5V
    • LCD RW (tus pin 5) → Arduino GND
  • Cov ntaub ntawv:

    • LCD RS (tus pin 4), Arduino tus lej digital 12
    • LCD Pab Tau (tus pin 6) → Arduino digital pin 11
    • LCD D4 (tus pin 11), tus lej digital 5
    • LCD D5 (tus pin 12), tus lej digital 4
    • LCD D6 (tus pin 13), tus lej digital 3
    • LCD D7 (tus pin 14), tus lej digital 2
  • Zaub sib piv:

    • Hlau 10k lub zog potentiometers ob txhais ceg rau Arduino's +5V thiab GND
    • Potentiometer's output → LCD VO (tus pin 3).
  • Backlight:

    • LCD BL1 (tus pin 15) → 220 ohm resistor → Arduino +5V
    • LCD BL2 (tus pin 16), Arduino GND

Thaum qhov no tau teeb tsa tag, nqa ib qho piv txwv li LiquidCrystal cov haujlwm hauv Arduino IDE thiab pom tias nws ua haujlwm! Nco ntsoov rov ntsuas ob zaug ntawm LCD tus lej pib ua lej hauv tus qauv-tus lej tus lej yuav tsum raug lossis koj yuav tsis pom dab tsi.

Piv txwv, qhov piv txwv "Blink" muaj cov cai no, uas yog qhov raug teeb tsa saum toj no:

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd (rs, en, d4, d5, d6, d7);

Lub tswv yim

  • Txuag koj tus kheej qee qhov muag thiab nqis peev hauv qee qhov crimp xaus thiab lub taub hau txuas. Ntawm cov phiaj xwm zoo li qhov no uas peb tab tom yuav sau cov khoom siv hluav taws xob rau hauv rooj plaub me me, muaj peev xwm ua kom luv jumper cables yog qhov muaj txiaj ntsig zoo.
  • Ib yam li ntawd, heatshrink tubing yog qhov muaj txiaj ntsig zoo kom paub tseeb tias tsis muaj dab tsi luv luv thaum nws txhua qhov nias tawm tsam nws tus kheej.
  • Txij li muaj ntau ntau yam mus rau GND thiab +5V, peb tau xaiv los ua franken-cable (saib daim duab saum toj no) kom sib zog li sai tau. Yog tias qhov chaw tsis muaj teeb meem tsawg, lub khob cij los yog daim ntawv pov thawj yuav yog qhov kev xaiv yooj yim dua.
  • Qee cov potentiometers tau zoo li tus duab. Feem ntau, cov hlau lead sab laug yog siv hauv av, txoj cai nyob sab xis yog lub zog, thiab ib nrab yog qhov tso tawm. Yog tias koj muaj ob txoj hauv kev ua ntej thiab ib qho nyob tom qab, ib qho nyob tom qab yog qhov tso tawm.

Gotchas

  • Yog tias koj tsis pom dab tsi ntawm koj lub LCD, sim tig lub hwj chim txhua txoj hauv kev hauv ib qho, tom qab ntawd lwm qhov. Ntawm qhov sib piv qis tshaj, LCD cov ntsiab lus tsis pom kiag li.
  • Yog tias koj pom qhov txawv txawv txawv ntawm lub LCD, lossis tsuas yog ib kab hloov ntawm ob, ua kom ntseeg tau tias txhua qhov kev sib txuas koj muaj kev nyab xeeb. Peb muaj qhov txuas tsis raug rau hauv av thiab nws tau ua rau cov teeb meem txawv txawv tshaj plaws.
  • Cov lej pib ntawm LCD (dab tsi tau txais los ntawm lcd.init () hauv teeb tsa () muaj nuj nqi) yog qhov tseem ceeb thiab siv sijhawm me ntsis. Yog tias qee yam tsis raug ntawm koj cov zaub thiab koj xav tias xaim tsis raug, tsis txhob cia siab tias yuav ua rau jiggling yam yuav tshwm sim tam sim ntawd. Koj yuav xav tau rov pib dua Arduino yog li cov lej pib muaj lub sijhawm los ua haujlwm kom raug.
  • Xyuas kom koj cov xov hlau luv luv, tab sis tsis luv heev. Tsis muaj dab tsi phem dua li yuav tsum rov muag dua vim tias koj nyob deb li ob peb centimeters ntawm lub taub hau.

Zoo kawg! Tam sim no cia peb ua nws qhia qee yam zoo nkauj.

Kauj ruam 2: Code: Hauv paus

Code: Hauv paus
Code: Hauv paus
Code: Hauv paus
Code: Hauv paus

Thawj yam ua ntej: cia peb muaj cov khoom tso tawm "Tus nqi tam sim no:" ntawm kab saum toj kawg nkaus, thiab tus nqi sib piv hauv qee qhov ntawm qhov thib ob. Txhua txhua zaus, cia peb muaj tus nqi rov ua dua tshiab. Nov yog qhov yooj yim zoo nkauj, tab sis yuav hais txog qhov siv yooj yim ntawm lub tsev qiv ntawv LiquidCrystal thiab qee qhov nws txawv.

Ua ntej, cia rub hauv lub tsev qiv ntawv thiab txheeb xyuas qee qhov tsis tu ncua:

#suav nrog

const uint8_t lcdWidth = 16;

const uint8_t lcdHeight = 2;

const ntev minPriceInCents = 50;

const ntev maxPriceInCents = 1999;

const unsigned ntev minMillisBetweenPriceUpdates = 0.25 * 1000;

const unsigned ntev maxMillisBetweenPriceUpdates = 2 * 1000

Zoo kawg! Cov no yog cov ntsuas rau tus nqi ntau thiab ntau npaum li cas nws yuav rov ua dua tshiab. Tam sim no cia ua piv txwv ntawm chav kawm LCD muab los ntawm lub tsev qiv ntawv thiab pib ua nws. Peb yuav luam tawm ib yam dab tsi dhau ntawm daim ntawv teev npe, tsuas yog kom muaj kev lees paub tias txhua yam ua haujlwm, txawm tias peb tsis pom dab tsi ntawm LCD. Peb yuav ua qhov ntawd hauv teeb tsa () ua haujlwm, uas khiav ib zaug tom qab khau raj Arduino. Nco tseg, txawm li cas los xij, tias peb tshaj tawm lcd qhov txawv txav sab nrauv ntawm teeb tsa (), vim tias peb xav tau nkag mus rau nws thoob plaws hauv txoj haujlwm.

LiquidCrystal lcd (12, 11, 5, 4, 3, 2); teeb tsa tsis muaj dab tsi () {Serial.begin (9600); lcd.begin (lcdWidth, lcdHeight);

Serial.println ("LCD pib ua ntej");

lcd.print ("Tus Nqi Tam Sim No:");

}

Thiab rau cov nqaij, peb yuav siv qhov built-in random () muaj nuj nqi thiab String () initializer los tsim tus lej lej. random () tsuas yog tsim cov zauv, yog li peb yuav faib nws cov txiaj ntsig los ntawm 100.0 kom tau txais tus nqi ntab. Peb yuav ua qhov no hauv lub voj (), yog li nws tshwm sim ntau li sai tau, tab sis nrog kev ncua qeeb ntawm qhov txuas uas peb tau hais ua ntej.

void lub voj ()

{tus nqi ob npaug = random (minPriceInCents, maxPriceInCents) / 100.0; Txoj hlua prettyPrice = "$" + Txoj hlua (tus nqi, 2); lcd.setCursor (0, 1); lcd.print (tus nqi zoo nkauj); ncua (random (minMillisBetweenPriceUpdates, maxMillisBetweenPriceUpdates)); }

Ib yam uas yuav tsum nco ntsoov yog hu rau lcd.setCursor (). Lub tsev qiv ntawv LiquidCrystal tsis tau xa koj cov ntawv mus rau kab tom ntej tom qab luam tawm, yog li peb yuav tsum txav tus cursor (pom tsis tau) mus rau kab thib ob (ntawm no 1-nws yog xoom-raws). Tseem nco tias peb tsis tas yuav luam "Tus Nqi Tam Sim No:" ntxiv; lub LCD tsis raug tshem tawm tshwj tsis yog koj ua tus kheej, yog li peb tsuas yog yuav tsum hloov kho cov ntawv muaj zog.

Muab nws khiav thiab koj yuav pom qhov teeb meem cuam tshuam sai. Yog tias tus nqi yog, hais tias, "$ 14.99" thiab tom qab ntawd "$ 7.22", cov zaub yuav pom "$ 7.229". Nco ntsoov, cov zaub tsis meej nws tus kheej tshwj tsis yog koj qhia nws. Txawm hais tias koj luam tawm ntawm tib kab, cov ntawv dhau los uas koj luam tawm yuav nyob li qub. Txhawm rau kho qhov teeb meem no, peb yuav tsum tau ntim peb txoj hlua nrog qhov chaw kom rov sau dua cov peev txheej pov tseg. Txoj hauv kev yooj yim tshaj plaws los ua qhov no tsuas yog txhawm rau ntawm ob peb qhov chaw rau peb qhov sib txawv ntawm PrettyPrice:

Txoj hlua prettyPrice = "$" + Txoj hlua (tus nqi, 2) + "";

Nrog qhov kev hloov pauv hauv qhov chaw, peb tau txais pov thawj ntawm lub tswv yim! Cia gussy nws me ntsis.

Kauj Ruam 3: Code: Cov Cim Cim

Code: Cov Cim Cim
Code: Cov Cim Cim
Code: Cov Cim Cim
Code: Cov Cim Cim

Ib qho ntawm qhov txias tshaj plaws ntawm LCD module peb tab tom siv yog lub peev xwm los tsim txog 8 tus cim kev cai. Qhov no yog ua tiav los ntawm kev tsim createChar () txheej txheem. Txoj hauv kev no siv ntau qhov ntawm 8x5 cov khoom uas piav qhia txog cov pixels ntawm LCD los qhib rau tus ua cim. Muaj ob peb yam cuab yeej online los pab tsim cov arrays no. Kuv siv qhov no.

Yog tias koj tsis xav tias yog tus tsim tshwj xeeb, Kuv pom zoo kom siv Threshold lim hauv Photoshop los hloov cov duab ua xim dub thiab dawb, thiab hloov qhov ntawd mus rau cov cim. Nco ntsoov tias koj muaj ntau kawg ntawm 8 tus cim kev cai, lossis 64x5 pixels.

Kuv xaiv rau siv 6 ntawm cov cim ntawd rau Amazon lub cim xub, thiab seem 2 rau lub cim kev lag luam zoo dua. Koj tuaj yeem ua raws tus qauv CustomCharacter hauv Arduino IDE seb yuav siv API li cas. Nov yog qhov kuv txiav txim siab ua pawg:

// Txheeb xyuas cov ntaub ntawv rau cov cim cim lag luam

const size_t trademarkCharCount = 2; const uint8_t trademarkChars [trademarkCharCount] [8] = {{B00111, B00010, B00010, B000000, B00000, B00000, B00000, B00000, B00000}, {B10100, B11100, B10100, B00000, B00000, B00000, B00000, B00000, B00000}}; uint8_t firstTrademarkCharByte; // Lub byte siv los luam cov cim no; muab tso rau hauv initCustomChars ()

Tom qab ntawd kuv siv txoj haujlwm zoo li no, hu los ntawm teeb tsa (), los tsim cov cim:

void initCustomChars () {

firstTrademarkCharByte = 0; rau (size_t i = 0; i <trademarkCharCount; i ++) {lcd.createChar (logoCharCount+i, (uint8_t *) trademarkChars ); }}

Tom qab ntawd, luam tawm cov cim kev cai yooj yim xws li siv lcd.write () nrog cov bytes tsim nyog. Kuv tau sau tus pab ua haujlwm kom luam tawm ntau ntawm bytes, thiab txhais printTrademark () hais txog nws:

void writeRawByteRange (uint8_t kab, uint8_t col, uint8_t startValue, size_t numBytes)

{rau (uint8_t i = 0; kuv <numBytes; i ++) {lcd.setCursor (col+i, kab); // yuav tsum tau siv sau (), tsis yog luam () - luam ntawv yuav tig tus lej lej // tus nqi rau hauv txoj hlua thiab luam tawm * uas * lcd.write (startValue + i); }} tsis muaj dab tsi printTrademark (uint8_t kab, uint8_t col) {writeRawByteRange (kab, col, firstTrademarkCharByte, trademarkCharCount); }

Lub logo Amazon xub tau kho zoo ib yam. Saib daim ntawv txuas nrog kom paub meej ntxiv.

Kauj ruam 4: Code: Niceties

Txhawm rau ua tej yam yooj yim me ntsis ntawm kuv tus kheej, Kuv tau ntxiv ob peb qhov zoo rau txoj cai. Qhov no suav nrog yam xws li: muaj nuj nqi rau kev tshem tawm kab tshwj xeeb los ntawm kev sau nws nrog cov chaw, thiab muaj nuj nqi rau nruab nrab txoj kab muab rau ntawm kab.

Kuv kuj xav kom cov zaub mus ncig los ntawm peb ntu sib txawv:

  1. "Dynamic Pricing" nrog lub logo hauv qab no
  2. "los ntawm Amazon" nrog lub logo hauv qab no
  3. tso saib tus nqi pheej yig

Txog qhov ntawd, Kuv tau tsim cov txheej txheem yooj yim uas taug qab qhov ntev npaum li cas theem tau ua haujlwm, thiab tom qab qee lub sijhawm, txav mus rau tom ntej.

Saib cov kab ntawv txuas rau txhua qhov lus qhia ntxaws!

Kauj ruam 5: Lub thawv

Lub Thawv
Lub Thawv

Tam sim no, yog li peb tsis tau txais pawg foob pob hu rau peb, cia ua lub thawv zoo rau txhua yam. Peb yuav ua qhov no nrog laser-txiav acrylic. Muaj ntau ntau cov cuab yeej online rau dhia-pib txheej txheem ntawm kev ua cov thawv yooj yim. Kuv pom zoo makercase.com, txij li nws tso cai rau koj txheeb xyuas qhov sab hauv thiab suav rau qhov tuab ntawm cov khoom.

Peb ntsuas Arduino, LCD thiab 9V roj teeb, thiab kwv yees tias peb yuav tuaj yeem haum nws hauv rooj plaub uas yog 4 "x 2.5" x 2 ". Yog li ntawd, peb tau ntsaws cov khoom rau hauv cov ntaub ntawv, nrog rau 1/8" tuab acrylic. Peb hloov kho qhov tshwm sim PDF txhawm rau ntxiv lub qhov rai sib npaug rau lub LCD, thiab lub qhov nyob hauv qab rau cov duab tso tawm (ntau ntxiv tom qab ntawd). Cov ntawv ua tiav tau muab txuas ua PDF.

Peb siv acrylic nplaum (tshuaj lom methyl ethyl ketone zoo) sib sau ua ke plaub sab ntawm lub npov. Tom qab ntawd peb txuas lub LCD vaj huam sib luag rau sab xub ntiag nrog kua nplaum kub. Thaum peb muaj txhua yam ua haujlwm thiab haum, peb tau kaw ob sab kawg ntawm lub thawv nrog kua nplaum kub, yog li peb tuaj yeem yooj yim muab nws sib nrug tom qab. Txij li thaum peb tsis tau cia siab tias lub cuab yeej yuav tau txais ntau hnav-thiab-kua muag, peb tau tso Arduino thiab roj teeb tsis muaj kev nyab xeeb rau hauv qab ntawm rooj plaub.

Muaj peev xwm txhim kho

  • Peb tsis quav ntsej los tsim txhua txoj hauv kev los qhib lub cuab yeej rau lossis tua. Ha. Chav rau hloov pauv hauv qab lossis tom qab ntawm lub thawv yuav yog lub tswv yim zoo.
  • Lub qhov nyob hauv qab rau daim ntawv dai yuav tuaj yeem ze dua rau ntawm lub hauv ntej ntawm lub thawv, txhawm rau txhim kho kev pom kev.

Kauj Ruam 6: Kev sib xyaw hauv

Sib xyaw hauv
Sib xyaw hauv
Kev sib xyaw hauv
Kev sib xyaw hauv

Thiab tam sim no, qhov nyuaj: nyiag nws mus rau hauv khw muag khoom.

Cov Khoom Noj Tag Nrho

Qee yam peb tau kawm hauv kev thim rov qab-engineering Txhua Yam Khoom Noj thiab Amazon cim npe:

  • Cov ntawv hauv lub cev feem ntau yog hauv Scala Sans
  • Cov ntawv nyeem hauv taub hau yog qee yam uas zoo li Brighton - ib qho ntawm cov ntawv "sov thiab nyiam"
  • Cov Khoom Noj Tag Nrho Green yog qee yam ze rau #223323
  • Koom nrog koj lub khw hauv zos rau cov piv txwv ntawm cov duab nraaj uas rov ua dua: lawv nyiam ntawm cov ciam teb qis, hnub poob, thiab kos duab yooj yim.

Dai dai

Peb hlais qhov hauv qab ntawm cov ntaub ntawv acrylic kom peb tuaj yeem muab daim ntawv dai dai rau ntawm lub npov, piav qhia tias muaj dab tsi tshwm sim. Saib cov ntawv PDF txuas rau qhov ua piv txwv. Qhov no yog tsim los txiav tawm thiab muab tso rau hauv lub qhov; nws yuav tsum haum thiab tuav yam tsis muaj nplaum.

Txee

Raws li qhov ua tau txuas lub thawv rau lub txee, Cov Khoom Noj Tag Nrho siv cov txheej txheem zoo nkauj zoo nkauj. Peb tau ntsuas thiab pom qhov sib txuas sib xws hauv khw muag khoom kho vajtse. Peb muab lub thawv rau tus nuv nrog cov kua nplaum kub.

Yog tias koj tsis tuaj yeem pom tus nqai zoo li no, koj tuaj yeem sim cov hlau nplaum - ua kua nplaum rau sab nraum qab ntawm lub thawv, thiab cia li ntsaws nws mus rau lub txee.

Tso tawm

Muab lub thawv tso rau ntawm qhov muag kom nyiam cov neeg hla. Tsis txhob ntes! Hmoov zoo!

Pom zoo: