﻿  AI & Machine Learning Uyumlu IO Kartları ve Yazılım Çözümleri Makina Öğrenmesi — Seda Elektronik     { "@context": "https://schema.org", "@type": "TechArticle", "headline": "Yapay zeka uygulamaları ve ai makina öğrenmesi eğitiminde Ethernet Usb IP Buton Röle Kontrol IO Kartları Kullanımı", "description": "Machine Learning ve AI projeleri için seda elektronik donanımları ile çözüme ulaşın. Pyhton nodejs c# vb6 labview. geniş kod desteği ile yanınızdayız.", "author": { "@type": "Organization", "name": "Seda Elektronik" }, "publisher": { "@type": "Organization", "name": "Seda Elektronik", "logo": { "@type": "ImageObject", "url": "https://sedaelektronik.com.tr/seda-elektronik-logo.webp" } }, "datePublished": "2026-02-15", "dateModified": "2026-02-15", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://sedaelektronik.com.tr/ai-ml.html" } } :root{ --bg:#000; --card:#0b0b0b; --muted:#9aa3b2; --accent:#0b75ff; --glass: rgba(255,255,255,0.04); --radius:14px; font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif; } \*,\*::before,\*::after{ box-sizing:border-box; } html,body{height:100%;margin:0;} body{ background:linear-gradient(180deg, #000 0%, #060606 100%); color:#e6eef8; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; padding:16px; } .container{ max-width:1100px; margin:0 auto; width:100%; } header{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; } .brand{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; width:100%; } .brand img{ max-width:200px; width:100%; height:auto; } h1{ margin:0; font-size:clamp(18px, 4vw, 24px); word-wrap:break-word; } h2{ font-size:clamp(14px, 3vw, 18px); margin:8px 0; word-wrap:break-word; } p.lead{ color:var(--muted); margin-top:6px; font-size:clamp(13px, 2.5vw, 15px); word-wrap:break-word; } .hero{ display:grid; grid-template-columns:1fr; gap:28px; margin-top:28px; } .card{ background:var(--card); border-radius:var(--radius); padding:22px; box-shadow:0 6px 18px rgba(2,6,23,0.6); width:100%; overflow:hidden; } .card h3{ font-size:clamp(16px, 3vw, 20px); word-wrap:break-word; } .card p{ word-wrap:break-word; overflow-wrap:break-word; } .features{ display:grid; grid-template-columns:1fr; gap:12px; margin-top:14px; } .feature{ background:var(--glass); padding:12px; border-radius:10px; } .feature h3{ margin:0; font-size:15px; word-wrap:break-word; } .feature p{ margin:6px 0 0 0; color:var(--muted); font-size:13px; word-wrap:break-word; } .right-card{ width:100%; } .list{ margin:12px 0 0 0; padding:0; list-style:none; } .list li{ padding:10px 12px; border-radius:10px; margin-bottom:8px; background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); font-weight:600; word-wrap:break-word; } footer{ margin-top:36px; color:var(--muted); font-size:13px; } footer > div{ display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; } /\* Navigation Styles \*/ nav { display: flex; flex-wrap: wrap; justify-content: center; background-color: #000; padding: 10px; margin-top:20px; } nav a.btn { color: #fff; text-decoration: none; padding: 10px 15px; margin: 3px; background-color: #007BFF; border-radius: 6px; transition: background-color 0.3s; font-weight: 500; cursor: pointer; font-size:clamp(12px, 2.5vw, 14px); } nav a.btn:hover { background-color: #0056b3; } .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #111; min-width: 260px; box-shadow: 0px 8px 16px rgba(0,0,0,0.4); z-index: 99; border-radius: 8px; left:50%; transform:translateX(-50%); } .dropdown-content a { color: #fff; padding: 10px 15px; text-decoration: none; display: block; border-bottom: 1px solid #222; font-size:clamp(12px, 2.5vw, 14px); word-wrap:break-word; } .dropdown-content a:hover { background-color: #007BFF; } .dropdown:hover .dropdown-content { display: block; } /\* Image responsive \*/ .card img{ max-width:100%; height:auto; display:block; } /\* Code blocks responsive \*/ pre { background:#111; color:#0f0; padding:12px; border-radius:6px; font-size:clamp(10px, 2vw, 13px); overflow-x:auto; overflow-y:hidden; white-space:pre; word-wrap:normal; max-width:100%; margin:10px 0; } pre code{ display:block; overflow-x:auto; } /\* Contact container \*/ .contact-container { display: flex; flex-direction: column; gap: 10px; margin: 15px 0; } .white-button { display: block; width: 100%; padding: 10px 20px; background-color: #ffffff; color: #333333 !important; text-decoration: none !important; border: 1px solid #dddddd; border-radius: 6px; font-weight: 600; font-size: 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: all 0.2s ease; text-align:center; } .white-button:hover { background-color: #f0f0f0; border-color: #cccccc; transform: translateY(-1px); } /\* Tablet breakpoint \*/ @media (min-width:768px){ body{ padding:24px; } .features{ grid-template-columns:repeat(2,1fr); } .hero{ grid-template-columns:1fr 360px; } .right-card{ position:sticky; top:32px; width:auto; } .white-button{ width:fit-content; } } /\* Desktop breakpoint \*/ @media (min-width:980px){ body{ padding:32px; } } /\* Mobile specific \*/ @media (max-width:767px) { .brand{ flex-direction:column; align-items:flex-start; } .dropdown-content { position: static; width: 100%; box-shadow: none; transform:none; left:auto; } nav{ flex-direction: column; align-items: stretch; } .dropdown{ width:100%; } nav a.btn{ width:100%; text-align:center; } }

[![Seda Elektronik AI Uyumlu Ethernet ve USB IO Kartları](https://sedaelektronik.com.tr/seda-elektronik-logo.webp)](https://sedaelektronik.com.tr/ "Seda Elektronik Ana Sayfa")

AI & Machine Learning Uyumlu IO Çözümleri
=========================================

Python ve Node.js ile Yapay Zeka Destekli Röle Kontrolü ve Giriş Takip
----------------------------------------------------------------------

### MQTT ve Makina Öğrenmesi Tabanlı Otomasyon

#### 📄Hızlı Bakış Kontrol Parametreleri - Ethernet - Usb ( 7 PYTHON DOC Header, module docstring, usage header )

Python, Node.js MQTT, Modbus TCP ve HTTP ile çalışan Ethernet & USB IO kartları — yapay zekâ projelerinizi fiziksel dünyaya bağlayın.

MENU▼

[Ethernet Röle Kontrol IO Ürünleri](https://sedaelektronik.com.tr/internetten-role-cihaz-kontrol.html) [USB Röle Kontrol Ürünleri](https://sedaelektronik.com.tr/bilgisayardan-role-kontrol.html) [DMX512 Ürünleri](https://sedaelektronik.com.tr/dmx-kontrol.html) [Diğer Ürünler](https://sedaelektronik.com.tr/diger-urunler.html) [Ethernet Kod Örnekleri](https://sedaelektronik.com.tr/ethernet.html) [USB Kod Örnekleri](https://sedaelektronik.com.tr/USB-HID-COM-CDC.html) [Ürün Kılavuzları](https://sedaelektronik.com.tr/guide.html) [Canlı Demo](https://www.youtube.com/@sedaelektronik/streams) [İletişim](https://sedaelektronik.com.tr/#iletisim) [AI & Machine Learning](https://sedaelektronik.com.tr/ai-ml.html "AI ve Machine Learning Uyumlu Ethernet IO Kartları") [IP Değiştirme Programı](https://sedaelektronik.com.tr/ip-change.html "İletişim")

.search-container { max-width: 700px; margin: 24px auto; position: relative; } #searchInput { width: 100%; padding: 14px 20px; font-size: 1rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)); color: #e6eef8; box-shadow: 0 4px 12px rgba(2,6,23,0.4); transition: all 0.3s ease; } #searchInput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11,108,255,0.2); } #searchInput::placeholder { color: var(--muted); } #searchResults { position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px; background: var(--card); border-radius: 12px; box-shadow: 0 8px 24px rgba(2,6,23,0.6); border: 1px solid rgba(255,255,255,0.05); max-height: 400px; overflow-y: auto; display: none; z-index: 1000; } .search-result-item { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: background 0.2s ease; } .search-result-item:hover { background: rgba(11,108,255,0.1); } .search-result-item:last-child { border-bottom: none; } .search-result-title { color: var(--accent); font-weight: 600; margin-bottom: 4px; } .search-result-snippet { color: var(--muted); font-size: 0.9rem; line-height: 1.4; } .search-result-url { color: #3ac3ff; font-size: 0.85rem; margin-top: 4px; } .no-results { padding: 20px; text-align: center; color: var(--muted); } @media (max-width: 768px) { .search-container { margin: 16px auto; } #searchInput { font-size: 0.95rem; padding: 12px 16px; } } // Site içindeki tüm HTML sayfalarınızın listesi const sitePages = \[ { url: 'index.html', title: 'Ana Sayfa - Ethernet USB GSM Röle Kontrol Kartları', keywords: 'ethernet röle usb gsm kontrol dmx512 otomasyon io kart', description: 'Ethernet, USB ve GSM tabanlı röle kontrol kartları ve DMX512 çevirici modüller canlı demo CANLI DEMO' }, { url: 'internetten-role-cihaz-kontrol.html', title: 'Ethernet Röle Kontrol IO Ürünleri NETWORK network tcp udp get http TCP UDP GET HTTP REQUEST request', keywords: 'ethernet röle tcp udp modbus http get io kontrol', description: 'Ethernet tabanlı röle kontrol kartları ve IO modülleri' }, { url: 'bilgisayardan-role-kontrol.html', title: 'USB Röle Kontrol Ürünleri NETWORK network', keywords: 'usb röle hid cdc com port bilgisayar kontrol', description: 'USB HID ve CDC tabanlı röle kontrol kartları kart devre' }, { url: 'dmx-kontrol.html', title: 'DMX512 Ürünleri', keywords: 'dmx512 sahne ışık robot par rgb konvertör çevirici NETWORK network', description: 'DMX512 konvertör ve kontrol ürünleri' }, { url: 'diger-urunler.html', title: 'Diğer Ürünler', keywords: 'gsm sms röle kontrol otomasyon dmx dmx512 DMX DMX512 süpürge merkezi pickat ısı nem ölçüm sıcaklık', description: 'GSM ve diğer kontrol ürünleri ip button ipbutton IPBUTTON IP BUTTON ip buton IP buton' }, { url: 'guide.html', title: 'Kılavuzlar ve Broşürler NETWORK network', keywords: 'kullanım kılavuzu broşür döküman teknik destek tcp udp get http TCP UDP GET HTTP REQUEST request', description: 'Ürün kılavuzları ve teknik dökümanlar' }, { url: 'yazilim.html', title: 'Yazılım Geliştirme', keywords: 'yazılım api sdk geliştirme programlama c# C# phyton node js vbnet delphi ', description: 'Yazılım geliştirme kaynakları c++ C++ linux tcp udp get vb.net visual basic' }, { url: 'ethernet.html', title: 'Ethernet GET TCP UDP Kodları', keywords: 'ethernet tcp udp http get kod örnek NETWORK network tcp udp get http TCP UDP GET HTTP REQUEST request', description: 'Ethernet protokol kod örnekleri c# C# phyton node js vbnet delphi c++ C++ linux tcp udp get vb.net visual basic' }, { url: 'USB-HID-COM-CDC.html', title: 'USB HID COM CDC Kodları', keywords: 'usb hid com cdc kod örnek serial port', description: 'USB iletişim kod örnekleri' }, { url: 'ai-ml.html', title: 'AI & Machine Learning Uyumlu IO Çözümleri NETWORK network', keywords: 'ai machine learning yapay zeka otomasyon io', description: 'AI ve makine öğrenimi uyumlu kontrol çözümleri' }, { url: 'ip-change.html', title: 'USB HID COM CDC Kodları ip IP İp değiştirme değişikliği', keywords: 'usb hid com cdc kod örnek serial port', description: 'USB iletişim kod örnekleri ip gateway subnetmask' } \]; const searchInput = document.getElementById('searchInput'); const searchResults = document.getElementById('searchResults'); searchInput.addEventListener('input', function() { const query = this.value.toLowerCase().trim(); if (query.length < 2) { searchResults.style.display = 'none'; return; } const results = sitePages.filter(page => { return page.title.toLowerCase().includes(query) || page.keywords.toLowerCase().includes(query) || page.description.toLowerCase().includes(query); }); displayResults(results, query); }); function displayResults(results, query) { if (results.length === 0) { searchResults.innerHTML = '<div class="no-results">Sonuç bulunamadı</div>'; searchResults.style.display = 'block'; return; } const html = results.map(page => { const snippet = highlightText(page.description, query); const title = highlightText(page.title, query); return \` <div class="search-result-item" onclick="window.location.href='${page.url}'"> <div class="search-result-title">${title}</div> <div class="search-result-snippet">${snippet}</div> <div class="search-result-url">${page.url}</div> </div> \`; }).join(''); searchResults.innerHTML = html; searchResults.style.display = 'block'; } function highlightText(text, query) { const regex = new RegExp(\`(${query})\`, 'gi'); return text.replace(regex, '<strong style="color: #3ac3ff;">$1</strong>'); } // Sayfa dışına tıklandığında sonuçları gizle document.addEventListener('click', function(e) { if (!e.target.closest('.search-container')) { searchResults.style.display = 'none'; } });

##### Yapay Zekâ Destekli Donanım Entegrasyonu - Makina Öğrenmesi PYTHON ve NODE JS Api Örnekleri

![AI ML Röle Kontrol - Seda Elektronik](https://sedaelektronik.com.tr/pictures/ai-ml-role-kontrol.webp)

Seda Elektronik IO kartları; yapay zekâ (AI), makine öğrenimi (ML) ve Edge AI projelerinde sensör verilerinin işlenmesi ve AI kararlarının röle, dijital çıkış ve sahaya uygulanması için tasarlanmıştır.

### AI Karar Tabanlı Röle Kontrolü

Makine öğrenimi çıktılarıyla otomatik röle, alarm ve yük kontrolü.

### Edge AI & Sensör Analizi

Gaz, sıcaklık, nem ve dijital giriş verileriyle anomali tespiti.

### MQTT & Event-Driven Mimari

AI olaylarıyla düşük gecikmeli tetikleme ve uzaktan kontrol.

### Endüstriyel AI Entegrasyonu

SCADA, Modbus TCP ve server tabanlı AI sistemleriyle uyum.

### Python node.js & AI Uyumluluğu

Python ve node.js tabanlı AI modelleri; TensorFlow, PyTorch veya özel algoritmalar ile üretilen kararlar, Ethernet veya USB üzerinden IO kartlarımıza doğrudan uygulanabilir. Aşağıdaki Get, Tcp, Udp read-write-sensor USB Hid Cdc kod örneklerini Ürünlerimizle Python Node.js projelerinizde kullanabilirsiniz.

Aşağıdaki Get, Tcp, Udp read-write-sensor USB Hid Cdc kod örneklerini Ürünlerimizle Python projelerinizde kullanabilirsiniz.

C# delphi vbnet ve diğer dillerin ethernet örneklerini [buradan](https://sedaelektronik.com.tr/ethernet.html), usb örneklerini [buradan](https://sedaelektronik.com.tr/USB-HID-COM-CDC.html) inceleyebilir, Canlı Demo Testlerini [buradan](https://www.youtube.com/@sedaelektronik/streams) yapabilirsiniz. Yapay zeka ile kullanmak istediğiniz bütün sensörleri, dijital io'ları ai projenize aktarırız.

NODE.JS ve PHYTON GET TCP UDP READ-WRITE SENSOR DS18B20 ÖRNEK KODLAR İNDİRİLEBİLİR. [BURADAN](https://drive.google.com/file/d/18K6CPIXIf2BzNAnlkLkUZIsDwzsktfLZ/view?usp=sharing), ve [BURADAN](https://drive.google.com/file/d/1_gt1k4dobKnS9nQ6RS0EruXa0EYPdX08/view?usp=sharing), İNDİREBİLİRSİNİZ.  
KOD TESTLERİ İÇİN bolt.new KULLANILABİLİR  
  
Kod Listesi:  

*   1- PYTHON GET WRITE-READ PORTS and READ SENSOR DS18B20 SAMPLE CODE:
*   2- PYTHON GET READ PORTS SAMPLE CODE
*   3-1 PYTHON MQTT TCP READ-WRITE CODE:
*   3-2 PYTHON TCP READ-WRITE CODE
*   4- PYTHON UDP WRITE CODE
*   5- PYTHON USB HID CODE
*   6- PYTHON USB CDC CODE
*   7-1 RASPBERRY PI RASPBIAN PYTHON GET CODE
*   7-2 RASPBERRY PI RASPBIAN PYTHON RELAY CONTROLLER LIST FILE
*   7-3 RASPBERRY PI RASPBIAN PYTHON RELAY URLS LIST FILE

1- PYTHON GET WRITE-READ PORTS and READ SENSOR DS18B20 SAMPLE CODE:

    
    #Seda Elektronik Ethernet Röle Kartı – Python API Wrapper
    #Bu modül Seda Elektronik Get Ethernet röle kartlarından port durumlarını
    #okumak için kullanılır. HTTP üzerinden karttan veri çekilir ve port
    #değerleri parse edilerek JSON formatında döndürülür.
    #────────────────────────────────────────
    #CİHAZ BAĞLANTI BİLGİLERİ
    #────────────────────────────────────────
    #Protokol  : HTTP GET
    #Port      : 3000
    #URL (write)       : http://IP_ADRESI:3000/"parametre"
    #URL (read)       : http://IP_ADRESI:3000/s
    #Örnek:
    #http://169.254.1.2:3000/s
    #Cihazın döndürdüğü veri formatı:
    #    var PORTB=     0;
    #    var PORTD=     0;
    #    var PORTA=     0;
    #    var PORTE=     0;
    #    var TEMP1=  22.3;
    #    var TEMP2=  22.2;
    
    #────────────────────────────────────────
    #RÖLE AÇMA GET REQUEST KOMUTLARI (ETHERNET 2 RÖLE İÇİN AŞAĞIDAKİ BİLGİLERİ İNCELEYİNİZ)
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le)
    #Daha fazla bilgi için pdf kılavuzumuzu inceleyiniz:
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/HIZLI-KURULUM-KILAVUZU.pdf 
    #────────────────────────────────────────
    
    #|  Röle   | Parametre |          Örnek            |
    #|------   |-----------|---------------------------|
    #| RÖLE 1  | `/1`      | http://169.254.1.2:3000/1 |
    #| RÖLE 2  | `/2`      | http://169.254.1.2:3000/2 |
    #| RÖLE 3  | `/3`      | http://169.254.1.2:3000/3 |
    #| RÖLE 4  | `/4`      | http://169.254.1.2:3000/4 |
    #| RÖLE 5  | `/5`      | http://169.254.1.2:3000/5 |
    #| RÖLE 6  | `/6`      | http://169.254.1.2:3000/6 |
    #| RÖLE 7  | `/7`      | http://169.254.1.2:3000/7 |
    #| RÖLE 8  | `/8`      | http://169.254.1.2:3000/8 |
    #| RÖLE 9  | `/9`      | http://169.254.1.2:3000/9 |
    #| RÖLE 10 | `/0`      | http://169.254.1.2:3000/0 |
    #| RÖLE 11 | `/a`      | http://169.254.1.2:3000/a |
    #| RÖLE 12 | `/b`      | http://169.254.1.2:3000/b |
    #| RÖLE 13 | `/c`      | http://169.254.1.2:3000/c |
    #| RÖLE 14 | `/d`      | http://169.254.1.2:3000/d |
    #| RÖLE 15 | `/e`      | http://169.254.1.2:3000/e |
    #| RÖLE 16 | `/L`      | http://169.254.1.2:3000/L |
    
    #────────────────────────────────────────
    #RÖLE KAPATMA GET REQUEST KOMUTLARI
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le) 
    #────────────────────────────────────────
    
    #|  Röle   | Parametre |          Örnek            |
    #|------   |-----------|---------------------------|
    #| RÖLE 1  | `/i`      | http://169.254.1.2:3000/i |
    #| RÖLE 2  | `/g`      | http://169.254.1.2:3000/g |
    #| RÖLE 3  | `/h`      | http://169.254.1.2:3000/h |
    #| RÖLE 4  | `/j`      | http://169.254.1.2:3000/j |
    #| RÖLE 5  | `/k`      | http://169.254.1.2:3000/k |
    #| RÖLE 6  | `/l`      | http://169.254.1.2:3000/l |
    #| RÖLE 7  | `/m`      | http://169.254.1.2:3000/m |
    #| RÖLE 8  | `/n`      | http://169.254.1.2:3000/n |
    #| RÖLE 9  | `/o`      | http://169.254.1.2:3000/o |
    #| RÖLE 10 | `/p`      | http://169.254.1.2:3000/p |
    #| RÖLE 11 | `/q`      | http://169.254.1.2:3000/q |
    #| RÖLE 12 | `/t`      | http://169.254.1.2:3000/t |
    #| RÖLE 13 | `/u`      | http://169.254.1.2:3000/u |
    #| RÖLE 14 | `/v`      | http://169.254.1.2:3000/v |
    #| RÖLE 15 | `/w`      | http://169.254.1.2:3000/w |
    #| RÖLE 16 | `/M`      | http://169.254.1.2:3000/M |
    
    #────────────────────────────────────────
    ### ÖZEL KOMUTLAR
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le) 
    #────────────────────────────────────────
    
    #IPNO:PORTNO/s - Röle TEMP durumları görülür
    #IPNO:PORTNO/I veya IPNO:PORTNO/IP? - Cihazın ağ konfigürasyon bilgileri
    
    #────────────────────────────────────────
    #ETHERNET 2 RÖLE KAPATMA VE AÇMA GET REQUEST KOMUTLARI
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le) 
    #────────────────────────────────────────
    #RÖLE AÇMA:
    #|  Röle   | Parametre |          Örnek            |
    #|------   |-----------|---------------------------|
    #| RÖLE 1  | `/w`      | http://169.254.1.2:3000/w |
    #| RÖLE 2  | `/m`      | http://169.254.1.2:3000/m |
    
    #RÖLE KAPATMA:
    #|  Röle   | Parametre |          Örnek            |
    #|------   |-----------|---------------------------|
    #| RÖLE 1  | `/n`      | http://169.254.1.2:3000/n |
    #| RÖLE 2  | `/t`      | http://169.254.1.2:3000/t |
    
    
    #────────────────────────────────────────
    #PORT DEĞERLERİ
    #────────────────────────────────────────
    #Kaynak sayfa http://169.254.1.2:3000/s (veya sizin belirlediğin ip:portno/s) Her port 
    #için 8 bitlik değerler ve 2 adet ısı durumu için küsüratlı ısı değerleri sunar.
    #Örnek:
    #PORTB = 42
    #Binary karşılığı:
    #00101010
    
    #bit0 → Röle 1
    #bit1 → Röle 2
    #bit2 → Röle 3
    #bit3 → Röle 4
    #bit4 → Röle 5
    #bit5 → Röle 6
    #bit6 → Röle 7
    #bit7 → Röle 8
    
    #────────────────────────────────────────
    #TEMP1 TEMP2 DESİMAL ISI DEĞERLERİ
    #────────────────────────────────────────
    
    #TEMP1 = 22.3
    #TEMP2 = 22.2
    #────────────────────────────────────────
    
    #────────────────────────────────────────
    #GEREKSİNİMLER
    #────────────────────────────────────────
    #import requests
    #import re
    #import time
    #────────────────────────────────────────
    
    #CODE:
    
    import requests
    import re
    import time
    
    # Tetikleme URL'leri röleler on off yapılıyor
    PRE_URLS = [
        "http://95.70.192.96:249/1",
        "http://95.70.192.96:249/i",
        "http://95.70.192.96:249/2",
        "http://95.70.192.96:249/g",
        "http://95.70.192.96:249/3",
        "http://95.70.192.96:249/h",
        "http://95.70.192.96:249/4",
        "http://95.70.192.96:249/j",
    ]
    
    # Okuma URL'i
    URL = "http://95.70.192.96:249/s" # bu sayfadan değerleri alıyoruz
    
    def to_bin8(val):
        return format(val, '08b')
    
    try:
        # === 1) Ön tetikleme ===
        for u in PRE_URLS:
            try:
                r = requests.get(u, timeout=2)
                r.raise_for_status()
                print(f"Tetik gönderildi -> {u}")
            except Exception as e:
                print(f"Tetik HATA ({u}):", e)
    
            time.sleep(1)
    
        # === 2) Okuma ===
        r = requests.get(URL, timeout=3)
        r.raise_for_status()
        data = r.text
    
        # === 3) TEMP okuma ===
        temps = {}
        for t in ["TEMP1", "TEMP2"]:
            m = re.search(
                rf"{t}\s*=\s*([\d]+)\.\s*([\d]+)\s*C",
                data
            )
            if not m:
                raise ValueError(f"{t} bulunamadı")
    
            temp_val = float(f"{m.group(1)}.{m.group(2)}")
            temps[t] = temp_val
    
        # === 4) PORT okuma ===
        ports = {}
        for p in ["PORTB", "PORTD", "PORTA", "PORTE"]:
            m = re.search(rf"{p}\s*=\s*(\d+)", data)
            if not m:
                raise ValueError(f"{p} bulunamadı")
    
            value = int(m.group(1))
            if value > 255:
                raise ValueError(f"{p} 255'i geçti")
    
            ports[p] = value
    
        # === 5) Sonuçlar ===
        print("\n--- SICAKLIKLAR ---")
        for t, v in temps.items():
            print(f"{t}: {v:.2f} °C")
    
        print("\n--- PORT DURUMLARI ---")
        for p, v in ports.items():
            print(f"{p}: {v:3d}  ->  {to_bin8(v)}")
    
    except Exception as e:
        print("Genel Hata:", e)

2- PYTHON GET READ PORTS SAMPLE CODE:

    
    #Seda Elektronik Ethernet Röle Kartı – Python API Wrapper
    #Bu modül Seda Elektronik Get Ethernet röle kartlarından port durumlarını
    #okumak için kullanılır. HTTP üzerinden karttan veri çekilir ve port
    #değerleri parse edilerek JSON formatında döndürülür.
    #────────────────────────────────────────
    #CİHAZ BAĞLANTI BİLGİLERİ
    #────────────────────────────────────────
    #Protokol  : HTTP GET
    #Port      : 3000
    #URL (read)       : http://IP_ADRESI:3000/s
    #URL (write)       : http://IP_ADRESI:3000/"parametre"
    #Örnek:
    #http://169.254.1.2:3000/s
    #Cihazın döndürdüğü veri formatı:
    #    var PORTB=     0;
    #    var PORTD=     0;
    #    var PORTA=     0;
    #    var PORTE=     0;
    #────────────────────────────────────────
    #PORT DEĞERLERİ
    #────────────────────────────────────────
    #Her port 8 bitlik bir değerdir.
    #Örnek:
    #PORTB = 42
    #Binary karşılığı:
    #00101010
    
    #bit0 → Röle 1
    #bit1 → Röle 2
    #bit2 → Röle 3
    #bit3 → Röle 4
    #bit4 → Röle 5
    #bit5 → Röle 6
    #bit6 → Röle 7
    #bit7 → Röle 8
    
    #3 kullanım şekli var:
    #1) Flask REST API olarak çalıştır (müşteri HTTP ile bağlanır):
    #bashpython relay_card_api.py
    # → http://localhost:5000/api/ports
    # → http://localhost:5000/api/ports/PORTB
    #2) Kütüphane olarak import et (kendi koduna göm):
    #pythonfrom relay_card_api import fetch_ports, get_port
    #ports = fetch_ports()       # {'PORTB': 42, 'PORTD': 0, ...}
    #portb = get_port("PORTB")  # + binary, hex, bit bazında breakdown
    #3) Terminal testi:
    #bashpython relay_card_api.py test
    
    #────────────────────────────────────────
    #KULLANIM
    #────────────────────────────────────────
    #1) Flask REST API olarak çalıştır:
    #    python relay_card_api.py
    #Sonra:
    #    http://localhost:5000/api/ports
    #    http://localhost:5000/api/ports/PORTB
    #2) Python kütüphanesi olarak kullan:
    #    from relay_card_api import fetch_ports, get_port
    #    ports = fetch_ports()
    #    portb = get_port("PORTB")
    #3) Terminal test modu:
    #    python relay_card_api.py test
    
    #────────────────────────────────────────
    ### ÖZEL KOMUTLAR
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le)
    #Daha fazla bilgi için pdf kılavuzumuzu inceleyiniz:
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/HIZLI-KURULUM-KILAVUZU.pdf  
    #────────────────────────────────────────
    
    #IPNO:PORTNO/s - Röle TEMP durumları görülür
    #IPNO:PORTNO/I veya IPNO:PORTNO/IP? - Cihazın ağ konfigürasyon bilgileri
    
    #────────────────────────────────────────
    #GEREKSİNİMLER
    #────────────────────────────────────────
    
    #pip install -r requirements.txt
    #requests
    #flask
    #flask-cors
    
    #────────────────────────────────────────
    #CODE:
    
    import re
    import requests
    from flask import Flask, jsonify
    from flask_cors import CORS
    
    # ──────────────────────────────────────────────
    # CORE: Cihazdan veri çek ve parse et
    # ──────────────────────────────────────────────
    
    DEVICE_URL = "http://169.254.1.2:3000/s"
    #veya ethernet röle kartına verdiğiniz herhangi bir IP no: 
    #DEVICE_URL = "http://192.168.1.200:3000/s"
    
    def fetch_ports(url: str = DEVICE_URL, timeout: int = 3) -> dict:
        """
        Ethernet kartına HTTP GET atar, JS değişkenlerini parse eder.
        
        Kart şu formatta yanıt döner:
            var PORTB=     0;var PORTD=     0;PORTA=     0;PORTE=     0;
        
        Returns:
            {
                "PORTA": 0,
                "PORTB": 0,
                "PORTD": 0,
                "PORTE": 0,
                "raw": "...",
                "status": "ok"
            }
        """
        try:
            response = requests.get(url, timeout=timeout)
            response.raise_for_status()
            raw_text = response.text.strip()
    
            # Hem "var PORTB= 0;" hem "PORTA= 0;" formatını yakala
            pattern = r'(?:var\s+)?(PORT[A-Z])\s*=\s*(\d+)\s*;'
            matches = re.findall(pattern, raw_text)
    
            if not matches:
                return {"status": "error", "message": "Port verisi bulunamadı", "raw": raw_text}
    
            ports = {name: int(value) for name, value in matches}
            ports["raw"] = raw_text
            ports["status"] = "ok"
            return ports
    
        except requests.ConnectionError:
            return {"status": "error", "message": "Cihaza bağlanılamadı. IP/Port kontrol edin."}
        except requests.Timeout:
            return {"status": "error", "message": f"Bağlantı zaman aşımına uğradı ({timeout}s)"}
        except requests.HTTPError as e:
            return {"status": "error", "message": f"HTTP hatası: {e}"}
    
    
    def get_port(port_name: str, url: str = DEVICE_URL) -> dict:
        """
        Tek bir portu döner. Örnek: get_port("PORTB")
        
        Returns:
            {"port": "PORTB", "value": 42, "binary": "00101010", "status": "ok"}
        """
        port_name = port_name.upper()
        data = fetch_ports(url)
    
        if data["status"] != "ok":
            return data
    
        if port_name not in data:
            available = [k for k in data if k.startswith("PORT")]
            return {
                "status": "error",
                "message": f"'{port_name}' bulunamadı. Mevcut portlar: {available}"
            }
    
        value = data[port_name]
        return {
            "status": "ok",
            "port": port_name,
            "value": value,
            "binary": format(value, "08b"),   # 8-bit binary string
            "hex": hex(value),
            "bits": {f"bit{i}": (value >> i) & 1 for i in range(8)}
        }
    
    
    # ──────────────────────────────────────────────
    # FLASK REST API
    # ──────────────────────────────────────────────
    
    app = Flask(__name__)
    CORS(app)  # Tarayıcıdan erişim için
    
    @app.route("/api/ports", methods=["GET"])
    def all_ports():
        """Tüm portları döner."""
        data = fetch_ports()
        data.pop("raw", None)
        return jsonify(data)
    
    @app.route("/api/ports/", methods=["GET"])
    def single_port(port_name):
        """Tek port döner. Örn: /api/ports/PORTB"""
        return jsonify(get_port(port_name))
    
    @app.route("/api/health", methods=["GET"])
    def health():
        """API sağlık kontrolü."""
        return jsonify({"status": "ok", "device": DEVICE_URL})
    
    @app.route("/", methods=["GET"])
    def index():
        return jsonify({
            "api": "Röle Kartı API",
            "endpoints": {
                "GET /api/ports":            "Tüm portlar",
                "GET /api/ports/PORTA":      "Tek port (PORTA/PORTB/PORTD/PORTE)",
                "GET /api/health":           "Cihaz bağlantı durumu"
            }
        })
    
    
    # ──────────────────────────────────────────────
    # DOĞRUDAN KULLANIM (kütüphane olarak import)
    # ──────────────────────────────────────────────
    
    if __name__ == "__main__":
        import sys
    
        # Argümansız çalıştırılırsa Flask sunucusu başlat
        if len(sys.argv) == 1:
            print("=" * 45)
            print("  Röle Kartı REST API Sunucusu")
            print(f"  Cihaz  : {DEVICE_URL}")
            print("  API    : http://localhost:5000")
            print("=" * 45)
            app.run(host="0.0.0.0", port=5000, debug=True)
    
        # "test" argümanıyla doğrudan port oku
        elif sys.argv[1] == "test":
            print("Tüm portlar okunuyor...\n")
            result = fetch_ports()
            for key, val in result.items():
                if key not in ("raw", "status"):
                    binary = format(val, "08b") if isinstance(val, int) else val
                    print(f"  {key:6s} = {val:3d}  (0b{binary})")
            print(f"\n  Ham yanıt: {result.get('raw', 'N/A')}") 

3-1 PYTHON MQTT TCP READ-WRITE CODE:

    
    #Seda Elektronik TCP Ethernet Röle Kartı – Python API Wrapper
    #Bu modül Seda Elektronik TCP MODBUS RTU Ethernet röle kartlarından port durumlarını
    #yazmak ve okumak için kullanılır. TCP üzerinden karta hex veri gönderilir ve kartın CRC 
    #yüklü cevabı alınır.
    #Bağlantı için kendi programınız veya hercules vb. tcp programlarını kullanılabilirsiniz. 
    #CİHAZ BAĞLANTI BİLGİLERİ
    #────────────────────────────────────────
    #Protokol  : TCP MODBUS RTU (CRC var)
    #IP = "95.70.192.96"
    #PORT = 3000
    
    #────────────────────────────────────────
    #HEX DEĞERLER ile KONTROL ve KULLANIM
    #────────────────────────────────────────
    #Örneğin kodda 1 nolu röle on değeri olan:
    #HEX_COMMAND = "010500015500A35A" gönderilmiş ve sonra kart crc cevabı alınmıştır.
     
    #Daha fazla kontrol hex değeri için linkteki pdf dosyamızı inceleyiniz  sayfa 7-11 
    #Ve basit parametreler sayfa 1-6:
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/TELNET-KURULUM-KILAVUZU.pdf
    
    #Sisteminize özel parametreler üretmek için github sayfamızdaki crc jeneratörünü
    #Pdf kılavuzdaki röle zamanlı çalışma değerleri harici özel zaman değerleri ihtiyacı
    #vb. için kullanabilirsiniz.
    #CRC üreteci HTML yapıdadır kurulum gerektirmez bütün web browserlarda çalışır.
    #https://github.com/sedaelektronik/modbus-crc16-parameter-generator
    
    #────────────────────────────────────────
    #CODE:
    import socket
    import paho.mqtt.client as mqtt
    import time
    
    # --- YAPILANDIRMA ---
    DEVICE_IP = "95.70.192.96"
    DEVICE_PORT = 3000
    HEX_COMMAND = "010500015500A35A" 
    
    MQTT_BROKER = "broker.emqx.io" 
    MQTT_TOPIC = "sedaelektronik/cihaz1/yanit"
    
    def send_tcp_and_publish_mqtt():
        # 2 kez tekrar etmesi için döngü kuruyoruz
        for i in range(1, 3):
            try:
                print(f"\n--- {i}. Deneme Başlatıldı ---")
                
                # 1. TCP Bağlantısı Kur ve Veri Gönder
                message = bytes.fromhex(HEX_COMMAND)
                
                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                sock.settimeout(5)
                sock.connect((DEVICE_IP, DEVICE_PORT))
                
                print(f"Cihaza bağlandı. Komut gönderiliyor...")
                sock.sendall(message)
                
                # Cihazdan cevap bekle
                response = sock.recv(1024)
                response_hex = response.hex().upper()
                print(f"Cihaz Cevabı: {response_hex}")
                sock.close()
    
                # 2. MQTT ile Yayınla
                client = mqtt.Client()
                client.connect(MQTT_BROKER, 1883, 60)
                client.publish(MQTT_TOPIC, response_hex)
                print(f"Veri MQTT'ye iletildi: {MQTT_TOPIC}")
                client.disconnect()
    
            except Exception as e:
                print(f"Hata oluştu: {e}")
    
            # Eğer ilk deneme bittiyse, ikinci deneme öncesi 1 saniye bekle
            if i < 2:
                print("1 saniye bekleniyor...")
                time.sleep(1)
    
        print("\nİşlem tamamlandı, program durduruldu.")
    
    if __name__ == "__main__":
        send_tcp_and_publish_mqtt()

3-2 PYTHON TCP READ-WRITE CODE:

    	  
    #Seda Elektronik TCP Ethernet Röle Kartı – Python API Wrapper
    #Bu modül Seda Elektronik TCP MODBUS RTU Ethernet röle kartlarından port durumlarını
    #yazmak ve okumak için kullanılır. TCP üzerinden karta hex veri gönderilir ve kartın CRC 
    #yüklü cevabı alınır.
    #Bağlantı için kendi programınız veya hercules vb. tcp programlarını kullanılabilirsiniz. 
    #CİHAZ BAĞLANTI BİLGİLERİ
    #────────────────────────────────────────
    #Protokol  : TCP MODBUS RTU (CRC var)
    #IP = "95.70.192.96"
    #PORT = 3000
    
    #────────────────────────────────────────
    #HEX DEĞERLER ile KONTROL ve KULLANIM
    #────────────────────────────────────────
    #Örneğin kodda 1 nolu röle on değeri olan:
    #HEX_COMMAND = "010500015500A35A" gönderilmiş ve sonra kart crc cevabı alınmıştır.
     
    #Daha fazla kontrol hex değeri için linkteki pdf dosyamızı inceleyiniz sayfa 7-11 
    #Ve basit parametreler sayfa 1-6:
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/TELNET-KURULUM-KILAVUZU.pdf
    
    #Sisteminize özel parametreler üretmek için github sayfamızdaki crc jeneratörünü
    #Pdf kılavuzdaki röle zamanlı çalışma değerleri harici özel zaman değerleri ihtiyacı
    #vb. için kullanabilirsiniz.
    #CRC üreteci HTML yapıdadır kurulum gerektirmez bütün web browserlarda çalışır.
    #https://github.com/sedaelektronik/modbus-crc16-parameter-generator
    
    #────────────────────────────────────────
    #CODE:
    	  
    import socket
    import binascii
    
    IP = "95.70.192.96"
    PORT = 3000
    
    # Gönderilecek HEX veri
    hex_data = "01 05 00 01 55 00 A3 5A"
    tx_data = bytes.fromhex(hex_data)
    
    try:
        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
            s.settimeout(5)  # 5 saniye timeout
            s.connect((IP, PORT))
            print(f"Bağlandı: {IP}:{PORT}")
    
            # Veri gönder
            s.sendall(tx_data)
            print("Gönderilen:", binascii.hexlify(tx_data, b' ').decode().upper())
    
            # Cevap al
            rx_data = s.recv(1024)
    
            if rx_data:
                print("Gelen cevap:", binascii.hexlify(rx_data, b' ').decode().upper())
            else:
                print("Cihazdan cevap gelmedi")
    
    except socket.timeout:
        print("Bağlantı zaman aşımına uğradı")
    
    except Exception as e:
        print("Hata:", e)

4- PYTHON UDP WRITE, GET READ CODE:

    
    #Seda Elektronik UDP GET Ethernet Röle Kartı – Python API Wrapper
    #Bu modül Seda Elektronik UDP GET Ethernet röle kartlarından port durumlarını
    #yazmak ve okumak için kullanılır. TCP üzerinden karta hex veri gönderilir ve kartın CRC 
    #yüklü cevabı alınır.
    #Bağlantı için kendi programınız veya hercules vb. tcp programlarını kullanılabilirsiniz. 
    #CİHAZ BAĞLANTI BİLGİLERİ
    #────────────────────────────────────────
    #Protokol  : UDP GET
    #IP = "95.70.192.96"
    #PORT = 3000
    
    #────────────────────────────────────────
    #RÖLE KONTROL DEĞERLERİ
    #────────────────────────────────────────
    
    #RÖLE AÇMA UDP GET DEĞERLERİ
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le)
    #Daha fazla bilgi için pdf kılavuzumuzu inceleyiniz:
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/HIZLI-KURULUM-KILAVUZU.pdf
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/TELNET-KURULUM-KILAVUZU.pdf 
    #────────────────────────────────────────
    
    #|  Röle   | Parametre |
    #|------   |-----------|
    #| RÖLE 1  | `/1`      |
    #| RÖLE 2  | `/2`      | 
    #| RÖLE 3  | `/3`      | 
    #| RÖLE 4  | `/4`      | 
    #| RÖLE 5  | `/5`      |
    #| RÖLE 6  | `/6`      | 
    #| RÖLE 7  | `/7`      | 
    #| RÖLE 8  | `/8`      | 
    #| RÖLE 9  | `/9`      | 
    #| RÖLE 10 | `/0`      | 
    #| RÖLE 11 | `/a`      | 
    #| RÖLE 12 | `/b`      | 
    #| RÖLE 13 | `/c`      | 
    #| RÖLE 14 | `/d`      | 
    #| RÖLE 15 | `/e`      | 
    #| RÖLE 16 | `/L`      | 
    
    #────────────────────────────────────────
    #RÖLE KAPATMA UDP GET DEĞERLERİ
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le) 
    #────────────────────────────────────────
    
    #|  Röle   | Parametre |
    #|------   |-----------|
    #| RÖLE 1  | `/i`      | ESKİ VERSİYON ÜRÜNLERDE: `GET DEĞER /f`
    #| RÖLE 2  | `/g`      | 
    #| RÖLE 3  | `/h`      | 
    #| RÖLE 4  | `/j`      | 
    #| RÖLE 5  | `/k`      | 
    #| RÖLE 6  | `/l`      | 
    #| RÖLE 7  | `/m`      | 
    #| RÖLE 8  | `/n`      |
    #| RÖLE 9  | `/o`      | 
    #| RÖLE 10 | `/p`      | 
    #| RÖLE 11 | `/q`      | 
    #| RÖLE 12 | `/t`      | 
    #| RÖLE 13 | `/u`      | 
    #| RÖLE 14 | `/v`      | 
    #| RÖLE 15 | `/w`      | 
    #| RÖLE 16 | `/M`      |
    
    #GEREKSİNİMLER
    #────────────────────────────────────────
    #import socket
    #import time
    #import re
    #import requests
    #──────────────────────────────────────── 
    
    #CODE:
    
    #Seda Elektronik Ethernet Röle Kartı – Birleşik Kontrol Scripti
    ───────────────────────────────────────────────────────────────
    #1) UDP ile 16 röleyi sırayla AÇAR (500ms arayla)
    #2) HTTP GET ile PORTB, PORTD, PORTA, PORTE değerlerini OKUR
    #3) UDP ile 16 röleyi sırayla KAPAR (500ms arayla)
    
    #GEREKSİNİMLER:
    pip install requests
    
    YAPILANDIRMA:
    #UDP_IP      → Röle kartının IP adresi (UDP)
    #UDP_PORT    → Röle kartı UDP portu
    #DEVICE_URL  → HTTP GET için kart URL'i
    #UDP_IP   = "95.70.192.96"
    #UDP_PORT = 250
    import re
    import socket
    import time
    import requests
    
    # ──────────────────────────────────────────────
    # YAPILANDIRMA
    # ──────────────────────────────────────────────
    
    UDP_IP   = "95.70.192.96"
    UDP_PORT = 250
    
    # Alternatif:
    DEVICE_URL = "http://95.70.192.96:250/s"
    
    RELAY_DELAY = 0.5  # Röleler arası bekleme süresi (saniye)
    
    # ──────────────────────────────────────────────
    # RÖLE PARAMETRELERI
    # ──────────────────────────────────────────────
    
    # UDP → Röle AÇMA parametreleri (Röle 1–16)
    RELAY_ON = [
        b"1", b"2", b"3", b"4", b"5", b"6", b"7", b"8",
        b"9", b"0", b"a", b"b", b"c", b"d", b"e", b"L"
    ]
    
    # UDP → Röle KAPATMA parametreleri (Röle 1–16)
    RELAY_OFF = [
        b"i", b"g", b"h", b"j", b"k", b"l", b"m", b"n",
        b"o", b"p", b"q", b"t", b"u", b"v", b"w", b"M"
    ]
    
    # ──────────────────────────────────────────────
    # UDP FONKSİYONLARI
    # ──────────────────────────────────────────────
    
    def udp_send_sequence(commands: list, label: str = ""):
        """
        UDP üzerinden bir komut listesini sırayla gönderir.
        Her komut arasında RELAY_DELAY kadar bekler.
        """
        print(f"\n{'─'*45}")
        print(f"  {label}")
        print(f"{'─'*45}")
    
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        try:
            for i, cmd in enumerate(commands, start=1):
                sock.sendto(cmd, (UDP_IP, UDP_PORT))
                print(f"  Röle {i:2d}  →  '{cmd.decode()}' gönderildi")
                if i < len(commands):          # Son komuttan sonra bekleme yok
                    time.sleep(RELAY_DELAY)
        finally:
            sock.close()
    
        print(f"  ✓ {label} tamamlandı.")
    
    
    # ──────────────────────────────────────────────
    # HTTP GET / PORT OKUMA FONKSİYONLARI
    # ──────────────────────────────────────────────
    
    def fetch_ports(url: str = DEVICE_URL, timeout: int = 3) -> dict:
        """
        Ethernet kartına HTTP GET atar, JS değişkenlerini parse eder.
    
        Kart yanıt formatı:
            var PORTB=     0;var PORTD=     0;PORTA=     0;PORTE=     0;
    
        Returns:
            {"PORTA": 0, "PORTB": 42, ..., "status": "ok"}
        """
        try:
            response = requests.get(url, timeout=timeout)
            response.raise_for_status()
            raw_text = response.text.strip()
    
            pattern = r'(?:var\s+)?(PORT[A-Z])\s*=\s*(\d+)\s*;'
            matches = re.findall(pattern, raw_text)
    
            if not matches:
                return {"status": "error", "message": "Port verisi bulunamadı", "raw": raw_text}
    
            ports = {name: int(value) for name, value in matches}
            ports["raw"]    = raw_text
            ports["status"] = "ok"
            return ports
    
        except requests.ConnectionError:
            return {"status": "error", "message": "Cihaza bağlanılamadı. IP/Port kontrol edin."}
        except requests.Timeout:
            return {"status": "error", "message": f"Bağlantı zaman aşımına uğradı ({timeout}s)"}
        except requests.HTTPError as e:
            return {"status": "error", "message": f"HTTP hatası: {e}"}
    
    
    def print_ports(data: dict):
        """Port değerlerini binary breakdown ile ekrana basar."""
        print(f"\n{'─'*45}")
        print("  PORT DURUMU OKUNUYOR")
        print(f"{'─'*45}")
    
        if data["status"] != "ok":
            print(f"  ✗ Hata: {data.get('message', 'Bilinmeyen hata')}")
            return
    
        for key in ("PORTA", "PORTB", "PORTD", "PORTE"):
            if key not in data:
                print(f"  {key:6s}  →  (bulunamadı)")
                continue
    
            val    = data[key]
            binary = format(val, "08b")
            bits   = "  ".join(
                f"b{i}={'1' if (val >> i) & 1 else '0'}"
                for i in range(7, -1, -1)   # MSB → LSB
            )
            print(f"  {key:6s}  =  {val:3d}  │  0b{binary}  │  {bits}")
    
        print(f"\n  Ham yanıt: {data.get('raw', 'N/A')}")
        print(f"{'─'*45}")
    
    
    # ──────────────────────────────────────────────
    # ANA AKIŞ
    # ──────────────────────────────────────────────
    
    def main():
        print("=" * 45)
        print("  Seda Elektronik – Röle Kontrol Scripti")
        print(f"  UDP  : {UDP_IP}:{UDP_PORT}")
        print(f"  HTTP : {DEVICE_URL}")
        print("=" * 45)
    
        # 1) 16 röleyi sırayla AÇ
        udp_send_sequence(RELAY_ON, label="16 RÖLE AÇILIYOR")
    
        # Kartın durumu güncellemesi için kısa bekleme
        time.sleep(1)
    
        # 2) Port değerlerini OKU
        port_data = fetch_ports()
        print_ports(port_data)
    
        # 3) 16 röleyi sırayla KAPAT
        udp_send_sequence(RELAY_OFF, label="16 RÖLE KAPATILIYOR")
    
        print("\n  ✓ İşlem tamamlandı.\n")
    
    
    if __name__ == "__main__":
        main()
    
    #CODE (only udp data sender):
    #import socket
    #import time
    
    #UDP_IP = "95.70.192.96"
    #UDP_PORT = 3000
    
    # UDP socket oluştur
    #sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    
    #try:
    #    # İlk veri: "2"
    #    sock.sendto(b"2", (UDP_IP, UDP_PORT))
    #    print("Gonderildi: 2")
    
        # 500 ms bekle
    #    time.sleep(0.5)
    
        # İkinci veri: "g"
    #   sock.sendto(b"g", (UDP_IP, UDP_PORT))
    #    print("Gonderildi: g")
    
    #finally:
    #    sock.close()

