Cov txheej txheem:

Desktop Organisor Nrog LCD: 4 Kauj Ruam
Desktop Organisor Nrog LCD: 4 Kauj Ruam

Video: Desktop Organisor Nrog LCD: 4 Kauj Ruam

Video: Desktop Organisor Nrog LCD: 4 Kauj Ruam
Video: ROG Gaming PC Cable Management #Shorts 2024, Kaum ib hlis
Anonim
Image
Image

** Ua Edited **

Rau HKU arduino txoj haujlwm kuv txiav txim siab los ua lub khoos phis tawj uas muaj lub vijtsam LCD uas qhia txog kev tshoov siab kom tuaj tos koj thaum koj tig koj lub ntsuas cua!

Kuv yuav tau npog cov khoom siv thev naus laus zis feem ntau, tsuav koj tau txais qee yam zoo li lub thawv ntoo los nkaum koj Arduino thiab LCD hauv koj tus kheej oganisor tuaj yeem ua rau txhua daim ntawv xav tau.

Yam uas koj xav tau

  • *arduino ib
  • lauj kaub 'meter'
  • *txiv neej prottyping xov hlau
  • *LCD module! Nrog SD daim npav nyeem ntawv! (Kuv tau txais arduino tft LCD)
  • *micro SD daim npav
  • *ntoo (Kuv rov qab siv cov tub rau khoom qub qub thiab siv qee qhov ntoo seem, xyuas kom koj tuaj yeem tsim tsawg kawg yog lub thawv me me los nkaum koj cov arduino hauv!

Kauj Ruam 1: Teeb Lub Potmeter ntawm Arduino

Teeb tsa lub Potmeter ntawm Arduino
Teeb tsa lub Potmeter ntawm Arduino

txuas koj lub ntsuas 'meter' raws li qhia hauv daim duab

kom tau txais lub lauj kaub ntsuas kom ua haujlwm pib

Koj yuav tsum tau pib nrog qee qhov kev hloov pauv nyob rau saum koj daim duab ua ntej teeb tsa:

chaws:

const int analogInPin = A0; // Analog input tus pin uas tus potentiometer txuas rau

int sensorValue = 0; // tus nqi nyeem los ntawm lub lauj kaub int outputValue = 0; // tus nqi tso tawm rau PWM (analog tawm)

Hauv daim duab 2 Kuv qhia tias yuav ua li cas lub ntsuas hluav taws xob tau teeb tsa hauv lub voj void

chaws:

// nyeem cov analog hauv tus nqi:

sensorValue = analogRead (analogInPin); // daim ntawv qhia nws mus rau qhov ntau ntawm cov analog tawm: outputValue = daim ntawv qhia (sensorValue, 0, 1023, 0, 255); String stuffToPrint = Txoj hlua (outputValue); // hloov tus nqi analog tawm:

stuffToPrint.toCharArray (luam tawm, 9); // zoo li ntawv myScreen.setTextSize (1);

Serial.print ("sensor ="); Serial.print (sensorValue); Serial.print ("\ t tso tawm ="); Serial.println (outputValue);

ncua (50);

daim duab qhia chaw no piv cov ntaub ntawv los ntawm lub tshuab ntsuas hluav taws xob mus rau thaj tsam 0 txog 255, peb yuav siv qhov no los tswj peb cov duab swb lcd

Yog tias koj xav tau kev pab teeb tsa lub ntsuas hluav taws xob; Kuv siv cov cai los ntawm cov lus qhia muaj txiaj ntsig no, cov koob yog qhov zoo ib yam thiab yuav ua haujlwm nrog teeb tsa LCD hauv cov kauj ruam tom ntej.

www.toptechboy.com/arduino/lesson-11-arduin…

Kauj ruam 2: Teeb LCD

Kev teeb tsa LCD
Kev teeb tsa LCD

Teeb tus pin zoo li hauv qhov piv txwv saum toj no.

Thaum ua tiav qhov raug koj lub vijtsam yuav ci dawb.

Yog tias koj xav tau kev pab ntxiv lossis xav siv qee tus lej piv txwv los sim koj cov zaub koj tuaj yeem pom cov lus qhia ua haujlwm rau cov qauv no thiab nws yog tus piv txwv ntawm no

peb yuav siv qee qhov "kos duab los ntawm SD daim npav" hauv cov kauj ruam tom ntej.

Kauj ruam 3: Teem Up Slideshow

Kev teeb tsa Slideshow
Kev teeb tsa Slideshow

Tam sim no peb muaj Potmeter thiab LCD teeb tsa peb tuaj yeem teeb tsa "swb" uas siv tus kws ntsuas lub ntsuas qhov ntsuas

Siv qhov ntau ntawm 0 txog 255 peb tuaj yeem qhia txog qee yam uas peb tuaj yeem ua rau arduino los tso saib qee cov ntsiab lus ntawm LCD.

Thawj qhov piv txwv raws li qhia hauv duab:

yog (outputValue <51) {// range ib yog (rangeOne == tseeb) {rangeTwo = tseeb; myScreen.setRotation (90); myScreen.background (0, 0, 0); myScreen.stroke (255, 255, 255); myScreen.text ("Nyob zoo,", 10, 50); myScreen.text ("tig tus pin> rau", 10, 60); myScreen.text ("tau txais kev txhawb siab.", 10, 70); rangeOne = tsis tseeb;

Yog tias lub ntsuas hluav taws xob tig mus rau qhov qis dua 51, lub vijtsam nrog zaub (hauv hom duab = rotatio 90) qee cov ntawv.

Txhawm rau tuaj yeem tso saib cov duab kom ntseeg tau tias koj tus lej SD CS tau hais kom raug, lossis cov arduino yuav tsis pib ua SD (yog li nco ntsoov xyuas koj cov xov hlau !!)

Yog tias koj xav tshuaj xyuas koj tus lej LCD koj tuaj yeem xa mus rau phau ntawv qhia ua haujlwm "txuas lub vijtsam"

Kuv txhais kuv tus SD CS tus pin li 4 tam sim no vim tias kuv tau sib xyaw kuv cov xov hlau, piv txwv! - Kuv zoo siab los qhia qhov oopsie me me vim tias nws yuav txuag koj ntau lub sijhawm tshawb xyuas lub vev xaib rau "Ua tsis tau pib ua ntej" yuam kev. Qhov twg ntawm qee lub rooj sab laj nws tau hais tias kev kho yog kom muaj qee tus qauv ntawm SD daim npav. Yog li xyuas koj cov thaiv thawj zaug ua ntej yuav daim npav SD tshiab !!

Kauj Ruam 4: Piv Txwv Piv Txwv

#suav nrog

#include // Tsev qiv ntawv kho vajtse tshwj xeeb #suav nrog

#define SD_CS 4 #define CS 10 #define DC 9 #define RESET 8

const int analogInPin = A0; // Analog input tus pin uas tus potentiometer txuas rau

int sensorValue = 0; // tus nqi nyeem los ntawm lub lauj kaub int outputValue = 0; // tus nqi tso tawm rau PWM (analog tawm) bool rangeOne = muaj tseeb; bool rangeTwo = muaj tseeb; bool rangeThree = tseeb; bool rangeFour = tseeb; bool rangeFive = tseeb;

TFT myScreen = TFT (CS, DC, RESET);

PImage duab; const char printout [9];

teeb tsa tsis muaj dab tsi () {Serial.begin (9600); myScreen.begin (); // sim nkag mus rau SD daim npav Serial.print ("Initializing SD card …"); yog (! SD.begin (SD_CS)) {Serial.println ("ua tsis tiav!"); rov qab; } Serial.println ("OK!");

// pib thiab tshem tawm GLCD npo myScreen.begin (); myScreen.background (255, 255, 255);

} void loop () {// nyeem cov analog hauv tus nqi: sensorValue = analogRead (analogInPin); // daim ntawv qhia nws mus rau qhov ntau ntawm cov analog tawm: outputValue = daim ntawv qhia (sensorValue, 0, 1023, 0, 255); String stuffToPrint = Txoj hlua (outputValue); // hloov tus nqi analog tawm:

stuffToPrint.toCharArray (luam tawm, 9); // zoo li ntawv myScreen.setTextSize (1);

Serial.print ("sensor ="); Serial.print (sensorValue); Serial.print ("\ t tso tawm ="); Serial.println (outputValue);

ncua (50);

yog (outputValue rau ", 10, 60); myScreen.text (" tau txais kev txhawb zog. ", 10, 70); rangeOne = cuav;}} yog (outputValue> 52 && outputValue 102 && outputValue 154 && outputValue <205) { / /range plaub yog (rangeFour == muaj tseeb) {rangeThree = tseeb; rangeFive = muaj tseeb; myScreen.setRotation (90); myScreen.background (255, 255, 255); // tshem qhov screen duab = myScreen.loadImage ("quote2.bmp "); // sau cov duab ntawm qhov screen myScreen.image (duab, 0, 0); myScreen.stroke (255, 255, 255); myScreen.text (" Kuv txaus siab heev ", 10, 50); myScreen.text ("ntawm koj!", 10, 60); rangeFour = cuav;}}

yog (outputValue> 206 && outputValue

Pom zoo: