Ethernet Modülü USR ES1 w5500 Lite SPI'dan Ethernet/TCP/IP Dönüştürücü USR-ES1

Ürün Kodu : Ethernet Modülü
312,00 TL
Havale Fiyatı : 302,64 TL %3  İndirim
Daha Fazla fixaj
Daha Fazla Diğer
Beğen

Tükendi

Gelince Haber Ver
Listeye Ekle Tavsiye Et Yorum Yap Fiyat Alarmı

USR-ES1 bir SPI arayüzünün Ethernet modülüdür, 3in1 ESP PCB lerimiz ile uyumludur. Ethernet üzerinden internete bağlanmanız gereken projelerde kullanabilirsiniz. PCB üzerindeki yerlere lehimlemeniz yeterlidir. PCB tasarımı ona uygun şekilde tasarlanmıştır.

Örnek Kod: Thingspeak Kütüphanesindeki Örnek Kodu çalıştırıken CS pinini 5 yapmanız yeterlidir.

#include "LoRa_E22.h"
#include

#include
#include "secret.h"
#include "ThingSpeak.h"  // always include thingspeak header file after other header files and custom macros


#define M0 32  //3in1 PCB mizde pin 7
#define M1 33  //3in1 PCB mizde pin 6
#define RX 27  //3in1 PCB mizde pin RX **YENİ** Versiyon 1.0 ile
#define TX 35  //3in1 PCB mizde pin TX

HardwareSerial fixajSerial(1);
LoRa_E22 e32(TX, RX, &fixajSerial, UART_BPS_RATE_9600);

HardwareSerial ss(2);  //RS232 çıkışı

struct Signal {
  char type[15] = "Fixaj.com";
  byte role;
  bool role1;
  bool role2;
} data;

byte ethernetGelenVeri = 0;

/////////////////////// Ethernet
byte mac[] = SECRET_MAC;

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1);

EthernetClient client;

// Weather station channel details
unsigned long weatherStationChannelNumber = SECRET_CH_ID_WEATHER_STATION;
unsigned int temperatureFieldNumber = 4;

// Counting channel details
unsigned long counterChannelNumber = SECRET_CH_ID_COUNTER;
const char* myCounterReadAPIKey = SECRET_READ_APIKEY_COUNTER;
unsigned int counterFieldNumber = 1;
//////////////////////

unsigned long kanalBekleme_sure = 0;
int kanalBekleme_bekleme = 2000;

 

void setup() {
  pinMode(M0, OUTPUT);
  pinMode(M1, OUTPUT);
  digitalWrite(M0, LOW);
  digitalWrite(M1, LOW);

  pinMode(14, OUTPUT);  //buzzer ve led pini aynı, diğer led AUX ledi
  digitalWrite(14, 0);

  Serial.begin(115200);
  e32.begin();  //LoRa açılış
  delay(500);

  ss.begin(9600, SERIAL_8N1, 16, 17);  //RS232 Açılış
  delay(500);

  Ethernet.init(5);  //Ethernet chip select pini tanımla 3in1 ESP için 5
    // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1);  // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);

  ThingSpeak.begin(client);  // Initialize ThingSpeak

  Serial.println(F("Fixaj.com başlıyoruz..."));
}

void loop() {
  while (e32.available() > 5) {

    // Gelen mesaj okunuyor
    ResponseStructContainer rsc = e32.receiveMessage(sizeof(Signal));
    struct Signal data = *(Signal*)rsc.data;
    Serial.print("Gelen Messaj: ");
    Serial.println(data.role);
    rsc.close();

    if (strcmp(data.type, "Fixaj.com") == 0) {
      Serial.println("sifre dogru");

      /////ethernet okuma
      int statusCode = 0;

      // Read in field 4 of the public channel recording the temperature
      float temperatureInF = ThingSpeak.readFloatField(weatherStationChannelNumber, temperatureFieldNumber);

      // Check the status of the read operation to see if it was successful
      statusCode = ThingSpeak.getLastReadStatus();
      if (statusCode == 200) {
        Serial.println("Temperature at MathWorks HQ: " + String(temperatureInF) + " deg F");
 
        ekranYaz((byte) temperatureInF );

      } else {
        Serial.println("Problem reading channel. HTTP error code " + String(statusCode));
      }

      //delay(15000);  // No need to read the temperature too often.

      // Read in field 1 of the private channel which is a counter
      long count = ThingSpeak.readLongField(counterChannelNumber, counterFieldNumber, myCounterReadAPIKey);

      // Check the status of the read operation to see if it was successful
      statusCode = ThingSpeak.getLastReadStatus();
      if (statusCode == 200) {
        Serial.println("Counter: " + String(count));
      } else {
        Serial.println("Problem reading channel. HTTP error code " + String(statusCode));
      }

      //delay(15000);  // No need to read the counter too often.
    }
  }

  if (millis() > kanalBekleme_sure + kanalBekleme_bekleme) {
    kanalBekleme_sure = millis();
    digitalWrite(14, !digitalRead(14));
    Serial.print("led: ");
    Serial.println(digitalRead(14));
  }
}



void ekranYaz(byte a) {
  ss.write(0xaa);  // packet head
  ss.write(0x3d);  // VP_N16 write command
  ss.write(0x00);  // VP_N16 address
  ss.write(
T-Soft E-Ticaret Sistemleriyle Hazırlanmıştır.