Mundarija:
2025 Muallif: John Day | [email protected]. Oxirgi o'zgartirilgan: 2025-01-13 06:58
Bu loyiha instagram izdoshlari va youtube obunachilarini sanashga mo'ljallangan.
platformalar ishlatiladi:
Python
Arduino
1 -qadam: Materiallar / asboblar:
- Arduino bilan
- Lcd qalqoni
- Dasturlash kabeli
- Windows kompyuter
2 -qadam: Api kalitlarini yarating
Api instagram uchun
Ushbu veb -saytga o'ting:
va kirishni yaratish tokenini bosing
YouTube api uchun
Siz ushbu veb-saytdagi qadamlarni bajarishingiz mumkin:
3 -qadam: Sketch -ni Arduino -ga yuklang
Siz mening Github sahifamdan kod va dasturlarni yuklab olishingiz mumkin:
github.com/ayberkeren/social-media-counter
Arduino kodi:
#qo'shing
Youtube_name = "" qatori; // sizning youtube nomingiz String youtube_token = ""; // youtube tokeningiz String instagram_token = ""; // sizning instagram tokeningiz imzosiz uzoq DELAY = 10; // ekranga kechikish (soniya) // lcd ekran pimlarini o'rnating const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7; LiquidCrystal lcd (rs, en, d4, d5, d6, d7); // o'zgaruvchilar yaratish imzosiz uzoq izdosh = 0, izdosh2 = 0, obunachi = 0, obunachi2 = 0, x = millis (); // logotiplar uchun bayt yaratish instagram1 [8] = {0b00000, 0b01111, 0b10000, 0b10000, 0b10000, 0b10000, 0b10000, 0b11111}; bayt instagram2 [8] = {0b00000, 0b11111, 0b00000, 0b00000, 0b00000, 0b00000, 0b01110, 0b10001}; bayt instagram3 [8] = {0b00000, 0b11110, 0b00001, 0b11001, 0b11001, 0b00001, 0b00001, 0b11111}; bayt instagram4 [8] = {0b10000, 0b10000, 0b10000, 0b10000, 0b10000, 0b10000, 0b10000, 0b01111}; bayt instagram5 [8] = {0b10001, 0b10001, 0b01110, 0b00000, 0b00000, 0b00000, 0b00000, 0b11111}; bayt instagram6 [8] = {0b00001, 0b00001, 0b00001, 0b00001, 0b00001, 0b00001, 0b00001, 0b11110}; bayt youtube1 [8] = {0b11111, 0b11100, 0b11000, 0b10000, 0b10000, 0b10000, 0b10000, 0b10000}; bayt youtube2 [8] = {0b11111, 0b00000, 0b10000, 0b11000, 0b11100, 0b11110, 0b11111, 0b11111}; bayt youtube3 [8] = {0b11111, 0b00111, 0b00011, 0b00001, 0b00001, 0b00001, 0b00001, 0b10001}; bayt youtube4 [8] = {0b10000, 0b10000, 0b10000, 0b10000, 0b10000, 0b11000, 0b11100, 0b11111}; bayt youtube5 [8] = {0b11111, 0b11111, 0b11110, 0b11100, 0b11000, 0b10000, 0b00000, 0b11111}; bayt youtube6 [8] = {0b10001, 0b00001, 0b00001, 0b00001, 0b00001, 0b00011, 0b00111, 0b11111}; void setup () {lcd.begin (16, 2); // ishga tushirish lcd Serial.begin (9600); // ketma -ket aloqani kechiktirishni boshlash (2000); Serial.println (youtube_name); // dasturni kechiktirishga o'zgaruvchilarni ayting (1000); Serial.println (youtube_token); // dasturni kechiktirishga o'zgaruvchilarni ayting (1000); Serial.println (instagram_token); // o'zgaruvchilarni dasturga ayting}
void loop () {
if (x <(DELAY*1000)) {drawinstagram (); lcd.setCursor (5, 1); lcd.print (izdosh); while (x0) {follower2 = Serial.parseInt (); abonent2 = Serial.parseInt (); } x = millis (); x = x%(kechiktirish*2000); } obunachi = obunachi2; izdosh = izdosh2; }
boshqa {drawyoutube (); lcd.setCursor (5, 1); lcd.print (abonent); while (x> = (DELAY*1000) && subscriber2 == abonent) {while (Serial.available ()> 0) {follower2 = Serial.parseInt (); abonent2 = Serial.parseInt (); } x = millis (); x = x%(kechiktirish*2000); } obunachi = obunachi2; izdosh = izdosh2; }}
// instagram logotipini chizish
yaroqsiz drawinstagram () {lcd.createChar (0, instagram1); lcd.createChar (1, instagram2); lcd.createChar (2, instagram3); lcd.createChar (3, instagram4); lcd.createChar (4, instagram5); lcd.createChar (5, instagram6); lcd.clear (); lcd.setCursor (1, 0); lcd.write (bayt (0)); lcd.write (bayt (1)); lcd.write (bayt (2)); lcd.setCursor (1, 1); lcd.write (bayt (3)); lcd.write (bayt (4)); lcd.write (bayt (5)); lcd.setCursor (5, 0); lcd.print ("Izdoshlar"); }
// youtubelogo chizish
yaroqsiz drawyoutube () {lcd.createChar (6, youtube1); lcd.createChar (7, youtube2); lcd.createChar (8, youtube3); lcd.createChar (9, youtube4); lcd.createChar (10, youtube5); lcd.createChar (11, youtube6); lcd.clear (); lcd.setCursor (1, 0); lcd.write (bayt (6)); lcd.write (bayt (7)); lcd.write (bayt (8)); lcd.setCursor (1, 1); lcd.write (bayt (9)); lcd.write (bayt (10)); lcd.write (bayt (11)); lcd.setCursor (5, 0); lcd.print ("Obunachilar"); }
4 -qadam: Python
Men 2 ta python dasturini yaratdim, ulardan biri grafik foydalanuvchi interfeysiga ega, ikkinchisi faqat bashda ishlaydi
Siz ikkalasini ham ishlatishingiz mumkin, chunki ular bir xil narsalarni qiladilar.
Ro'yxatdagi qaysi portga arduino ulanganligini tanlashingiz va tanlash tugmasini bosishingiz kerak.
va siz BILDingiz …
Github-dan dasturlarni yuklab oling: