Cov txheej txheem:

Tus Neeg Hlau uas Qhia Yog Tus Neeg Muag Khoom Hluav Taws Xob tau dag koj lossis Tsis: 6 Kauj Ruam
Tus Neeg Hlau uas Qhia Yog Tus Neeg Muag Khoom Hluav Taws Xob tau dag koj lossis Tsis: 6 Kauj Ruam

Video: Tus Neeg Hlau uas Qhia Yog Tus Neeg Muag Khoom Hluav Taws Xob tau dag koj lossis Tsis: 6 Kauj Ruam

Video: Tus Neeg Hlau uas Qhia Yog Tus Neeg Muag Khoom Hluav Taws Xob tau dag koj lossis Tsis: 6 Kauj Ruam
Video: Tus Cawm Seej Hloov Neeg Txoj Hmoo (HD) 2024, Hlis ntuj nqeg
Anonim
Tus Neeg Hlau uas Qhia Yog Tus Neeg Muag Khoom Hluav Taws Xob tau dag koj lossis tsis yog
Tus Neeg Hlau uas Qhia Yog Tus Neeg Muag Khoom Hluav Taws Xob tau dag koj lossis tsis yog

Xyoo tas los, kuv thiab kuv txiv tau mus rau lub khw muag khoom tshiab uas muaj neeg hlau/hluav taws xob nyob ze rau qhov peb nyob. Thaum kuv nkag mus rau ntawd, Nws muaj cov khoom siv hluav taws xob, serovs, sensors, Raspberry pis, thiab Arduinos. Hnub tom ntej, peb tau mus rau tib lub khw thiab yuav ntau tus tswv cuab thiab 3 Arduinos tus nqi kwv yees li 150 USD. Thaum kuv mus tsev, tsis muaj lwm yam khoom ua haujlwm tshwj tsis yog Arduino Mega. Peb raug dag txog kwv yees li 130 USD uas yog ntau heev.

Yog li, kuv txiav txim siab los tsim tus neeg hlau uas tuaj yeem ntsuas txog 12 lub ntsuas thiab 2 lub cav (tseem ua haujlwm ntawm servo) thiab tuaj yeem txiav txim siab yog tias cov khoom puas.

Cia peb mus ncaj rau nws!

Khoom siv

1. Arduino UNO

2. 2.4 TFT touchscreen zaub

3. ob peb ntawm jumper xov hlau

4. sensors thiab motors kom koj tuaj yeem sim lawv (ntawm no kuv siv - Tsab ntawv tsa suab sensor, MQ6 roj sensor, Suab sensor, potentiometer thiab qib ntsuas dej)

Kauj Ruam 1: Nws Ua Haujlwm Li Cas …

Image
Image

Kuv tau teeb tsa Arduino los tsim thiab sib tham sib UI nrog TFT zaub. Raws li peb paub, TFT zaub tsuas muaj ib tus pin dawb xws li A5 tus pin. (yog tias koj siv UNO). Yog li txhua lub sensor uas siv tus pin Analog los nyeem cov ntaub ntawv tau tshaj qhov teeb tsa no …

Hauv UI, koj tuaj yeem hloov xim tom qab duab, thiab koj tuaj yeem qhib lub app uas tau tsim los rau Arduino los ntawm kuv los ntsuas cov ntsuas.