5- PYTHON USB HID CODE:

    
    # ===============================
    # CİHAZ BİLGİLERİ
    # ===============================
    #VENDOR_ID  = 0x178E   # <-- kendi VID'in
    #PRODUCT_ID = 0x07D9   # <-- kendi PID'in
    
    # ===============================
    # BAĞLANTI TİPİ: USB HID
    # ===============================
    
    # ===============================
    # RÖLE KOMUTLARI
    # ===============================
    RELAY_ON_VALUES  = [1, 2, 3, 4, 5, 6, 7, 8]
    RELAY_OFF_VALUES = [17, 18, 19, 20, 21, 22, 23, 24]
    # ===============================
    
    # ===============================
    # GEREKSİNİMLER
    # ===============================
    #import hid
    #import time
    # ===============================
    
    
    #CODE:
    
    VENDOR_ID  = 0x178E   # <-- kendi VID'in
    PRODUCT_ID = 0x07D9   # <-- kendi PID'in
    
    import hid
    import time
    
    RELAY_ON_VALUES  = [1, 2, 3, 4, 5, 6, 7, 8]
    RELAY_OFF_VALUES = [17, 18, 19, 20, 21, 22, 23, 24]
    
    device = None
    
    def connect():
        global device
        device = hid.device()
        device.open(VENDOR_ID, PRODUCT_ID)
        device.set_nonblocking(1)
        print("✔ HID cihaz bağlandı")
    
    
    def disconnect():
        global device
        if device:
            device.close()
            device = None
            print("✖ HID cihaz kapatıldı")
    
    
    def send_command(value):
        """
        WebHID'deki:
        new Uint8Array([0,0,0,value,0,0,0,0])
        birebir karşılığı
        """
        if not device:
            print("⚠ Cihaz bağlı değil")
            return
    
        report = [0x00, 0x00, 0x00, value, 0x00, 0x00, 0x00, 0x00]
        device.write(report)
        print(f"→ Komut gönderildi: {value} | {report}")
    
    
    def relay_on(relay_no):
        send_command(RELAY_ON_VALUES[relay_no - 1])
    
    
    def relay_off(relay_no):
        send_command(RELAY_OFF_VALUES[relay_no - 1])
    
    
    def all_on():
        for v in RELAY_ON_VALUES:
            send_command(v)
            time.sleep(0.05)
        print("🔥 Tüm röleler AÇIK")
    
    
    def all_off():
        for v in RELAY_OFF_VALUES:
            send_command(v)
            time.sleep(0.05)
        print("❄ Tüm röleler KAPALI")
    
    
    # ===============================
    # TEST
    # ===============================
    if __name__ == "__main__":
        try:
            connect()
    
            relay_on(1)
            time.sleep(1)
    
            relay_off(1)
            time.sleep(1)
    
            all_on()
            time.sleep(1)
    
            all_off()
    
        except Exception as e:
            print("Hata:", e)
    
        finally:
            disconnect() 

