Cov txheej txheem:

Diving Helmet Touch Lamp: 5 Kauj Ruam
Diving Helmet Touch Lamp: 5 Kauj Ruam

Video: Diving Helmet Touch Lamp: 5 Kauj Ruam

Video: Diving Helmet Touch Lamp: 5 Kauj Ruam
Video: ЗАПРЕЩЁННЫЕ ТОВАРЫ с ALIEXPRESS 2023 ШТРАФ и ТЮРЬМА ЛЕГКО! 2024, Hlis ntuj nqeg
Anonim
Diving Helmet Touch Teeb
Diving Helmet Touch Teeb
Diving Helmet Touch Teeb
Diving Helmet Touch Teeb
Diving Helmet Touch Teeb
Diving Helmet Touch Teeb
Diving Helmet Touch Teeb
Diving Helmet Touch Teeb

Hauv qhov kev qhia no

Koj yuav xav tau

  1. Lub kaus mom hlau dhia lossis sib npaug
  2. Neopixel tau tshaj lub nplhaib LED (Kuv siv lub nplhaib nrog 38 LEDs)
  3. Wemos ESP32 board (lossis sib npaug)
  4. 3D tshuab luam ntawv

Kauj Ruam 1: Luam Cov Xeem no

Cov ntu no yuav xav tau hloov kho yog tias koj siv lub kaus mom hlau sib txawv sib txawv, Kuv tau kawm tias ib qho uas kuv muaj yog qhov ncaj ncees

Kauj ruam 2: Upload Code

Muab koj tus ssid thiab tus lej nkag rau hauv tus lej ces rub mus rau koj lub rooj tsavxwm. Qhov no nyob ntawd kom tso cai OTA tso cov cai tshiab tom qab qhov haujlwm tau sib sau ua ke. Koj yuav tsum tau teeb tsa NeoPixelBus los ntawm Makuna muaj nyob ntawm no https://github.com/Makuna/NeoPixelBus Koj kuj tseem yuav tsum teeb tsa ESP32 pawg thawj coj txhais cov ntsiab lus rau hauv ib puag ncig arduino txhawm rau siv pawg no.

// Wifi Jazz #include #include #include #include bool wifi_timout = 0; const char* ssid = "SSID"; const char* password = "Password"; // Neopixel jazz #include const uint16_t PixelCount = 38; const uint8_t PixelPin = 19; int ximSaturation = 50; qhov ci ntsa iab = 50; int R = 0; int G = 0; int IB = 0; mem tes = 1600; // Ib nrab ntawm lub sijhawm nruab nrab ntawm kev sib tw RgbColor dub (0); // Khawm Jazz float Button1_total = 0; int kev = 50; const int debounce = 5; Ntab Button1 [debounce]; bool PWR = 0; NeoPixelBus ntiv nplhaib (PixelCount, PixelPin); teeb tsa tsis muaj dab tsi () {Serial.begin (115200); Serial.println ("Booting"); WiFi.mode (WIFI_STA); WiFi.begin (ssid, password); thaum (WiFi.waitForConnectResult ()! = WL_CONNECTED) {Serial.println ("Txuas tsis tau!"); ncua (5000); //ESP.restart (); } OTA_init (); touch_pad_init (); touchSetCycles (0x6000, 0x6000); // touch_pad_set_cnt_mode (0, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_HIGH); ntiv nplhaib. Pib (); nplhaib. Show (); } void loop () {if (millis () <600000) {ArduinoOTA.handle ();} lwm tus yog (wifi_timout == 0) {ArduinoOTA.end (); wifi_timout = 1; WiFi.mode (WIFI_OFF); btStop (); } yog (button1_capture () == 1) {ring. ClearTo (dub); ring. Show (); PWR =! PWR; } if (millis () <1500) {PWR = 0;} if (ring. CanShow () && PWR == 1) {Light (0);} ncua (10); } void OTA_init () {ArduinoOTA.onStart ( () {String type; if (ArduinoOTA.getCommand () == U_FLASH) type = "sketch"; else // U_SPIFFS type = "filesystem"; // NOTE: if hloov kho SPIFFS qhov no yuav yog qhov chaw rau unmount SPIFFS siv SPIFFS.end () Serial.println ("Pib kho dua tshiab" + hom);}).onEnd ( () {Serial.println ("\ nEnd");}).onProgress ( (unsigned int progress, unsigned int total) {Serial.printf ("Progress:%u %% / r", (progress / (total / 100)));}).onError ( (ota_error_t yuam kev) {Serial.printf ("Error [%u]:", error); if (error == OTA_AUTH_ERROR) Serial.println ("Auth Failed"); else if (error == OTA_BEGIN_ERROR) Serial.println ("Pib Ua tsis tau tejyam "); lwm yam yog (yuam kev == OTA_CONNECT_ERROR) Serial.println (" Txuas Tsis Tau "); lwm qhov yog (yuam kev == OTA_RECEIVE_ERROR) Serial.println (" Tau Txais Ua Tsis Tau "); lwm qhov yog (yuam kev == OTA_END_ERROR) Serial. println ("Xeem Ua Ntej");}); ArduinoOTA.begin (); Serial.println ("Npaj"); Serial.print ("IP chaw nyob:"); Serial.println (WiFi.localIP ()); } int button1_capture () {rau (int i = 0; i <(debounce-1); i ++) {Button1 = Button1 [i+1]; } Button1 [debounce-1] = (touchRead (T0)); ntab tam sim no = MaxArray (Button1); Ntab Button1_smooth = Button1_total/smoothing; // ntab tam sim no = AveArray (Button1); Serial.print (Button1_smooth); Serial.print (""); Serial.print (tam sim no); Serial.print (""); Serial.println (Button1 [debounce-1]); yog (tam sim no <(0.85*Button1_smooth)) {Button1_total = 0; // ua haujlwm raws li kev xa rov qab 1; } lwm {Button1_total = tam sim no +Button1_total -Button1_smooth; } rov qab 0; } ntab MaxArray (ntab MaxMe ) {ntab mxm = MaxMe [0]; ntab mnm = MaxMe [0]; rau (int kuv = 0; imxm) {mxm = MaxMe ; }} rov mxm; } ntab AveArray (ntab AveMe ) {ntab tag nrho = 0; ntab ave = 0; rau (int i = 0; i

Kauj ruam 3: Sib dhos

Los ua ke
Los ua ke

Hlau koj lub rooj tsavxwm raws li qhia thiab xyuas tias nws ua haujlwm.

Lub vas txuas nrog 'tuav' yuav ua lub khawm kov. Ntawm kuv lub rooj tsavxwm ESP32 T0 txuas nrog D4. Koj yuav tsum tau txheeb xyuas qhov no yog siv lwm lub rooj tsav xwm sib txawv.

Txuas cov xaim liab qab rau tus pin no yuav coj zoo ib yam. Nias nws ob zaug yuav tig nws qis qis ib yam li lub teeb pom kev hmo ntuj. 3 zaug me ntsis ci dua thiab 4 zaug dawb.

Kauj Ruam 4: Muab cov khoom tso rau hauv lub kaus mom hlau

Muab cov khoom tso rau hauv lub kaus mom hlau
Muab cov khoom tso rau hauv lub kaus mom hlau
Muab cov khoom tso rau hauv lub kaus mom hlau
Muab cov khoom tso rau hauv lub kaus mom hlau

Txhawm rau qhib lub teeb peb yuav siv tus kov ntawm lub kaus mom hlau ua lub ntsej muag kov. Qhov no txhais tau tias nws yuav tsum tau insulated los ntawm tus so ntawm lub kaus mom hlau. Tshem tus kov thiab npog lub ntsej muag tiv nrog daim kab xev thaiv. Kuv siv kab xev xim av los ua kom nws sib xyaw, nws tau hais txog xiav hauv daim duab. Laum tawm lub qhov kom cov ntsia hlau raug tshem tawm thiab rov pom tau nrog qee cov yas ntxhua khaub ncaws ntawm lwm sab.

Txuas koj lub khawm khawm mus rau ib qho ntawm cov tuav cov ntsia hlau siv lub tshuab txuas txuas.

Yog tias koj npaj yuav siv cov khoom siv hluav taws xob ntab (zoo nkauj tag nrho lawv) ces koj yuav tsum txuas GND tus pin rau lub cev ntawm lub kaus mom hlau tib yam. Tam sim no kom tig lub teeb teeb ib sab tes ntawm lub kaus mom hlau thiab kov tus kov nrog lwm tus.

Kauj Ruam 5: Txuas Lub Hwj Chim

Image
Image
Txuas lub Hwj Huam
Txuas lub Hwj Huam

Ntsia lub micro USB tawg pawg thawj coj saib mus rau 3D luam tawm bulkhead txuas tom qab ntawd nyab xeeb hauv qhov chaw nrog cov txiv ntoo.

Ib qho 5V DC lub zog siv hluav taws xob tuaj yeem siv tau tab sis cov khoom siv usb muaj ntau hauv kuv lub tsev. Kuv tau siv lub braided usb cable los ua piv txwv qhov qub flex thiab ua tiav qhov zoo.

Qhov ntawd yog koj ua tiav.

Yog tias koj xav hloov kho txoj cai los sim tawm xim ntxiv, cuam tshuam lossis timers ces nws yuav muaj raws li arduino OTA ntaus ntawv rau thawj 10 feeb txhua lub sijhawm nws tau ntsaws.

Pom zoo: