MicroPython+ESP32 C3+ST7735S LCD屏 WIFI联网显示实时时间

案例地址:https://gitee.com/whltaoin_admin/MP_ESP32_ST7735S-

展示效果

ESP32+LCD屏 WIFI联网并显示实时时间

image.png
image.png

TFT LCD模块参数介绍

image.png
image.png

  1. 名称:1.8 128*160 RGB_TFT
  2. 驱动芯片:ST7735S

ESP32 C3 参数介绍(经典款)

  1. 外观及引脚分布

image.png

接线

LCD屏接口功能ESP32 C3 对应连接引脚
GND电源(接地)GND
VCC电源(正极3.3V)3.3V
SCLSPI时钟线(与单片机SPI_CLK对接)IO02
SDASPI数据线(与单片机SPI_MOSI对接)IO03
RES复位IO10
DC数据/命令IO06
CSSPI片选IO07
BL背光控制开发,默认可不接IO08

项目初始化

一、项目结构

image.png

boot.py:用于连接WIFI,打印初始化信息等。
font.bmf: 文字库
st7735.py: ST7735驱动
test.py: 测试效果文件
ufont.py: 字体文件

二、st7735.py

"""
使用方法(以合宙ESP32C3为例):
    from machine import SPI, Pin
    from st7735 import ST7735
    spi = SPI(1, 30000000, sck=Pin(2), mosi=Pin(3))
    ST7735(spi, rst=10, dc=6, cs=7, bl=11, width=160, height=80, rotate=1)  # 直插横屏显示
    ST7735(spi, rst=10, dc=6, cs=7, bl=11, width=160, height=80, rotate=0)  # 直插竖屏显示
"""
import gc
import time
import math

import machine
import framebuf
from micropython import const

SWRESET = const(0x01)
SLPOUT = const(0x11)
NORON = const(0x13)

INVOFF = const(0x20)
DISPON = const(0x29)
CASET = const(0x2A)
RASET = const(0x2B)
RAMWR = const(0x2C)

MADCTL = const(0x36)
COLMOD = const(0x3A)

FRMCTR1 = const(0xB1)
FRMCTR2 = const(0xB2)
FRMCTR3 = const(0xB3)

INVCTR = const(0xB4)

PWCTR1 = const(0xC0)
PWCTR2 = const(0xC1)
PWCTR3 = const(0xC2)
PWCTR4 = const(0xC3)
PWCTR5 = const(0xC4)
VMCTR1 = const(0xC5)

GMCTRP1 = const(0xE0)
GMCTRN1 = const(0xE1)

ROTATIONS = [0x00,0x60]  # 只给了两个旋转方向


def color(r, g, b):
    i = (((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3)).to_bytes(2, "little")
    return (i[0] << 8) + i[1]

RED = color(255, 0, 0)
GREEN = color(0, 255, 0)
BLUE = color(0, 0, 255)
WHITE = color(255, 255, 255)
BLACK = color(0, 0, 0)


class ST7735(framebuf.FrameBuffer):
    def __init__(self, spi, rst, dc, cs, bl=None, width=None, height=None, offset=None, rotate=1, rgb=True):
        """
        :param spi:
        :param rst:
        :param dc:
        :param cs: 使能
        :param bl: 背光
        :param width: 宽度
        :param height: 高度
        :param offset: 偏移 (x, y): (23, -1)|(-1, 23)
        :param rotate: 旋转 0 横屏 1 竖屏
        :param rgb: RGB 色彩模式
        """
        # 根据方向自动设置偏移
        self.rotate = rotate
        self.offset = offset
        self.rgb = rgb
        if offset is None and rotate == 1:
            self.offset = (-1, 23)
        elif offset is None and rotate == 0:
            self.offset = (23, -1)
        self.width = width
        self.height = height

        self.spi = spi
        self.rst = machine.Pin(rst, machine.Pin.OUT, machine.Pin.PULL_DOWN)
        self.dc = machine.Pin(dc, machine.Pin.OUT, machine.Pin.PULL_DOWN)
        self.cs = machine.Pin(cs, machine.Pin.OUT, machine.Pin.PULL_DOWN)
        if bl is not None:
            self.bl = machine.PWM(machine.Pin(bl))

        gc.collect()
        self.buffer = bytearray(self.height * self.width * 2)
        super().__init__(self.buffer, self.width, self.height, framebuf.RGB565)
        self.init()
        self.set_windows()
        self.clear()

    def set_windows(self, x_start=None, y_start=None, x_end=None, y_end=None):
        """
        设置窗口
        :return:
        """
        x_start = (x_start + self.offset[0] + 1) if x_start is not None else (self.offset[0] + 1)
        x_end = x_end + self.rotate + self.offset[0] if x_end is not None else self.width + self.rotate + \
                                                                               self.offset[0]
        y_start = y_start + self.offset[1] + 1 if y_start is not None else self.offset[1] + 1
        y_end = y_end + self.rotate + self.offset[1] if y_end is not None else self.height + self.rotate + \
                                                                               self.offset[1]
 
        self.write_cmd(CASET)
        self.write_data(bytearray([0x00, x_start, 0x00, x_end]))
 
        self.write_cmd(RASET)
        self.write_data(bytearray([0x00, y_start, 0x00, y_end]))
 
        self.write_cmd(RAMWR)
 
    def init(self):
        self.reset()
 
        self.write_cmd(SWRESET)
        time.sleep_us(150)
        self.write_cmd(SLPOUT)
        time.sleep_us(300)
 
        self.write_cmd(FRMCTR1)
        self.write_data(bytearray([0x01, 0x2C, 0x2D]))
        self.write_cmd(FRMCTR2)
        self.write_data(bytearray([0x01, 0x2C, 0x2D]))
        self.write_cmd(FRMCTR3)
        self.write_data(bytearray([0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D]))
        time.sleep_us(10)
 
        self.write_cmd(INVCTR)
        self.write_data(bytearray([0x07]))
 
        self.write_cmd(PWCTR1)
        self.write_data(bytearray([0xA2, 0x02, 0x84]))
        self.write_cmd(PWCTR2)
        self.write_data(bytearray([0xC5]))
        self.write_cmd(PWCTR3)
        self.write_data(bytearray([0x0A, 0x00]))
        self.write_cmd(PWCTR4)
        self.write_data(bytearray([0x8A, 0x2A]))
        self.write_cmd(PWCTR5)
        self.write_data(bytearray([0x8A, 0xEE]))
        self.write_cmd(VMCTR1)
        self.write_data(bytearray([0x0E]))
 
        self.write_cmd(INVOFF)
 
        self.write_cmd(MADCTL)
        self.write_data(bytearray([ROTATIONS[self.rotate] | 0x00 if self.rgb else 0x08]))
 
        self.write_cmd(COLMOD)
        self.write_data(bytearray([0x05]))
 
        self.write_cmd(GMCTRP1)
        self.write_data(
            bytearray([0x02, 0x1c, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2d, 0x29, 0x25, 0x2b, 0x39, 0x00, 0x01, 0x03, 0x10]))
 
        self.write_cmd(GMCTRN1)
        self.write_data(
            bytearray([0x03, 0x1d, 0x07, 0x06, 0x2e, 0x2c, 0x29, 0x2d, 0x2e, 0x2e, 0x37, 0x3f, 0x00, 0x00, 0x02, 0x10]))
 
        self.write_cmd(NORON)
        time.sleep_us(10)
 
        self.write_cmd(DISPON)
        time.sleep_us(100)
 
        self.cs(1)
 
    def reset(self):
        """
        设备重置
        :return:
        """
        self.rst(1)
        time.sleep(0.2)
        self.rst(0)
        time.sleep(0.2)
        self.rst(1)
        time.sleep(0.2)
 
    def write_cmd(self, cmd):
        self.dc(0)
        self.cs(0)
        self.spi.write(bytearray([cmd]))
        self.cs(1)
 
    def write_data(self, buf):
        self.dc(1)
        self.cs(0)
        self.spi.write(buf)
        self.cs(1)
 
    def back_light(self, value):
        """
        背光调节
        :param value: 背光���级 0 ~ 256
        :return:
        """
        self.bl.freq(1000)
        if value >= 0xff:
            value = 0xff
        data = value * 0xffff >> 8
        self.bl.duty_u16(data)
 
    def clear(self):
        """
        清屏
        :return:
        """
        self.fill(0)
        self.show()
 
    def show(self):
        """
        显示
        :return:
        """
        self.set_windows()  # 如果没有这行就会偏移
        self.write_data(self.buffer)
 
    def circle(self, center, radius, c=color(255, 255, 255), section=100):
        """
        画圆
        :param c: 颜色
        :param center: 中心(x, y)
        :param radius: 半径
        :param section: 分段
        :return:
        """
        arr = []
        for m in range(section + 1):
            x = round(radius * math.cos((2 * math.pi / section) * m - math.pi) + center[0])
            y = round(radius * math.sin((2 * math.pi / section) * m - math.pi) + center[1])
            arr.append([x, y])
        for i in range(len(arr) - 1):
            self.line(*arr[i], *arr[i + 1], c)
 
    def image(self, file_name):
        with open(file_name, "rb") as bmp:
            for b in range(0, 80 * 160 * 2, 1024):
                self.buffer[b:b + 1024] = bmp.read(1024)
            self.show()
 

三、ufont.py

__version__ = 3
 
import time
import struct
 
import framebuf
 
DEBUG = False
 
def timeit(f, *args, **kwargs):
    try:
        myname = str(f).split(' ')[1]
    except:
        myname = "UNKONW"
 
    def new_func(*args, **kwargs):
        if DEBUG:
            try:
                t = time.ticks_us()
                result = f(*args, **kwargs)
                delta = time.ticks_diff(time.ticks_us(), t)
                print('Function {} Time = {:6.3f}ms'.format(myname, delta / 1000))
            except AttributeError:
                t = time.perf_counter_ns()
                result = f(*args, **kwargs)
                delta = time.perf_counter_ns() - t
                print('Function {} Time = {:6.3f}ms'.format(myname, delta / 1000000))
            return result
        else:
            return f(*args, **kwargs)
 
    return new_func
 
class BMFont:
    @staticmethod
    def _list_to_byte(arr):
        b = 0
        for a in arr:
            b = (b << 1) + a
        return bytes([b])
 
    @timeit
    def _bit_list_to_byte_data(self, bit_list):
        """将点阵转换为字节数据
        Args:
            bit_list:
        Returns:
        """
        byte_data = b''
        for _col in bit_list:
            for i in range(0, len(_col), 8):
                byte_data += self._list_to_byte(_col[i:i + 8])
        return byte_data
 
    @timeit
    def __init__(self, font_file):
        self.font_file = font_file
 
        self.font = open(font_file, "rb", buffering=0xff)
 
        self.bmf_info = self.font.read(16)
 
        if self.bmf_info[0:2] != b"BM":
            raise TypeError("字体文件格式不正确: " + font_file)
 
        self.version = self.bmf_info[2]
        if self.version != 3:
            raise TypeError("字体文件版本不正确: " + str(self.version))
 
        self.map_mode = self.bmf_info[3]  # 映射方式
        self.start_bitmap = struct.unpack(">I", b'\x00' + self.bmf_info[4:7])[0]  # 位图开始字节
        self.font_size = self.bmf_info[7]  # 字体大小
        self.bitmap_size = self.bmf_info[8]  # 点阵所占字节
 
    @timeit
    def _to_bit_list(self, byte_data, font_size, *, _height=None, _width=None):
        """将字节数据转��为点阵数据
        Args:
            byte_data: 字节数据
            font_size: 字号大小
            _height: 字体原高度
            _width: 字体原宽度
        Returns:
        """
        _height = _height or self.font_size
        _width = _width or self.bitmap_size // self.font_size * 8
        new_bitarray = [[0 for j in range(font_size)] for i in range(font_size)]
        for _col in range(len(new_bitarray)):
            for _row in range(len(new_bitarray[_col])):
                _index = int(_col / (font_size / _height)) * _width + int(_row / (font_size / _width))
                new_bitarray[_col][_row] = byte_data[_index // 8] >> (7 - _index % 8) & 1
        return new_bitarray
 
    @timeit
    def _color_render(self, bit_list, color):
        """将二值点阵图像转换为 RGB565 彩色字节图像
        Args:
            bit_list:
            color:
        Returns:
        """
        color_array = b""
        for _col in range(len(bit_list)):
            for _row in range(len(bit_list)):
                color_array += struct.pack("<H", color) if bit_list[_col][_row] else b'\x00\x00'
        return color_array
 
    @timeit
    def _get_index(self, word):
        """获取索引
        Args:
            word: 字符
        Returns:
        """
        word_code = ord(word)
        start = 0x10
        end = self.start_bitmap
 
        while start <= end:
            mid = ((start + end) // 4) * 2
            self.font.seek(mid, 0)
            target_code = struct.unpack(">H", self.font.read(2))[0]
            if word_code == target_code:
                return (mid - 16) >> 1
            elif word_code < target_code:
                end = mid - 2
            else:
                start = mid + 2
        return -1
 
    @timeit
    def get_bitmap(self, word):
        """获取点阵图
        Args:
            word: 字符
        Returns:
            bytes 字符点阵
        """
        index = self._get_index(word)
        if index == -1:
            return b'\xff\xff\xff\xff\xff\xff\xff\xff\xf0\x0f\xcf\xf3\xcf\xf3\xff\xf3\xff\xcf\xff?\xff?\xff\xff\xff' \
                   b'?\xff?\xff\xff\xff\xff'
 
        self.font.seek(self.start_bitmap + index * self.bitmap_size, 0)
        return self.font.read(self.bitmap_size)
 
    @timeit
    def text(self, display, string, x, y, color=1, *, font_size=None, reverse=False, clear=False, show=False,
             half_char=True, auto_wrap=False, **kwargs):
        """通过显示屏显示文字
        使用此函数显示文字,必须先确认显示对象是否继承与 framebuf.FrameBuffer。
        如果显示对象没有 clear 方法,需要自行调用 fill 清屏
        Args:
            display: 显示实例
            string: 字符串
            x: 字体左上角 x 轴
            y: 字体左上角 y 轴
            color: 颜色
            font_size: 字号
            reverse: 是否反转背景
            clear: 是否清��之前显示的内容
            show: 是否立刻显示
            half_char: 是否半字节显示 ASCII 字符
            auto_wrap: 自动换行
            **kwargs:
            Returns:
            None
        """
        font_size = font_size or self.font_size
        initial_x = x
 
        # 清屏
        try:
            display.clear() if clear else 0
        except AttributeError:
            print("请自行调用 display.fill(*) 清屏")
 
        for char in range(len(string)):
            # 是否自动换行
            if auto_wrap:
                if auto_wrap and ((x + font_size // 2 >= 128 and ord(string[char]) < 128 and half_char) or
                                  (x + font_size >= 128 and (not half_char or ord(string[char]) > 128))):
                    y += font_size
                    x = initial_x
 
            # 回车
            if string[char] == '\n':
                y += font_size
                x = initial_x
                continue
            # Tab
            elif string[char] == '\t':
                x = ((x // font_size) + 1) * font_size + initial_x % font_size
                continue
            
            # 其它的控制字符不显示
            elif ord(string[char]) < 16:
                continue
            
            # 超过范围的字符不会显示*
            if x > 160 or y > 80:
                continue
            
            byte_data = list(self.get_bitmap(string[char]))
 
            # 反���
            if reverse:
                for _pixel in range(len(byte_data)):
                    byte_data[_pixel] = ~byte_data[_pixel] & 0xff
 
            # 缩放和色彩*
            if color > 1 or font_size != self.font_size:
                bit_data = self._to_bit_list(byte_data, font_size)
                if color > 1:
                    display.blit(
                        framebuf.FrameBuffer(bytearray(self._color_render(bit_data, color)), font_size, font_size,
                                             framebuf.RGB565), x, y)
                else:
                    display.blit(
                        framebuf.FrameBuffer(bytearray(self._bit_list_to_byte_data(bit_data)), font_size, font_size,
                                             framebuf.MONO_HLSB), x, y)
            else:
                display.blit(framebuf.FrameBuffer(bytearray(byte_data), font_size, font_size, framebuf.MONO_HLSB), x, y)
 
            # 英文字符半格显示
            if ord(string[char]) < 128 and half_char:
                x += font_size // 2
            else:
                x += font_size
 
        display.show() if show else 0
 
    def char(self, char, color=1, font_size=None, reverse=False):
        """ 获取字体字��数据
        在没有继承 framebuf.FrameBuffer 的显示驱动,或者内存不足以将一整个屏幕载入缓存帧时
        可以直接获取单字的字节数据,局部更新
        Args:
            char: 单个字符
            color: 颜色
            font_size: 字体大小
            reverse: 反转
            Returns:
            bytearray
        """
        font_size = font_size or self.font_size
        byte_data = list(self.get_bitmap(char))
 
        # 反转
        if reverse:
            for _pixel in range(len(byte_data)):
                byte_data[_pixel] = ~byte_data[_pixel] & 0xff
        if color > 1 or font_size != self.font_size:
            bit_data = self._to_bit_list(byte_data, font_size)
            if color > 1:
                return self._color_render(bit_data, color)
            else:
                return self._bit_list_to_byte_data(bit_data)
        else:
            return bytearray(byte_data)

四、字库font.bmf

下载地址:https://gitee.com/whltaoin_admin/MP_ESP32_ST7735S-

WIFI连接初始化屏幕

# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
#import webrepl
#webrepl.start()
# print("varin")

from machine import Pin,SPI
from st7735 import ST7735,color
from ufont import BMFont
import time
import random
import network
import ntptime

 
font = BMFont("font.bmf")
#  WIFI名称和连接密码
ssid="aaa"
password="12345678"
 
spi = SPI(1,baudrate = 60_000_000,polarity = 0,sck = Pin(2),mosi = Pin(3),miso = None)
tft = ST7735(spi,rst = 10,dc = 6,cs = 7,bl = 8, width = 160, height = 127, offset=(-1,0)  ,rotate = 1, rgb = True)
def network_connect():
    font.text(tft,"WIFI网络连接中~" ,0,0,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
    sta = network.WLAN(network.STA_IF)
    sta.active(True)
    # 判断WIF是否连接,如无连接通过循环等待WIFI连接后再执行后续代码
    if not sta.isconnected():
        sta.connect(ssid,password)
        while not sta.isconnected():
            pass
        print(sta.ifconfig())
        ntptime.settime()
        print()
        font.text(tft,"WIFI网络连接成功~" ,0,0,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
        font.text(tft,"WIFI名称为:"+ssid ,0,20,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
        font.text(tft,"IP地址:"+sta.ifconfig()[0] ,0,40,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
        while True:
            # 实时更新屏幕时间,
            t=time.localtime()
            timeStr=   '当前时间是:{}:{}:{}'.format( t[3], t[4], t[5])
            font.text(tft,timeStr ,0,60,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
            font.text(tft,"今天又是加油的一天呀" ,0,80,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   




if __name__ == "__main__":
    network_connect()
    
    


# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
#import webrepl
#webrepl.start()
# print("varin")

from machine import Pin,SPI
from st7735 import ST7735,color
from ufont import BMFont
import time
import random
import network
import ntptime
from machine import RTC
import time

rtc = RTC()



 
font = BMFont("font.bmf")
#  WIFI名称和连接密码
ssid="aaa"
password="12345678"
 
spi = SPI(1,baudrate = 60_000_000,polarity = 0,sck = Pin(2),mosi = Pin(3),miso = None)
tft = ST7735(spi,rst = 10,dc = 6,cs = 7,bl = 8, width = 160, height = 127, offset=(-1,0)  ,rotate = 1, rgb = True)
def network_connect():
    font.text(tft,"WIFI网络连接中~" ,0,0,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
    sta = network.WLAN(network.STA_IF)
    sta.active(True)
    # 判断WIF是否连接,如无连接通过循环等待WIFI连接后再执行后续代码
    if not sta.isconnected():
        sta.connect(ssid,password)
        while not sta.isconnected():
            pass
        print(sta.ifconfig())
        ntptime.settime()
        print()
        font.text(tft,"WIFI网络连接成功~" ,0,0,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
        font.text(tft,"WIFI名称为:"+ssid ,0,20,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
        font.text(tft,"IP地址:"+sta.ifconfig()[0] ,0,40,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
        while True:
            # 实时更新屏幕时间
            t= rtc.datetime()
            timeStr=   '当前时间是:{}:{}:{}'.format( t[4]+8, t[5], t[6])
            font.text(tft,timeStr ,0,60,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
            font.text(tft,"今天又是加油的一天呀" ,0,80,color(random.randint(1,256),random.randint(1,256),random.randint(1,256)),font_size = 16,reverse = False,clear = False,show = True,half_char = True,auto_wrap = False)   
            time.sleep(1)



if __name__ == "__main__":
    network_connect()
    
    


注意

本案例初始化模块代码是参照以下作者,若侵权,请联系本作者。
https://blog.csdn.net/zhusongziye/article/details/135757477

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/727536.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Kafka基础教程

Kafka基础教程 资料来源&#xff1a;Apache Kafka - Introduction (tutorialspoint.com) Apache Kafka起源于LinkedIn&#xff0c;后来在2011年成为一个开源Apache项目&#xff0c;然后在2012年成为一流的Apache项目。Kafka是用Scala和Java编写的。Apache Kafka是基于发布-订…

leetcode:557. 反转字符串中的单词 III(python3解法)

难度&#xff1a;简单 给定一个字符串 s &#xff0c;你需要反转字符串中每个单词的字符顺序&#xff0c;同时仍保留空格和单词的初始顺序。 示例 1&#xff1a; 输入&#xff1a;s "Lets take LeetCode contest" 输出&#xff1a;"steL ekat edoCteeL tsetnoc…

el-table表格变更前后根据数据值改变背景颜色

需求&#xff1a; 1.左侧变更前表格数据不可以编辑&#xff0c;并且背景色加灰 2.右侧变更后表格数据可被编辑&#xff0c;编辑后变更前与变更后行数据不一致&#xff0c;添加背景色区分 3.点击删除的时候&#xff0c;给变更后表格当前行&#xff0c;添加背景色和删除的中横…

jax.nn.initializers.glorot_normal()

import jax import jax.numpy as jnp from jax import random import jax.nn.initializers as init# 设置随机数种子 key random.PRNGKey(42)# 定义权重的形状 shape (in_dim, out_dim)# 获取 Glorot 正态初始化函数 glorot_normal_init init.glorot_normal()# 初始化权重 w…

C++初学者指南第一步---10.内存(基础)

C初学者指南第一步—10.内存&#xff08;基础&#xff09; 文章目录 C初学者指南第一步---10.内存&#xff08;基础&#xff09;1.内存模型1.1 纸上谈兵&#xff1a;C的抽象内存模型1.2 实践&#xff1a;内存的实际处理 2. 自动存储3.动态存储&#xff1a;std::vector3.1 动态内…

互联网技术基础-计算机人必看

目录 1.Internet的工作原理 1、Internet是一个分组交换系统 2、路由器是Internet实现互连的“标准件” 3、TCP/IP是Internet的核心协议 4、客户机/服务器的工作模式 2. IP地址 2.1 IP地址分类 2.2特殊IP地址 2.3路由器和IP编制原则 2.4子网的划分 2.5 IPV6 3.域名系…

Spatio-temporal Relation Modeling for Few-shot Action Recognition

标题&#xff1a;少样本动作识别的时空关系建模 源文链接&#xff1a;Thatipelli_Spatio-Temporal_Relation_Modeling_for_Few-Shot_Action_Recognition_CVPR_2022_paper.pdf (thecvf.com)https://openaccess.thecvf.com/content/CVPR2022/papers/Thatipelli_Spatio-Temporal_…

Sping源码(九)—— Bean的初始化(非懒加载)— Bean的创建方式(factoryMethod)

序言 前面文章介绍了在Spring中多种创建Bean实例的方式&#xff0c;包括采用FactoryBean的方式创建对象、使用反射创建对象、自定义BeanFactoryPostProcessor。 这篇文章继续介绍Spring中创建Bean的形式之一——factoryMethod。方法用的不多&#xff0c;感兴趣可以当扩展了解。…

Centos7.9安装kerberos

文章目录 一、背景二、Kerberos安装部署2.1kerberos服务端必要软件安装2.2配置krb5.conf2.3配置kdc.conf2.4配置kadm5.acl2.5创建Kerberos数据库2.6启动Kerberos服务2.7创建Kerberos管理员principal2.8客户端安装kerberos2.9Kerberos功能验证 本人其他相关文章链接 一、背景 亲…

Qemu虚拟机在线迁移到VMware

libvirt版本&#xff1a;libvirt-10.0.0qemu版本&#xff1a;qemu-8.2.0 在生产环境中&#xff0c;大多数的场景是 vmware 虚拟机迁移到 qemu 环境&#xff0c;一般是通过关机然后导出、导入磁盘镜像来实现。 如果要将 qemu 环境虚拟机迁移到 vmware 怎么办呢&#xff1f;要求…

112、路径总和

给你二叉树的根节点 root 和一个表示目标和的整数 targetSum 。判断该树中是否存在 根节点到叶子节点 的路径&#xff0c;这条路径上所有节点值相加等于目标和 targetSum 。如果存在&#xff0c;返回 true &#xff1b;否则&#xff0c;返回 false 。 叶子节点 是指没有子节点…

【VMware】VMware虚拟机安装_配置_使用教程

一、准备工作 1、下载VMware软件&#xff1a;访问VMware官方网站&#xff0c;下载适合你操作系统的VMware Workstation Pro安装包。 下载地址&#xff1a;VMware Desktop Hypervisors for Windows, Linux, and Mac 2、准备操作系统镜像文件&#xff1a;根据你想要在虚拟机中安…

[Vulnhub] Sleepy JDWP+Tomcat+Reverse+Reverse-enginnering

信息收集 Server IP AddressPorts Opening192.168.8.100TCP:21,8009,9001 $ nmap -sV -sC 192.168.8.100 -p- --min-rate 1000 -Pn Starting Nmap 7.92 ( https://nmap.org ) at 2024-06-20 05:06 EDT Nmap scan report for 192.168.8.100 (192.168.8.100) Host is up (0.00…

前端入门篇(五十二)练习6:transition过渡小动画

所以应该先找到第n个li&#xff0c;找到li再找img&#xff0c;li没有找错&#xff0c;底下又各自只有一个img&#xff0c;解决 ul li:nth-child(1) img { } 描述文字从下往上&#xff1a; 一开始描述也在框框下面&#xff0c;当hover时&#xff0c;translateY(0)&#xff0…

【etcd】etcd单机安装及简单操作

https://blog.csdn.net/Mr_XiMu/article/details/125026635 https://blog.csdn.net/m0_73192864/article/details/136509244 etcd在生产环境中一般为集群方式部署 etcd使用的2个默认端口号&#xff1a;2379和2380 2379&#xff1a;用于客户端通信(类似于sqlserver的1433&#x…

动态住宅代理IP:多账号矩阵管理的使用

如果您要处理多个在线帐户&#xff0c;选择正确的代理类型对于实现流畅的性能至关重要。但最适合这项工作的代理类型是什么&#xff1f; 为了更好地管理不同平台上的多个账户并优化成本&#xff0c;动态住宅代理IP通常作用在此。 一、什么是轮换代理&#xff1f; 轮换代理充当…

【Android面试八股文】你刚刚提到了V2签名使用美团的Walle实现多渠道打包,那么你能讲一讲Android 签名的 v1、v2、v3、v4版本的区别吗?

文章目录 前言一、简介二、APK 签名方案 v1 (JAR签名)2.1. 签名过程2.2 验证过程2.3 详细例子2.4 优缺点2.5 美团基于V1版本的多渠道打包方案三、APK 签名方案 v23.1 为什么要设计APK 签名方案 v2 ?3.2 APK 签名方案 v2 : 签名前和签名后的 APK3.2.1 签名前和签名后的 APK3.2…

04 - matlab m_map地学绘图工具基础函数 - 设置网格

04 - matlab m_map地学绘图工具基础函数 - 设置网格 0. 引言1. 关于m_grid2. 关于m_utmgrid3. 结语 0. 引言 本篇介绍下m_map中网格设置有关的函数m_grid和m_utmgrid&#xff0c;其中m_grid较为常用&#xff0c;m_utmgrid为设置UTM网格&#xff0c;仅支持在UTM投影下使用。 首先…

学校图书借阅管理系统(数据库课设)PS:有前端界面

1.课设要求描述 ●实现图书信息、类别、出版社等信息的管理; ●实现读者信息、借阅证信息的管理; ●实现图书的借阅、续借、归还管理; ●实现超期罚款管理、收款管理; ●创建触发器&#xff0c;分别实现借书和还书时自动更新图书信息的在册数量; ●创建视图查询各种图书…

工业AIoT竞赛

模块一&#xff1a;工业物联环境构建 # 查看节点状态 kubectl get nodes # 查看所有 pods 状态 kubectl get pods --all-namespaces cd /data/script/ ls | grep install_openyurt_manager # ./install_openyurt_manager_v5.sh是搜索到的脚本文件 ./install_openyurt_manager_v…