6- PYTHON USB CDC COM CODE:

    	  
    # ===============================
    # CİHAZ BİLGİLERİ
    # ===============================
    #USB COM PORT CDC
    # ===============================
    # BAĞLANTI TİPİ: COM Port
    #9600 baud
    #8 data bits
    #1 stop bit
    #No parity
    # ===============================
    # ===============================
    # RÖLE KOMUTLARI
    # ===============================
    RELAY_ON_VALUES  = [1, 2, 3, 4, 5, 6, 7, 8]
    RELAY_OFF_VALUES = [17, 18, 19, 20, 21, 22, 23, 24]
    # ===============================
    # ===============================
    # GEREKSİNİMLER
    # ===============================
    #import serial
    #import threading
    #import time
    # ===============================
    
    
    #CODE:	  
    	  	  
    import serial
    import threading
    import time
    
    # ==============================
    # AYARLAR
    # ==============================
    COM_PORT = "COM5"      # Windows: COM5, COM6...
    # Linux: "/dev/ttyACM0"
    # Mac: "/dev/tty.usbmodemXXXX"
    BAUDRATE = 9600
    
    keep_reading = True
    
    
    # ==============================
    # OKUMA THREAD'I
    # ==============================
    def read_loop(ser):
        global keep_reading
        try:
            while keep_reading:
                if ser.in_waiting > 0:
                    data = ser.readline().decode(errors="ignore").strip()
                    if data:
                        print(f"📥 Receipt: {data}")
                time.sleep(0.01)
        except Exception as e:
            print("❌ Reading error:", e)
    
    
    # ==============================
    # ANA PROGRAM
    # ==============================
    try:
        ser = serial.Serial(
            port=COM_PORT,
            baudrate=BAUDRATE,
            timeout=1
        )
    
        print("✅ The connection is established.")
    
        # Okuma thread başlat
        read_thread = threading.Thread(target=read_loop, args=(ser,))
        read_thread.daemon = True
        read_thread.start()
    
        # Veri gönderme döngüsü
        while True:
            text = input("📤 Send data (exit için q): ")
            if text.lower() == "q":
                break
    
            ser.write((text + "\n").encode())
            print("📤 Sending:", text)
    
    except Exception as e:
        print("❌ Connection error:", e)
    
    finally:
        keep_reading = False
        time.sleep(0.2)
        if 'ser' in locals() and ser.is_open:
            ser.close()
        print("🔌 Connection closed.")

7-1 RASPBERRY PI RASPBIAN PYTHON CODE

    	  
    # ===============================
    # CİHAZ BİLGİLERİ
    # ===============================
    #IP BUTON RASPERRY PI GET UDP SENDER - RASPBIAN OS
    # ===============================
    #BAĞLANTI TİPİ: ETHERNET - WIFI
    #GET
    #UDP
    # ===============================
    #────────────────────────────────────────
    #RÖLE KONTROL DEĞERLERİ
    #────────────────────────────────────────
    
    #RÖLE AÇMA UDP GET DEĞERLERİ
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le)
    #Daha fazla bilgi için pdf kılavuzumuzu inceleyiniz:
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/ip-button-kullanim-kilavuzu.pdf
    #https://sedaelektronik.com.tr/KULLANIM-KILAVUZLARI/terminal-ayarlari.txt 
    #────────────────────────────────────────
    
    #|  Röle   | Parametre |
    #|------   |-----------|
    #| RÖLE 1  | `/1`      |
    #| RÖLE 2  | `/2`      | 
    #| RÖLE 3  | `/3`      | 
    #| RÖLE 4  | `/4`      | 
    #| RÖLE 5  | `/5`      |
    #| RÖLE 6  | `/6`      | 
    #| RÖLE 7  | `/7`      | 
    #| RÖLE 8  | `/8`      | 
    #| RÖLE 9  | `/9`      | 
    #| RÖLE 10 | `/0`      | 
    #| RÖLE 11 | `/a`      | 
    #| RÖLE 12 | `/b`      | 
    #| RÖLE 13 | `/c`      | 
    #| RÖLE 14 | `/d`      | 
    #| RÖLE 15 | `/e`      | 
    #| RÖLE 16 | `/L`      | 
    
    #────────────────────────────────────────
    #RÖLE KAPATMA UDP GET DEĞERLERİ
    #(web browserdan butonlardan doğrudan kontrol veya kod bloğundan request'le) 
    #────────────────────────────────────────
    
    #|  Röle   | Parametre |
    #|------   |-----------|
    #| RÖLE 1  | `/i`      | ESKİ VERSİYON ÜRÜNLERDE: `GET DEĞER /f`
    #| RÖLE 2  | `/g`      | 
    #| RÖLE 3  | `/h`      | 
    #| RÖLE 4  | `/j`      | 
    #| RÖLE 5  | `/k`      | 
    #| RÖLE 6  | `/l`      | 
    #| RÖLE 7  | `/m`      | 
    #| RÖLE 8  | `/n`      |
    #| RÖLE 9  | `/o`      | 
    #| RÖLE 10 | `/p`      | 
    #| RÖLE 11 | `/q`      | 
    #| RÖLE 12 | `/t`      | 
    #| RÖLE 13 | `/u`      | 
    #| RÖLE 14 | `/v`      | 
    #| RÖLE 15 | `/w`      | 
    #| RÖLE 16 | `/M`      |
    # ===============================
    # GEREKSİNİMLER
    # ===============================
    #!/usr/bin/env python
    #dos2unix must be setup and convert this file
    #import tkinter
    #from tkinter import *
    #from PIL import Image, ImageTk #ImageTK hatası için terminale şu kodun girilmesi gerekmektedir. sudo apt-get install python3-pil.imagetk
    #from tkinter import messagebox
    #import requests
    #from tkinter import ttk
    #import RPi.GPIO as GPIO
    # ===============================
    
    
    #CODE:	  
    	  
    #!/usr/bin/env python
    #dos2unix must be setup and convert this file
    import tkinter
    from tkinter import *
    from PIL import Image, ImageTk #ImageTK hatası için terminale şu kodun girilmesi gerekmektedir. sudo apt-get install python3-pil.imagetk
    from tkinter import messagebox
    import requests
    from tkinter import ttk
    import RPi.GPIO as GPIO
    
    
    GPIO.setmode(GPIO.BCM)
    
    root = Tk()
    root.title("SEDA ELEKTRONİK")
    root.geometry("700x800")
    root.config(bd=0)
    
    my_notebook = ttk.Notebook(root)
    my_notebook.pack(pady = 15)
    
    my_frame_1 = Frame(my_notebook, width = 700,height=800,bd=0)
    my_frame_2 = Frame(my_notebook, width = 700,height=800,bd=0)
    
    my_frame_1.pack(fill="both",expand=1)
    my_frame_2.pack(fill="both",expand=1)
    
    my_notebook.add(my_frame_2,text="RELAY/BUTON KONTROL")
    my_notebook.add(my_frame_1,text="KONTROL IP DÜZENLEME")
    
    
    
    is_on_1 = False
    is_on_2 = False
    is_on_3 = False
    is_on_4 = False
    is_on_5 = False
    is_on_6 = False
    is_on_7 = False
    is_on_8 = False
    is_on_9 = False
    is_on_10 = False
    is_on_11 = False
    is_on_12 = False
    is_on_13 = False
    is_on_14 = False
    is_on_15 = False
    is_on_16 = False
    
    loc = r"./role_urls"
    
    button_in_1 =  9
    button_in_2 =  10 
    button_in_3 =  11
    button_in_4 =  12
    button_in_5 =  13
    button_in_6 =  16
    button_in_7 =  17
    button_in_8 =  18
    button_in_9 =  19
    button_in_10 =  20
    button_in_11 =  21
    button_in_12 =  22
    button_in_13 =  23
    button_in_14 =  24
    button_in_15 =  25
    button_in_16 =  26
    
    #GPIO.setup(button_in_1,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_2,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_3,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_4,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_5,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_6,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_7,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_8,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_9,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_10,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_11,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_12,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_13,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_14,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_15,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    #GPIO.setup(button_in_16,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    try:
        def ip_list():
            role_keys = ['1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','L','f','g','h','j','k','l','m','n','o','p','q','t','u','v','w','M']
            
            urls_role = list()
            for key in role_keys:
                role_ip = enter_txt.get()
                role_ip = "http://" + role_ip + ":3000" + "/" + key
                urls_role.append(role_ip)
            return urls_role
    
        def deafult_ip_list():
            role_keys = ['1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','L','f','g','h','j','k','l','m','n','o','p','q','t','u','v','w','M']
            
            urls_role = list()
            for key in role_keys:
                role_ip = "169.254.1.2"
                role_ip = "http://" + role_ip + ":3000" + "/" + key
                urls_role.append(role_ip)
            return urls_role
    
    
        def change_ip():
            
            ip = enter_txt.get()
            ip +=":3000"
            info_ip.config(text=ip)
            
            role_urls = ip_list()
    
            with open(loc, 'r') as file :
                filedata = file.read()
                splitfile = filedata.split(' , ')
    
            role_urls = ip_list()
    
            c=0
            for url in role_urls:
                if c==32: c=0
                filedata = filedata.replace(splitfile[c], url,1)
                c+=1
            
            with open(loc, 'w') as file:
                file.write(filedata)
                
    
           
            
        def default_ip():
            with open(loc, 'r') as file :
                filedata = file.read()
                splitfile = filedata.split(' , ')
          
            ip = "169.254.1.2"
            ip +=":3000"
            info_ip.config(text=ip)
            
            role_urls = deafult_ip_list()
    
            with open(loc, 'r') as file :
                filedata = file.read()
                splitfile = filedata.split(' , ')
            c=0
            for url in role_urls:
                if c==32: c=0
                filedata = filedata.replace(splitfile[c], url,1)
                c+=1
            
            with open(loc, 'w') as file:
                file.write(filedata)
            messagebox.showinfo("BAŞARILI","YENİ IP = " + ip)
    
        def button_click(args):
            global is_on_1
            global is_on_2
            global is_on_3
            global is_on_4
            global is_on_5
            global is_on_6
            global is_on_7
            global is_on_8
            global is_on_9
            global is_on_10
            global is_on_11
            global is_on_12
            global is_on_13
            global is_on_14
            global is_on_15
            global is_on_16
            
            with open(loc, 'r') as file :
                    filedata = file.read()
                    urls = filedata.split(' , ')
                
            if (args == 1 and is_on_1 == False):
                try:
                    request = requests.get(urls[0],timeout = 3)
                    button_1.config(image = on)
                    request.raise_for_status()
                    is_on_1 = True
                    button_1_label.config(fg="green")
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası","Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
               
            elif (args == 1 and is_on_1 == True):
                try:
                    
                    button_1.config(image = off)
                    request = requests.get(urls[16],timeout=3)
                    request.raise_for_status()
                    is_on_1 = False
                    button_1_label.config(fg="red")
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası","Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 2 and is_on_2 == False):
                try:
                    request = requests.get(urls[1],timeout=3)
                    request.raise_for_status()
                    button_2.config(image = on)
                    button_2_label.config(fg="green")
                    is_on_2 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 2 and is_on_2 == True):
                try:
                    request = requests.get(urls[17],timeout=3)
                    request.raise_for_status()
                    button_2.config(image = off)
                    button_2_label.config(fg="red")
                    is_on_2 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 3 and is_on_3 == False):
                try:
                    request = requests.get(urls[2],timeout=3)
                    request.raise_for_status()
                    button_3.config(image = on)
                    is_on_3 = True
                    button_3_label.config(fg="green")
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
            elif (args == 3 and is_on_3 == True):
                try:
                    request = requests.get(urls[18],timeout=3)
                    request.raise_for_status()
                    button_3.config(image = off)
                    button_3_label.config(fg="red")
                    is_on_3 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
             
            
            if (args == 4 and is_on_4 == False):
                try:
                    request = requests.get(urls[3],timeout=3)
                    request.raise_for_status()
                    button_4.config(image = on)
                    button_4_label.config(fg="green")
                    is_on_4 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 4 and is_on_4 == True):
                try:
                    request = requests.get(urls[19],timeout=3)
                    request.raise_for_status()
                    button_4.config(image = off)
                    button_4_label.config(fg="red")
                    is_on_4 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 5 and is_on_5 == False):
                try:
                    request = requests.get(urls[4],timeout=3)
                    request.raise_for_status()
                    button_5.config(image = on)
                    button_5_label.config(fg="green")
                    is_on_5 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 5 and is_on_5 == True):
                try:
                    request = requests.get(urls[20],timeout=3)
                    request.raise_for_status()
                    button_5.config(image = off)
                    button_5_label.config(fg="red")
                    is_on_5 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
                
            if (args == 6 and is_on_6 == False):
                try:
                    request = requests.get(urls[5],timeout=3)
                    request.raise_for_status()
                    button_6.config(image = on)
                    button_6_label.config(fg="green")
                    is_on_6 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 6 and is_on_6 == True):
                try:
                    request = requests.get(urls[21],timeout=3)
                    request.raise_for_status()
                    button_6.config(image = off)
                    button_6_label.config(fg="red")
                    is_on_6 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 7 and is_on_7 == False):
                try:
                    request = requests.get(urls[6],timeout=3)
                    request.raise_for_status()
                    button_7.config(image = on)
                    button_7_label.config(fg="green")
                    is_on_7 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 7 and is_on_7 == True):
                try:
                    request = requests.get(urls[22],timeout=3)
                    request.raise_for_status()
                    button_7.config(image = off)
                    button_7_label.config(fg="red")
                    is_on_7 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 8 and is_on_8 == False):
                try:
                    request = requests.get(urls[7],timeout=3)
                    request.raise_for_status()
                    button_8.config(image = on)
                    button_8_label.config(fg="green")
                    is_on_8 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 8 and is_on_8 == True):
                try:
                    request = requests.get(urls[23],timeout=3)
                    request.raise_for_status()
                    button_8.config(image = off)
                    button_8_label.config(fg="red")
                    is_on_8 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 9 and is_on_9 == False):
                try:
                    request = requests.get(urls[8],timeout=3)
                    request.raise_for_status()
                    button_9.config(image = on)
                    button_9_label.config(fg="green")
                    is_on_9 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 9 and is_on_9 == True):
                try:
                    request = requests.get(urls[24],timeout=3)
                    request.raise_for_status()
                    button_9.config(image = off)
                    button_9_label.config(fg="red")
                    is_on_9 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 10 and is_on_10 == False):
                try:
                    request = requests.get(urls[9],timeout=3)
                    request.raise_for_status()
                    button_10.config(image = on)
                    button_10_label.config(fg="green")
                    is_on_10 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 10 and is_on_10 == True):
                try:
                    request = requests.get(urls[25],timeout=3)
                    request.raise_for_status()
                    button_10.config(image = off)
                    button_10_label.config(fg="red")
                    is_on_10 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 11 and is_on_11 == False):
                try:
                    request = requests.get(urls[10],timeout=3)
                    request.raise_for_status()
                    button_11.config(image = on)
                    button_11_label.config(fg="green")
                    is_on_11 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 11 and is_on_11 == True):
                try:
                    request = requests.get(urls[26],timeout=3)
                    request.raise_for_status()
                    button_11.config(image = off)
                    button_11_label.config(fg="red")
                    is_on_11 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 12 and is_on_12 == False):
                try:
                    request = requests.get(urls[11],timeout=3)
                    request.raise_for_status()
                    button_12.config(image = on)
                    button_12_label.config(fg="green")
                    is_on_12 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 12 and is_on_12 == True):
                try:
                    request = requests.get(urls[27],timeout=3)
                    request.raise_for_status()
                    button_12.config(image = off)
                    button_12_label.config(fg="red")
                    is_on_12 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 13 and is_on_13 == False):
                try:
                    request = requests.get(urls[12],timeout=3)
                    request.raise_for_status()
                    button_13.config(image = on)
                    button_13_label.config(fg="green")
                    is_on_13 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 13 and is_on_13 == True):
                try:
                    request = requests.get(urls[28],timeout=3)
                    request.raise_for_status()
                    button_13.config(image = off)
                    button_13_label.config(fg="red")
                    is_on_13 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 14 and is_on_14 == False):
                try:
                    request = requests.get(urls[13],timeout=3)
                    request.raise_for_status()
                    button_14.config(image = on)
                    button_14_label.config(fg="green")
                    is_on_14 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 14 and is_on_14 == True):
                try:
                    request = requests.get(urls[29],timeout=3)
                    request.raise_for_status()
                    button_14.config(image = off)
                    button_14_label.config(fg="red")
                    is_on_14 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 15 and is_on_15 == False):
                try:
                    request = requests.get(urls[14],timeout=3)
                    request.raise_for_status()
                    button_15.config(image = on)
                    button_15_label.config(fg="green")
                    is_on_15 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 15 and is_on_15 == True):
                try:
                    request = requests.get(urls[30],timeout=3)
                    request.raise_for_status()
                    button_15.config(image = off)
                    button_15_label.config(fg="red")
                    is_on_15 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            
            if (args == 16 and is_on_16 == False):
                try:
                    request = requests.get(urls[15],timeout=3)
                    request.raise_for_status()
                    button_16.config(image = on)
                    button_16_label.config(fg="green")
                    is_on_16 = True
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
            elif (args == 16 and is_on_16 == True):
                try:
                    request = requests.get(urls[31],timeout=3)
                    request.raise_for_status()
                    button_16.config(image = off)
                    button_16_label.config(fg="red")
                    is_on_16 = False
                except requests.ConnectionError:
                    messagebox.showerror("Bağlantı Hatası",
                    "Ethernet Röle Kartı Bulunamadı. Lütfen IP adresinizi kontrol ediniz.")
                
        def check_ip_address():
            with open(loc, 'r') as file :
                filedata = file.read()
                splitfile = filedata.split(' , ')
            splitfile_2 =splitfile[0].split(':')
            ip = splitfile_2[0]+":"+splitfile_2[1]
            ip +=":3000"
            info_ip.config(text=ip)
            
    
        def check_button ():
            global is_on_1
            global is_on_2
            global is_on_3
            global is_on_4
            global is_on_5
            global is_on_6
            global is_on_7
            global is_on_8
            global is_on_9
            global is_on_10
            global is_on_11
            global is_on_12
            global is_on_13
            global is_on_14
            global is_on_15
            global is_on_16
            
            if GPIO.input(button_in_1)==0:
                is_on_1 = True
                button_1.config(image = on)
                button_1_label.config(fg="green")
            if GPIO.input(button_in_1)==1:
                button_1.config(image = off)
                button_1_label.config(fg="red")
            if GPIO.input(button_in_2)==0:
                is_on_2 = True
                button_2.config(image = on)
                button_2_label.config(fg="green")
            if GPIO.input(button_in_2)==1:
                button_2.config(image = off)
                button_2_label.config(fg="red")
            if GPIO.input(button_in_3)==0:
                is_on_3 = True
                button_3.config(image = on)
                button_3_label.config(fg="green")
            if GPIO.input(button_in_3)==1:
                button_3.config(image = off)
                button_3_label.config(fg="red")
            if GPIO.input(button_in_4)==0:
                is_on_4 = True
                button_4.config(image = on)
                button_4_label.config(fg="green")
            if GPIO.input(button_in_4)==1:
                button_4.config(image = off)
                button_4_label.config(fg="red")
            if GPIO.input(button_in_5)==0:
                is_on_5 = True
                button_5.config(image = on)
                button_5_label.config(fg="green")
            if GPIO.input(button_in_5)==1:
                button_5.config(image = off)
                button_5_label.config(fg="red")
            if GPIO.input(button_in_6)==0:
                is_on_6 = True 
                button_6.config(image = on)
                button_6_label.config(fg="green")
            if GPIO.input(button_in_6)==1:
                button_6.config(image = off)
                button_6_label.config(fg="red")
            if GPIO.input(button_in_7)==0:
                is_on_7 = True
                button_7.config(image = on)
                button_7_label.config(fg="green")
            if GPIO.input(button_in_7)==1:
                button_7.config(image = off)
                button_7_label.config(fg="red")
            if GPIO.input(button_in_8)==0:
                is_on_8 = True
                button_8.config(image = on)
                button_8_label.config(fg="green")
            if GPIO.input(button_in_8)==1:
                button_8.config(image = off)
                button_8_label.config(fg="red")
            if GPIO.input(button_in_9)==0:
                is_on_9 = True
                button_9.config(image = on)
                button_9_label.config(fg="green")
            if GPIO.input(button_in_9)==1:
                button_9.config(image = off)
                button_9_label.config(fg="red")
            if GPIO.input(button_in_10)==0:
                is_on_10 = True
                button_10.config(image = on)
                button_10_label.config(fg="green")
                
            if GPIO.input(button_in_10)==1:
                button_10.config(image = off)
                button_10_label.config(fg="red")
            if GPIO.input(button_in_11)==0:
                is_on_11 = True
                button_11.config(image = on)
                button_11_label.config(fg="green")
            if GPIO.input(button_in_11)==1:
                button_11.config(image = off)
                button_11_label.config(fg="red")
            if GPIO.input(button_in_12)==0:
                is_on_12 = True
                button_12.config(image = on)
                button_12_label.config(fg="green")
            if GPIO.input(button_in_12)==1:
                button_12.config(image = off)
                button_12_label.config(fg="red")
            if GPIO.input(button_in_13)==0:
                is_on_13 = True
                button_13.config(image = on)
                button_13_label.config(fg="green")
            if GPIO.input(button_in_13)==1:
                button_13.config(image = off)
                button_13_label.config(fg="red")
            if GPIO.input(button_in_14)==0:
                is_on_14 = True
                button_14.config(image = on)
                button_14_label.config(fg="green")
            if GPIO.input(button_in_14)==1:
                button_14.config(image = off)
                button_14_label.config(fg="red")
            if GPIO.input(button_in_15)==0:
                is_on_15 = True
                button_15.config(image = on)
                button_15_label.config(fg="green")
            if GPIO.input(button_in_15)==1:
                button_15.config(image = off)
                button_15_label.config(fg="red")
            if GPIO.input(button_in_16)==0:
                is_on_16 = True
                button_16.config(image = on)
                button_16_label.config(fg="green")
            if GPIO.input(button_in_16)==1:
                button_16.config(image = off)
                button_16_label.config(fg="red")
            
    
       
    
    
        heading = Label(my_frame_1, text = "KONTROL-IP'si DEĞİŞİTİRME PROGRAMI",font=("Trebucet MS",20,"bold"),bd=0,fg="black")
        heading.pack(pady=(50,0))
        heading.place(x=50,y=150)
        
        enter_txt = Entry(my_frame_1,justify="center",width=30,font=("poppins",25),bg="white",border=2)
        enter_txt.pack(pady=10)
        enter_txt.focus()
        enter_txt.place(x=30,y=215)
    
        button_degistir = Button(my_frame_1,text="Değiştir",font=("arial",20,"bold"),foreground="white",bg="red",command=change_ip)
        button_degistir.pack()
        button_degistir.place(x=445,y=304)
    
        button_default = Button(my_frame_1,text="Default",font=("arial",20,"bold"),foreground="white",bg="red",command=default_ip)
        button_default.pack()
        button_default.place(x=125,y=304)
        
        button_bc = Button(my_frame_2,text="BUTON RÖLE DURUMLARI",font=("arial",20,"bold"),foreground="white",bg="red",command=check_button)
        button_bc.pack()
        button_bc.place(x=170,y=650)
    
        info_ip = Label(my_frame_1,text="",font=("poppins",20),bd=0,fg="black")
        info_ip.place(x=377,y=400)
    
        cs = Label(my_frame_1,text="Kullanılan IP Adres : ",font=("poppins",20,"bold"),bd=0,fg="black",)
        cs.place(x=60,y=400)
    
        image1 = Image.open(r"./sedaelektronik_logo.png")
        logo = ImageTk.PhotoImage(image1)
    
        label1 = tkinter.Label(my_frame_1,image=logo)
        label1.image = logo
        label1.place(x=250, y=40)
        
        label2 = tkinter.Label(my_frame_2,image=logo)
        label2.image = logo
        label2.place(x=250, y=40)
    
        on = PhotoImage(file = r"./on.png")
        off = PhotoImage(file = r"./off.png")
    
        button_1 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(1))
        button_1.pack()
        button_1.place(x=190,y=200)
        button_1_label = Label(my_frame_2,text="-RELAY 1-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_1_label.place(x=55,y=205)
    
        button_2 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(2))
        button_2.pack()
        button_2.place(x=190,y=250)
        button_2_label = Label(my_frame_2,text="-RELAY 2-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_2_label.place(x=55,y=255)
    
    
        button_3 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(3))
        button_3.pack()
        button_3.place(x=190,y=300)
        button_3_label = Label(my_frame_2,text="-RELAY 3-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_3_label.place(x=55,y=305)
    
        button_4 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(4))
        button_4.pack()
        button_4.place(x=190,y=350)
        button_4_label = Label(my_frame_2,text="-RELAY 4-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_4_label.place(x=55,y=355)
    
        button_5 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(5))
        button_5.pack()
        button_5.place(x=190,y=400)
        button_5_label = Label(my_frame_2,text="-RELAY 5-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_5_label.place(x=55,y=405)
    
        button_6 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(6))
        button_6.pack()
        button_6.place(x=190,y=450)
        button_6_label = Label(my_frame_2,text="-RELAY 6-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_6_label.place(x=55,y=455)
    
        button_7 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(7))
        button_7.pack()
        button_7.place(x=190,y=500)
        button_7_label = Label(my_frame_2,text="-RELAY 7-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_7_label.place(x=55,y=505)
    
        button_8 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(8))
        button_8.pack()
        button_8.place(x=190,y=550)
        button_8_label = Label(my_frame_2,text="-RELAY 8-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_8_label.place(x=55,y=555)
    
        button_9 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(9))
        button_9.pack()
        button_9.place(x=410,y=200)
        button_9_label = Label(my_frame_2,text="-RELAY 9-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_9_label.place(x=525,y=205)
    
        button_10 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(10))
        button_10.pack()
        button_10.place(x=410,y=250)
        button_10_label = Label(my_frame_2,text="-RELAY 10-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_10_label.place(x=525,y=255)
    
        button_11 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(11))
        button_11.pack()
        button_11.place(x=410,y=300)
        button_11_label = Label(my_frame_2,text="-RELAY 11-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_11_label.place(x=525,y=305)
    
        button_12 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(12))
        button_12.pack()
        button_12.place(x=410,y=350)
        button_12_label = Label(my_frame_2,text="-RELAY 12-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_12_label.place(x=525,y=355)
    
        button_13 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(13))
        button_13.pack()
        button_13.place(x=410,y=400)
        button_13_label = Label(my_frame_2,text="-RELAY 13-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_13_label.place(x=525,y=405)
    
    
        button_14 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(14))
        button_14.pack()
        button_14.place(x=410,y=450)
        button_14_label = Label(my_frame_2,text="-RELAY 14-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_14_label.place(x=525,y=455)
    
        button_15 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(15))
        button_15.pack()
        button_15.place(x=410,y=500)
        button_15_label = Label(my_frame_2,text="-RELAY 15-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_15_label.place(x=525,y=505)
    
        button_16 = Button(my_frame_2,image = off,bd=0,command=lambda:button_click(16))
        button_16.pack()
        button_16.place(x=410,y=550)
        button_16_label = Label(my_frame_2,text="-RELAY 16-",font=("poppins",16,"bold"),bd=0,fg="red")
        button_16_label.place(x=525,y=555)
        my_frame_2.after(1,check_ip_address)
        my_frame_2.after(1,check_button)
        
        my_frame_2.mainloop()
        
    except:
        tkinter.messagebox.showwarning(title="HATA MESAJI", message="LÜTFEN DOĞRU BİR IP ADRESİ GİRİNİZ")
       
                                                                                                                                                                                         		 
    
    
    
    
    
    
    	  
    	 

7-2 RASPBERRY PI RASPBIAN PYTHON ROLE CONTROLLER CODE

    
    
    #!/usr/bin/env python3
    import time
    import requests
    import RPi.GPIO as GPIO
    
    GPIO.setmode(GPIO.BCM)
    
    loc = r"/home/pi/Desktop/Program/role_urls"
    
    button_1 =  9
    button_2 =  10 
    button_3 =  11
    button_4 =  12
    button_5 =  13
    button_6 =  16
    button_7 =  17
    button_8 =  18
    button_9 =  19
    button_10 =  20
    button_11 =  21
    button_12 =  22
    button_13 =  23
    button_14 =  24
    button_15 =  25
    button_16 =  26
    
    GPIO.setup(button_1,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_2,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_3,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_4,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_5,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_6,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_7,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_8,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_9,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_10,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_11,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_12,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_13,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_14,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_15,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    GPIO.setup(button_16,GPIO.IN,pull_up_down = GPIO.PUD_UP)
    
    BS1 = False
    BS2 = False
    BS3 = False
    BS4 = False
    BS5 = False
    BS6 = False
    BS7 = False
    BS8 = False
    BS9 = False
    BS10 = False
    BS11 = False
    BS12 = False
    BS13 = False
    BS14 = False
    BS15 = False
    BS16 = False
    while(1):    
        try:
            with open(loc, 'r') as file :
                filedata = file.read()
                urls = filedata.split(' , ')
            if GPIO.input(button_1)==0:
                if BS1==False:
                    request = requests.get(urls[0])
                    BS1=True
                    print("Buton 1 is OPEN")
    
            if GPIO.input(button_1)==1:
                if BS1==True:
                    
                    request = requests.get(urls[16])
                    BS1 = False
                    print("Buton 1 is CLOSE")
     	  
            if GPIO.input(button_2)==0:
                if BS2==False:
                    print("Buton 2 is OPEN")
                    request = requests.get(urls[1])
                    BS2 = True
    
            if GPIO.input(button_2)==1:
                if BS2==True:
                    print("Buton 2 is CLOSE")
                    request = requests.get(urls[17])
                    BS2 = False
    
            if GPIO.input(button_3)==0:
                if BS3==False:
                    print("Buton 3 is OPEN")
                    request = requests.get(urls[2])
                    BS3 = True
    
            if GPIO.input(button_3)==1:
                if BS3==True:
                    print("Buton 3 is CLOSE")
                    request = requests.get(urls[18])
                    BS3 = False
    
            if GPIO.input(button_4)==0:
                if BS4==False:
                    print("Buton 4 is OPEN")
                    request = requests.get(urls[3])
                    BS4 = True
    
            if GPIO.input(button_4)==1:
                if BS4==True:
                    print("Buton 4 is CLOSE")
                    request = requests.get(urls[19])
                    BS4 = False
                    
            if GPIO.input(button_5)==0:
                if BS5==False:
                    print("Buton 5 is OPEN")
                    request = requests.get(urls[4])
                    BS5 = True
    
            if GPIO.input(button_5)==1:
                if BS5==True:
                    print("Buton 5 is CLOSE")
                    request = requests.get(urls[20])
                    BS5 = False
                  
            if GPIO.input(button_6)==0:
                if BS6==False:
                    print("Buton 6 is OPEN")
                    request = requests.get(urls[5])
                    BS6 = True
         
            if GPIO.input(button_6)==1:
                if BS6==True:
                    print("Buton 6 is CLOSE")
                    request = requests.get(urls[21])
                    BS6 = False
    
            if GPIO.input(button_7)==0:
                if BS7==False:
                    print("Buton 7 is OPEN")
                    request = requests.get(urls[6])
                    BS7 = True
    
            if GPIO.input(button_7)==1:
                if BS7==True:
                    print("Buton 7 is CLOSE")
                    request = requests.get(urls[22])
                    BS7 = False
    
            if GPIO.input(button_8)==0:
                if BS8==False:
                    print("Buton 8 is OPEN")
                    request = requests.get(urls[7])
                    BS8 = True
    
            if GPIO.input(button_8)==1:
                if BS8==True:
                    print("Buton 8 is CLOSE")
                    request = requests.get(urls[23])
                    BS8 = False
    
            if GPIO.input(button_9)==0:
                if BS9==False:
                    print("Buton 9 is OPEN")
                    request = requests.get(urls[8])
                    BS9 = True
          
            if GPIO.input(button_9)==1:
                if BS9==True:
                    print("Buton 9 is CLOSE")
                    request = requests.get(urls[24])
                    BS9 = False
    
            if GPIO.input(button_10)==0:
                if BS10==False:
                    print("Buton 10 is OPEN")
                    request = requests.get(urls[9])
                    BS10 = True
    
            if GPIO.input(button_10)==1:
                if BS10==True:
                    print("Buton 10 is CLOSE")
                    request = requests.get(urls[25])
                    BS10 = False
    
            if GPIO.input(button_11)==0:
                if BS11==False:
                    print("Buton 11 is OPEN")
                    request = requests.get(urls[10])
                    BS11 = True
             
            if GPIO.input(button_11)==1:
                if BS11==True:
                    print("Buton 11 is CLOSE")
                    request = requests.get(urls[26])
                    BS11 = False
                
            if GPIO.input(button_12)==0:
                if BS12==False:
                    print("Buton 12 is OPEN")
                    request = requests.get(urls[11])
                    BS12 = True
              
            if GPIO.input(button_12)==1:
                if BS12==True:
                    print("Buton 12 is CLOSE")
                    request = requests.get(urls[27])
                    BS12 = False
         
            if GPIO.input(button_13)==0:
                if BS13==False:
                    print("Buton 13 is OPEN")
                    request = requests.get(urls[12])
                    BS13 = True
                
            if GPIO.input(button_13)==1:
                if BS13==True:
                    print("Buton 13 is CLOSE")
                    request = requests.get(urls[28])
                    BS13 = False
                    
            if GPIO.input(button_14)==0:
                if BS14==False:
                    print("Buton 14 is OPEN")
                    request = requests.get(urls[13])
                    BS14 = True
                  
            if GPIO.input(button_14)==1:
                if BS14==True:
                    print("Buton 14 is CLOSE")
                    request = requests.get(urls[29])
                    BS14 = False
                  
            if GPIO.input(button_15)==0:
                if BS15==False:
                    print("Buton 15 is OPEN")
                    request = requests.get(urls[14])
                    BS15 = True
                  
            if GPIO.input(button_15)==1:
                if BS15==True:
                    print("Buton 15 is CLOSE")
                    request = requests.get(urls[30])
                    BS15 = False
                
            if GPIO.input(button_16)==0:
                if BS16==False:
                    print("Buton 16 is OPEN")
                    request = requests.get(urls[15])
                    BS16 = True
          
            if GPIO.input(button_16)==1:
                if BS16==True:
                    print("Buton 16 is CLOSE")
                    request = requests.get(urls[31])
                    BS16 = False
        except:
            print("Doğru IP Girmelisiz. Lütfen IP değiştirme programına girip değişiklik yapınız.")
    
    
                                                                                                                                                                                         		 
    	  
    	 

7-3 RASPBERRY PI RASPBIAN PYTHON RELAY URLS LIST FILE

    
    	  
    http://169.254.1.2:3000/1 , http://169.254.1.2:3000/2 , http://169.254.1.2:3000/3 , http://169.254.1.2:3000/4 , http://169.254.1.2:3000/5 , http://169.254.1.2:3000/6 , http://169.254.1.2:3000/7 , http://169.254.1.2:3000/8 , http://169.254.1.2:3000/9 , http://169.254.1.2:3000/0 , http://169.254.1.2:3000/a , http://169.254.1.2:3000/b , http://169.254.1.2:3000/c , http://169.254.1.2:3000/d , http://169.254.1.2:3000/e , http://169.254.1.2:3000/L , http://169.254.1.2:3000/i , http://169.254.1.2:3000/g , http://169.254.1.2:3000/h , http://169.254.1.2:3000/j , http://169.254.1.2:3000/k , http://169.254.1.2:3000/l , http://169.254.1.2:3000/m , http://169.254.1.2:3000/n , http://169.254.1.2:3000/o , http://169.254.1.2:3000/p , http://169.254.1.2:3000/q , http://169.254.1.2:3000/t , http://169.254.1.2:3000/u , http://169.254.1.2:3000/v , http://169.254.1.2:3000/w , http://169.254.1.2:3000/M	  
     

AI Kullanım Alanları
--------------------

*   AI tabanlı alarm ve güvenlik sistemleri
*   Enerji yönetimi ve yük optimizasyonu
*   Endüstriyel Edge AI uygulamaları
*   Uzaktan izleme ve otomatik müdahale
*   Test, AR-GE ve prototipleme

**Teknik Altyapı**

Python kütüphaneleri: requests, pymodbus, paho-mqtt, socket.  
Haberleşme: TCP/IP, HTTP, MQTT, Modbus TCP.  
Edge cihazlar: Raspberry Pi, Mini PC, Sunucu sistemleri.  
[Uyumlu Ethernet IO kartlarımız](https://sedaelektronik.com.tr/internetten-role-cihaz-kontrol.html)  
[Uyumlu Usb IO kartlarımız](https://sedaelektronik.com.tr/bilgisayardan-role-kontrol.html)  

### İletişim Bilgilerimiz:

Satış ve teknik destek için Whatsapp-Telegram-Bip-Signal:  
(Çalışma Saatleri 09:00 - 17:30 Cumartesi - Pazar günleri kapalıyız.)

[📞 +90 544 774 18 19 Ara](tel:+905447741819) [☎️ +90 222 233 72 64 Ara](tel:+902222337264) [✉️ E-posta Gönder](mailto:info@sedaelektronik.com) [▶️🔴YouTube CANLI DEMO TESTİ](https://www.youtube.com/@sedaelektronik/streams)

**Adres:** İstiklal Mah. Şirinyer Sok. No:2/B ODUNPAZARI - ESKİŞEHİR

sedaelektronik.com.tr tüm hakları saklıdır.

© Seda Elektronik — Tüm hakları saklıdır.

AI & Embedded Solutions