MD7S05 โมดูลจอแอลอีดี 7-Segment Module WHMXE-595-2 74HC595 SPI 0.5-2Digit Red

฿69.00

สั่งจองสินค้าได้

คำอธิบาย

โมดูลแสดงผลแบบดิจิตอล ไดรฟ์อินเทอร์เฟซ 3 สาย 74HC595 Digital display module. 3 wire interface 74HC595 drives

  • 7-Segment Module WHMXE-595-2

Interface

  1. VCC +
  2. GND –
  3. SDD Data
  4. SCLK Clock
  5. LOAD Latch

Dimension

  • 38. 2mm x 25.6mm

7-Segment Module 74HC595 SPI 0.5-2 Digit Arduino Code

การสื่อสาร SPI  การใช้ไลบรารี Arduino SPI ในตัวหรือไลบรารี SPI.h

Pin connections

  1. SER Data Pin
  2. SRCLK Clock Pin
  3. RCLK Latch Pin
#include <SPI.h>

#define latchPin 10 // Pin connected to RCLK or ST_CP of 74HC595
#define clockPin 13 // Pin connected to SRCLK or SH_CP of 74HC595
#define dataPin 11 // Pin connected to SER or DS of 74HC595

byte digitData[] = {
  0b00111111, // 0
  0b00000110, // 1
  0b01011011, // 2
  0b01001111, // 3
  0b01100110, // 4
  0b01101101, // 5
  0b01111101, // 6
  0b00000111, // 7
  0b01111111, // 8
  0b01101111  // 9
};

void setup() {
  SPI.begin();
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  int number = 42; // Change this to the number you want to display
  
  int ones = number % 10;
  int tens = (number / 10) % 10;
  
  displayDigit(tens, 1); // Display tens digit on first 7-segment
  delay(5); // Adjust delay as needed for display persistence
  displayDigit(ones, 2); // Display ones digit on second 7-segment
  delay(5); // Adjust delay as needed for display persistence
}

void displayDigit(int digit, int position) {
  digitalWrite(latchPin, LOW);
  SPI.transfer(digitData[digit]);
  digitalWrite(latchPin, HIGH);

  // Set position to display the digit
  digitalWrite(latchPin, LOW);
  if (position == 1) {
    SPI.transfer(0b00000001); // Display on the first 7-segment
  } else if (position == 2) {
    SPI.transfer(0b00000010); // Display on the second 7-segment
  }
  digitalWrite(latchPin, HIGH);
}

 

 

รีวิว

ยังไม่มีบทวิจารณ์

เฉพาะลูกค้าที่เข้าสู่ระบบ และเคยซื้อสินค้าชิ้นนี้แล้วเท่านั้น ที่เขียนบทวิจารณ์ได้