Thaum qhib lub app, koj tuaj yeem pom 2 qhov kev xaiv, INPUT thiab OUTPUT. yog li yog tias koj nyem Cov Lus Qhia, Nws qhia 4 lub cim (Nws tau sib xws nrog 12, tab sis kuv tseem tsis tau npaj nws raws li kuv tau kuaj mob mus txog…. tsis muaj sijhawm:(. Leej twg yog tus dawb los kho qhov chaws…)

Thiab nws tseem tuaj yeem tshawb xyuas yog tias lub tshuab servo ua haujlwm ntawm koj txuas nws hauv lub qhov.

muaj saib:

Kauj Ruam 2: Tshaj Tawm Txoj Cai

Txoj cai yog 600 kab kev pabcuam uas kuv tau ua tib zoo teev nyob rau hauv txog 50 teev. Nws muaj ob peb kab yog li plz hloov kho nws thiab xa nws tuaj rau kuv hauv kuv li ntawv ([email protected]).

Tshaj tawm cov cai thiab txuas daim npav TFT rau Arduino. Kuv qhia koj kom ua si ib puag ncig nrog UI kom koj tau txais kev dai zoo dua.

Cov cai:

#suav nrog

#include #include #include #define LCD_CS A3 #define LCD_CD A2 #define LCD_WR A1 #define LCD_RD A0 #define LCD_RESET A4 #define BLACK 0x0000 #define BLUE 0x001F #define NAVY 0x000F #define 0xF07E0F07E0F07E0F07E0F07E0F07E0F07E0F07E0E0F07E0F07E0F07E0F07E0F07E0F07E0F07E0F07E0F07E0F0E0F07 #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF #define LIGHTGREY 0xC618 #define PURPLE 0x780F #define OLIVE 0x7BE0 #define Selection #define YP A1 #define XM A2 #define XM A2 #define XM A2 #define XM A2 #define XM A2 160 #define TS_MAXX 160 #define TS_MAXY 970 TouchScreen ts = TouchScreen (XP, YP, XM, YM, 300); Adafruit_TFTLCD tft (LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); #define BOXSIZE 40 #define PENRADIUS 3 #define MINPRESSURE 10 #define MAXPRESSURE 1000 int suab; char xeev = 6; int kov = 0; int xim = BLACK; int redir = 0; koj tuaj; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); tft.reset (); tft.setFont (& FreeMonoBoldOblique12pt7b); tft.begin (0x9325); tft.setRotation (45); tft.setTextSize (0.5); tft.fillScreen (WHITE); tft.setCursor (60, 160); tft.setTextColor (BLACK); tft.print ("Los so kom nkag mus rau hauv"); } void loop () {ntab sensorVoltage; ntab sensorValue; TSPoint p = ts.getPoint (); tus pinMode (XM, OUTPUT); tus pinMode (YP, OUTPUT); yog (pz> MINPRESSURE && pz 240 && px 130 && py 240 && px 20 && py 240 && px 20 && py 160 && px 12 && py 240 && px 20 && py 240 && px 20 && py 40 && px 15 && py 150 && px 40 && py 150 && px 80 && py 150 && px 120 && py 150 && px 170 && py 90 && px 40 && py 90 && px 80 && py 90 && px 120 && py 150 && px 170 && py 150 && px 170 && py 150 && px 170 && py 150 && px 170 && py 150 && px 170 && py 100 && px 20 && py 200 && px 100 && py 100 && px 20 && py 100 && px 20 && py 100 && px 20 && py <100) {kov = 26; }} yog (kov == 1 && xeev == 6) {tft.setRotation (0); tft.fillScreen (xim); suab = 0; tft.fillRect (200, 180, 80, 140, WHITE); tft.drawRect (201, 181, 81, 141, HLOOV); tft.fillRect (80, 30, 100, 100, CYAN); tft.drawRect (81, 31, 101, 101, BLACK); tft.fillRect (10, 30, 50, 100, NAVY); tft.drawRect (11, 31, 51, 101, HLOOV); tft.fillRect (10, 180, 30, 120, PURPLE); tft.drawRect (11, 181, 31, 121, BLACK); tft.fillRect (45, 180, 30, 120, XEEB); tft.drawRect (46, 181, 31, 121, BLACK); tft.fillRect (80, 180, 30, 120, CYAN); tft.drawRect (81, 181, 31, 121, LOJ); tft.fillRect (115, 180, 30, 120, GREEN); tft.drawRect (116, 181, 31, 121, HLOOV); tft.fillRect (150, 180, 30, 120, YELLOW); tft.drawRect (151, 181, 31, 121, HLOOV); tft.fillTriangle (210, 30, 210, 50, 220, 40, WHITE); tft.fillRect (200, 35, 12, 12, WHITE); tft.drawTriangle (210, 30, 210, 50, 220, 40, BLACK); tft.drawRect (200, 35, 12, 12, BLACK); tft.drawCircle (210, 40, 14, WHITE); //tft.fillTriange (a1, b1, a2, b2, c1, c2, RED); tft.setRotation (45); tft.setCursor (200, 20); tft.print ("Chaw"); tft.fillRoundRect (45, 75, 75, 75, 4, WHITE); tft.drawRoundRect (45, 75, 75, 75, 4, BLACK); tft.fillRect (75, 75, 15, 30, BLACK); tft.fillRect (75, 120, 15, 30, BLACK); tft.fillRect (90, 105, 30, 15, BLACK); tft.fillRect (45, 105, 30, 15, BLACK); xeev = 7; kov = 0; tau = 0; } yog (kov == 2) {tft.fillScreen (WHITE); tft.setRotation (0); tft.fillTriangle (210, 30, 210, 50, 220, 40, WHITE); tft.fillRect (200, 35, 12, 12, WHITE); tft.drawTriangle (210, 30, 210, 50, 220, 40, BLACK); tft.drawRect (200, 35, 12, 12, BLACK); tft.drawCircle (210, 40, 14, BLACK); tft.setRotation (45); tft.fillTriangle (270, 40, 270, 20, 260, 30, BLACK); tft.drawLine (300, 30, 270, 30, BLACK); tft.setCursor (20, 200); tft.print ("tus kheej"); tft.setCursor (20, 170); tft.print ("tawm"); tft.setCursor (20, 140); tft.print ("peripherals"); tft.setCursor (20, 110); tft.print ("Txog"); kov = 1; xeev = 2; } yog (kov == 10 && xeev == 2) {tft.fillScreen (WHITE); tft.setCursor (10, 160); tft.setTextColor (BLACK); tft.print ("Tsim thiab tsim"); tft.setCursor (100, 190); tft.print ("los ntawm:"); tft.setCursor (60, 220); tft.print ("Tus hluas los ntawm Is Nrias teb"); tft.setRotation (0); tft.fillTriangle (210, 30, 210, 50, 220, 40, WHITE); tft.fillRect (200, 35, 12, 12, WHITE); tft.drawTriangle (210, 30, 210, 50, 220, 40, BLACK); tft.drawRect (200, 35, 12, 12, BLACK); tft.drawCircle (210, 40, 14, BLACK); tft.setRotation (45); tft.fillTriangle (270, 40, 270, 20, 260, 30, BLACK); tft.drawLine (300, 30, 270, 30, BLACK); xeev = 6; } yog (kov == 11 && xeev == 2) {tft.fillScreen (WHITE); tft.setCursor (60, 40); tft.print ("Xaiv a"); tft.setCursor (40, 60); tft.print ("xim tom qab"); tft.fillRect (60, 180, 45, 45, RED); tft.fillRect (120, 180, 45, 45, YELLOW); tft.fillRect (180, 180, 45, 45, XEEB); tft.fillRect (240, 180, 45, 45, GREEN); tft.fillRect (60, 130, 45, 45, MAGENTA); tft.fillRect (120, 130, 45, 45, NAVY); tft.fillRect (180, 130, 45, 45, LIGHTGREY); tft.fillRect (240, 130, 45, 45, CYAN); tft.fillRect (60, 80, 45, 45, WHITE); tft.drawRect (60, 80, 45, 45, BLACK); tft.fillRect (120, 80, 45, 45, BLACK); tft.fillRect (180, 80, 45, 45, OLIVE); tft.fillRect (240, 80, 45, 45, PURPLE); tft.setRotation (0); tft.fillTriangle (210, 30, 210, 50, 220, 40, WHITE); tft.fillRect (200, 35, 12, 12, WHITE); tft.drawTriangle (210, 30, 210, 50, 220, 40, BLACK); tft.drawRect (200, 35, 12, 12, BLACK); tft.drawCircle (210, 40, 14, BLACK); tft.setRotation (45); tft.fillTriangle (270, 40, 270, 20, 260, 30, BLACK); tft.drawLine (300, 30, 270, 30, BLACK); xeev = 6; yog (redir == 1) {xim = WHITE; } yog (redir == 2) {xim = BLACK; } yog (redir == 3) {xim = OLIVE; } yog (redir == 4) {xim = PURPLE; } yog (redir == 5) {xim = MAGENTA; } yog (redir == 6) {xim = NAVY; } yog (redir == 7) {xim = LIGHTGREY; } yog (redir == 8) {xim = CYAN; } yog (redir == 9) {xim = RED; } yog (redir == 10) {xim = YELLOW; } yog (redir == 11) {xim = BLUE; } yog (redir == 12) {xim = GREEN; }} yog (kov == 26) {ota = 1; tft.fillScreen (WHITE); tft.setRotation (0); tft.fillTriangle (210, 30, 210, 50, 220, 40, WHITE); tft.fillRect (200, 35, 12, 12, WHITE); tft.drawTriangle (210, 30, 210, 50, 220, 40, BLACK); tft.drawRect (200, 35, 12, 12, BLACK); tft.drawCircle (210, 40, 14, BLACK); tft.setRotation (45); tft.fillTriangle (270, 40, 270, 20, 260, 30, BLACK); tft.drawLine (300, 30, 270, 30, BLACK); tft.setRotation (1); tft.setCursor (30, 80); tft.print ("Tswv yim"); tft.setCursor (30, 150); tft.print ("Tawm"); tft.drawRect (25, 130, 90, 30, BLACK); tft.drawRect (25, 60, 90, 30, BLACK); yog (p.x> 190 && p.x 30 && p.y <90) {tft.setCursor (150, 220); tft.print ("Dej theem"); tft.setCursor (150, 170); tft.print ("Qib roj"); tft.setCursor (150, 120); tft.print ("Nyob nrug deb"); tft.setCursor (150, 70); tft.print ("Suab"); kov = 1; xeev = 2; }}} thaum (suab == 1) {tft.fillScreen (WHITE); sensorValue = analogRead (A5); sensorVoltage = sensorValue; tft.setCursor (60, 160); tft.print (sensorVoltage); Serial.println ("Suab theem ="); Serial.println (sensorVoltage); ncua (1000); yog (suab == 0) {tawg; }}}}

Kauj Ruam 3: Cov Tsev Qiv Ntawv Yuav Tsum Tau:

  • Adafruit_GFX.h
  • Adafruit_TFTLCD.h
  • TouchScreen.h

Github txuas rau tib yam:

github.com/adafruit/Adafruit-GFX-Library

github.com/adafruit/TFTLCD-Library

github.com/adafruit/Adafruit_TouchScreen

Kauj Ruam 4: Kev Sib Txuas

Slap Nws Txhua Qhov Ua Ke
Slap Nws Txhua Qhov Ua Ke

Koj xav tau 6 jumper xov hlau. 3 txiv neej thiab 3 poj niam. solder lawv ncaj qha rau Arduino board zoo li no:

Kauj Ruam 5: Khawb Txhua Qhov Ua Ke

Muab cov xov hlau txuas mus rau arduino (xa duab), Siv qee rab phom yog tias xav tau …

Tom qab ntawd Txuas daim iav tiv thaiv TFT tom qab ntawv sim koj lub Sensors.

Ua tsaug rau koj txoj kev nqes mus. Nco ntsoov pov npav rau kuv yog tias koj xav tias txoj haujlwm no tshwj xeeb thiab pab tau

Zoo siab ua thiab ceev faj ntawm Electronics scammers?

Kauj Ruam 6: Kev Txhim Kho Ntxiv:

  • Ntau sensor sib xws
  • Servo motor code yuav tsum ua tiav
  • Lwm lub app uas tuaj yeem cuam tshuam nrog Bluetooth modules yog li peb tuaj yeem tswj hwm Bluetooth siv neeg hlau nrog nws.
  • Kab laum kho

Pom zoo: