Mundarija:

Arduino IDE yordamida M5stick C yordamida soat yasash - M5stack M5stick-C bilan RTC real vaqt soati: 4 qadam
Arduino IDE yordamida M5stick C yordamida soat yasash - M5stack M5stick-C bilan RTC real vaqt soati: 4 qadam

Video: Arduino IDE yordamida M5stick C yordamida soat yasash - M5stack M5stick-C bilan RTC real vaqt soati: 4 qadam

Video: Arduino IDE yordamida M5stick C yordamida soat yasash - M5stack M5stick-C bilan RTC real vaqt soati: 4 qadam
Video: Laser distance measurement with M5Stack Core2 ESP32 and VL53L0X with Arduino - Robojax 2024, Noyabr
Anonim
Image
Image
Sizga kerak bo'lgan narsalar
Sizga kerak bo'lgan narsalar

Assalomu alaykum do'stlar, biz m5stick-ning m5stick-dan Arduino IDE yordamida soat yasashni o'rganamiz, shuning uchun m5stick displeyda oyning sanasi, vaqti va haftasini ko'rsatadi.

1 -qadam: Sizga kerak bo'lgan narsalar

Bu ko'rsatmalarni o'qish uchun sizga quyidagilar kerak bo'ladi:

m5stick-c ishlab chiqarish kartasi C tipidagi kabel

2 -qadam: Arduino IDE -ni sozlash

Arduino IDE -ni sozlash
Arduino IDE -ni sozlash

Arduino IDE-ga ESP32 taxtalarini o'rnatganingizga ishonch hosil qiling va agar bunday bo'lmasa, iltimos, quyidagi ko'rsatmalarga amal qiling: ESP32 BOARDS INSTALL:

3 -qadam: kod

Kod
Kod

Quyidagi kodni nusxa ko'chiring va uni m5stick-C ishlab chiqish kartasiga yuklang: "M5StickC.h" RTC_TimeTypeDef RTC_TimeStruct; RTC_DateTypeDef RTC_DateStruct; void setup () {// bir marta ishga tushirish uchun sozlash kodingizni bu erga qo'ying: M5.begin (); M5. Lcd.setRotation (3); M5. Lcd.fillScreen (Qora); M5. Lcd.setTextSize (1); M5. Lcd.setCursor (40, 0, 2); M5. Lcd.println ("RTC TEST"); RTC_TimeTypeDef TimeStruct; TimeStruct. Hours = 18; TimeStruct. Minutes = 56; TimeStruct. Seconds = 10; M5. Rtc. SetTime (& TimeStruct); RTC_DateTypeDef DateStruct; DateStruct. WeekDay = 3; DateStruct. Month = 3; DateStruct. Date = 22; DateStruct. Year = 2019; M5. Rtc. SetData (& DateStruct);} void loop () {// qayta ishga tushirish uchun asosiy kodingizni bu erga qo'ying: M5. Rtc. GetTime (& RTC_TimeStruct); M5. Rtc. GetData (& RTC_DateStruct); M5. Lcd.setCursor (0, 15); M5. Lcd.printf ("Ma'lumotlar:%04d-%02d-%02d / n", RTC_DateStruct. Year, RTC_DateStruct. Month, RTC_DateStruct. Date); M5. Lcd.printf ("Hafta: %d / n", RTC_DateStruct. WeekDay); M5. Lcd.printf ("Vaqt: %02d: %02d: %02d / n", RTC_TimeStruct. Hours, RTC_TimeStruct. Minutes, RTC_TimeStruct. Seconds); kechikish (500);}

4 -qadam: Sana, vaqt va haftaning sonini ko'rsatish

Image
Image

Kodni yuklaganingizdan so'ng siz displeyni ko'rishingiz mumkin va oyning sanasi va haftasi xuddi mening holimda ko'rsatilgandek ko'rsatiladi. Agar siz bu soatning to'g'ri ishlashini ko'rmoqchi bo'lsangiz, iltimos, taqdim etilgan videoga qarang va ruxsat bering. Agar siz bu haqda biror narsa aytmoqchi bo'lsangiz, sharhlar bo'limida bilaman.

Tavsiya: