Arduino 项目笔记 |TH1621 LCD液晶显示屏驱动(SSOP-24封装)

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


LCD液晶屏资料

LCD液晶屏资料

在这里插入图片描述

重要参数:

  • 工作电压: 3V
  • 可视角度:120°
  • 1/4 ,1/3

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


TH1621 驱动

HT1621 LCD控制驱动芯片介绍

VLCD 和 VCC 电压符合规格书,最好都取3.3V 。电压太高或太低都会出现段码液晶屏乱码的情况,要么多一笔,要么若隐若现的显示一笔。

在这里插入图片描述

TH1621.h

/*******************************************************************************
Copyright 2016-2018 anxzhu (github.com/anxzhu)
Copyright 2018-2020 Valerio Nappi (github.com/valerionew) (changes)
Based on segment-lcd-with-ht1621 from anxzhu (2016-2018)
(https://github.com/anxzhu/segment-lcd-with-ht1621)Partially rewritten and extended by Valerio Nappi (github.com/valerionew) in 2018This file is part of the HT1621 arduino library, and thus under the MIT license.
More info on the project and the license conditions on :
https://github.com/valerionew/ht1621-7-segPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*******************************************************************************/#ifndef HT1621_H_
#define HT1621_H_   //防止重复包含const unsigned char  LCDCODE[11]={0xFA,0x0A,0xBC,0x9E,0x4E,0xD6,0xF6,0x8A,0xFE,0xDE,0x00};  // LCDCODE[10] = 0x00  不显示任何东西#define  BIAS     0x52             //0b1000 0101 0010  1/3duty 4com
#define  SYSDIS   0X00             //0b1000 0000 0000  关振系统荡器和LCD偏压发生器
#define  SYSEN    0X02             //0b1000 0000 0010 打开系统振荡器
#define  LCDOFF   0X04             //0b1000 0000 0100  关LCD偏压
#define  LCDON    0X06             //0b1000 0000 0110  打开LCD偏压
#define  XTAL     0x28             //0b1000 0010 1000 外部接时钟
#define  RC256    0X30             //0b1000 0011 0000  内部时钟
#define  TONEON   0X12             //0b1000 0001 0010  打开声音输出
#define  TONEOFF  0X10             //0b1000 0001 0000 关闭声音输出
#define  WDTDIS1  0X0A             //0b1000 0000 1010  禁止看门狗
#define  BUFFERSIZE 12// #define HT1621_DEBUGclass  HT1621
{
public:HT1621();void begin(int cs_p, int wr_p, int data_p, int backlight_p);void begin(int cs_p, int wr_p, int data_p);void clear();void backlight();void noBacklight();void setBatteryLevel(int level,unsigned char *s);void print(long num, const char* flags="%6li", int precision = 0);void print(double num, int precision = 3);void printCelsius(double num); // precision is always 1void print(const char* str, bool leftPadded = false);void display();void noDisplay();
private:int _cs_p;int _wr_p;int _data_p;int _backlight_p;bool _backlight_en;char _buffer[BUFFERSIZE];unsigned char _battery[3];void wrone(unsigned char addr, unsigned char sdata);void wrclrdata(unsigned char addr, unsigned char sdata);void wrCLR(unsigned char len);void wrDATA(unsigned char data, unsigned char cnt);void wrCMD(unsigned char CMD);void setdecimalseparator(int dpposition);void config(); // legacy: why not in begin funcvoid update();char charToSegBits(char character);
};
#endif

HT1621.cpp

/*******************************************************************************
Copyright 2016-2018 anxzhu (github.com/anxzhu)
Copyright 2018-2020 Valerio Nappi (github.com/5N44P) (changes)
Based on segment-lcd-with-ht1621 from anxzhu (2016-2018)
(https://github.com/anxzhu/segment-lcd-with-ht1621)Partially rewritten and extended by Valerio Nappi (github.com/5N44P) in 2018This file is part of the HT1621 arduino library, and thus under the MIT license.
More info on the project and the license conditions on :
https://github.com/5N44P/ht1621-7-segPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*******************************************************************************/#include <Arduino.h>
#include "HT1621.h"HT1621::HT1621(){_buffer[0] = 0x00;_buffer[1] = 0x00;_buffer[2] = 0x00;_buffer[3] = 0x00;_buffer[4] = 0x00;_buffer[5] = 0x00;_buffer[6] = 0x00;
}void HT1621::begin(int cs_p, int wr_p, int data_p, int backlight_p)
{pinMode(cs_p, OUTPUT);pinMode(wr_p, OUTPUT);pinMode(data_p, OUTPUT);pinMode(backlight_p, OUTPUT);_cs_p=cs_p;_wr_p=wr_p;_data_p=data_p;_backlight_p=backlight_p;_backlight_en=true;config();
}void HT1621::begin(int cs_p, int wr_p, int data_p)
{pinMode(cs_p, OUTPUT);pinMode(wr_p, OUTPUT);pinMode(data_p, OUTPUT);_cs_p=cs_p;_wr_p=wr_p;_data_p=data_p;_backlight_en = false;config();
}void HT1621::wrDATA(unsigned char data, unsigned char cnt) {unsigned char i;for (i = 0; i < cnt; i++) {digitalWrite(_wr_p, LOW);delayMicroseconds(4);if (data & 0x80) {digitalWrite(_data_p, HIGH);}else {digitalWrite(_data_p, LOW);}digitalWrite(_wr_p, HIGH);delayMicroseconds(4);data <<= 1;}
}
void HT1621::wrclrdata(unsigned char addr, unsigned char sdata)
{addr+=9;addr <<= 2;digitalWrite(_cs_p, LOW);wrDATA(0xa0, 3);wrDATA(addr, 6);wrDATA(sdata, 8);digitalWrite(_cs_p, HIGH);
}void HT1621::display()
{wrCMD(LCDON);
}void HT1621::noDisplay()
{wrCMD(LCDOFF);
}// 写数据到RAM命令格式为:101+6位RAM地址+4位数据,其中RAM地址为SEG序号 (参考:https://blog.csdn.net/qq_36347513/article/details/107330387)
// 
void HT1621::wrone(unsigned char addr, unsigned char sdata)// 101 数据模式  读写之间变换
{addr+=9;// HT1621 SSOP-24 芯片的SEG脚从SEG9开始的 ,所以addr+9;addr <<= 2;digitalWrite(_cs_p, LOW);wrDATA(0xa0, 3);// 101 wrDATA(addr, 6);wrDATA(sdata, 8);   // 0XF7  "8"  digitalWrite(_cs_p, HIGH);
}// void HT1621::update(){ the buffer is backwards with respect to the lcd. could be improved// wrone(0, _buffer[5]);// wrone(2, _buffer[4]);// wrone(4, _buffer[3]);// wrone(6, _buffer[2]);// wrone(8, _buffer[1]);// wrone(10,_buffer[0]);
// }
void HT1621::backlight()
{if (_backlight_en)digitalWrite(_backlight_p, HIGH);delay(1);
}void HT1621::noBacklight()
{if(_backlight_en)digitalWrite(_backlight_p, LOW);delay(1);
}void HT1621::wrCMD(unsigned char CMD) {  //100 命令模式digitalWrite(_cs_p, LOW);wrDATA(0x80, 4);wrDATA(CMD, 8);digitalWrite(_cs_p, HIGH);
}void HT1621::config()
{wrCMD(BIAS);wrCMD(RC256);wrCMD(SYSDIS);wrCMD(WDTDIS1);wrCMD(SYSEN);wrCMD(LCDON);
}// #define  BIAS     0x52             //0b1000 0101 0010  1/3duty 4com  
/*
1000 010abXcX 
c=0:1/2 偏置
c=1:1/3 偏置
ab=00:2 COMS
ab=01:3 COMS
ab=10:4 COMS
*/
// #define  SYSDIS   0X00             //0b1000 0000 0000  关振系统荡器和LCD偏压发生器
// #define  SYSEN    0X02             //0b1000 0000 0010 打开系统振荡器
// #define  LCDOFF   0X04             //0b1000 0000 0100  关LCD偏压
// #define  LCDON    0X06             //0b1000 0000 0110  打开LCD偏压
// #define  XTAL     0x28             //0b1000 0010 1000 外部接时钟
// #define  RC256    0X30             //0b1000 0011 0000  内部时钟
// #define  TONEON   0X12             //0b1000 0001 0010  打开声音输出
// #define  TONEOFF  0X10             //0b1000 0001 0000 关闭声音输出
// #define  WDTDIS1  0X0A             //0b1000 0000 1010  禁止看门狗void HT1621::wrCLR(unsigned char len) {unsigned char addr = 0;unsigned char i;for (i = 0; i < len; i++) {wrclrdata(addr, 0x00);addr = addr + 2;}
}void HT1621::setBatteryLevel(int level,unsigned char *s) {// zero out the previous (otherwise the or couldn't be possible)// _buffer[0] &= 0x7F;// _buffer[1] &= 0x7F;// _buffer[2] &= 0x7F;unsigned char i;for(i=0;i<6;i++){_buffer[i] &= 0x00;}switch(level){case 3: // battery on and all 3 segments// _buffer[0] |= 0x80;// _buffer[0] |= 0xFE;_buffer[0] |= LCDCODE[s[0]];_buffer[1] |= LCDCODE[s[1]];_buffer[2] |= LCDCODE[s[2]];_buffer[3] |= LCDCODE[s[3]];_buffer[4] |= LCDCODE[s[4]];// _buffer[5] |= 0xFE;// _buffer[6] |= 0xEF;case 2: // battery on and 2 segments// _buffer[1] |= 0x80;case 1: // battery on and 1 segment// _buffer[2] |= 0x80;case 0: // battery indication offdefault:break;}update();
}void HT1621::clear(){wrCLR(16);// wrCLR(31);
}// takes the buffer and puts it straight into the driver
void HT1621::update(){// the buffer is backwards with respect to the lcd. could be improved// wrone(0, _buffer[5]);wrone(0, _buffer[0]);wrone(2, _buffer[1]);wrone(4, _buffer[2]);wrone(6, _buffer[3]);wrone(8, _buffer[4]);// wrone(10, _buffer[5]);// wrone(12, _buffer[6]);// wrone(0, _buffer[5]);// wrone(2, _buffer[4]);// wrone(4, _buffer[3]);// wrone(6, _buffer[2]);// wrone(8, _buffer[1]);// wrone(10,_buffer[0]);
}void HT1621::print(long num, const char* flags, int precision){if(num > 999999) // basic checksnum = 999999; // clip into 999999if(num < -99999) // basic checksnum = -99999; // clip into -99999char localbuffer[7]; //buffer to work within the functionsnprintf(localbuffer, 7, flags, num); // convert the decimal into string#ifdef _HTDEBUGSerial.begin(9600);Serial.print(localbuffer);Serial.print("\t");#endif// horrible handling but should get us working. needs refactor in next majorif (precision > 0 && (num) < pow(10, precision)) {// we remove extra leading zerosfor (int i = 0; i < (5 - precision); i++) {#ifdef _HTDEBUGSerial.print(localbuffer[1]);#endif // _HTDEBUGif(localbuffer[i+1] == '0' && localbuffer[i] != '-'){ // we remove only if there is another zero ahead AND if it's not a minus signlocalbuffer[i] = ' ';}else{break;} #ifdef _HTDEBUGSerial.println();buffer[1]);#endif // _HTDEBUG}}for(int i=0; i<6; i++){_buffer[i] &= 0x80; // mask the first bit, used by batter and decimal point_buffer[i] |= charToSegBits(localbuffer[i]);}update();
}void HT1621::print(double num, int precision){if(num > 999999) // basic checksnum = 999999; // clip into 999999if(num < -99999) // basic checksnum = -99999; // clip into -99999if(precision > 3 && num > 0)precision = 3; // if positive max precision allowed = 3else if(precision > 2 && num < 0)precision = 2;// if negative max precision allowed = 2if(precision < 0)precision = 0; // negative precision?!const char* flags = (precision > 0 && abs(num) < 1) ? "%06li" : "%6li";long integerpart;integerpart = ((long)(num*pow(10,precision)));print(integerpart, flags, precision); // draw the integerized numbersetdecimalseparator(precision); // draw the decimal pointupdate();
}void HT1621::printCelsius(double num){if(num > 9999) // basic checksnum = 9999; // clip into 999999if(num < -999) // basic checksnum = -999; // clip into -99999int precision;if(num <= -100 || num >= 999)precision = 0;	// if negative max precision allowed = 0else precision = 1;	// if positive max precision allowed = 1const char* flags = (precision > 0 && abs(num) < 1) ? "%04li*C" : "%4li*C";long integerpart;integerpart = ((long)(num*pow(10,precision)));print(integerpart, flags, precision); // draw the integerized numberif(precision > 0)setdecimalseparator(precision+2); // draw the decimal point shifted by 2else 	setdecimalseparator(0); // or clear the decimal separatorupdate();
}void HT1621::print(const char* str, bool leftPadded){int chars = strlen(str);int padding = 6 - chars;for(int i = 0; i < 6; i++){_buffer[i] &= 0x80; // mask the first bit, used by batter and decimal pointchar character = leftPadded? i < padding ? ' ' : str[i - padding]: i >= chars ? ' ' : str[i];_buffer[i] |= charToSegBits(character);}setdecimalseparator(0); // Hide decimal pointupdate();
}void HT1621::setdecimalseparator(int decimaldigits) {// zero out the eight bit_buffer[3] &= 0x7F;_buffer[4] &= 0x7F;_buffer[5] &= 0x7F;if( decimaldigits <= 0 || decimaldigits > 3){return;}// 3 is the digit offset// the first three eights bits in the buffer are for the battery signs// the last three are for the decimal point_buffer[6-decimaldigits] |= 0x80;
}char HT1621::charToSegBits(char character) {switch (character) {case '*': // For degree for nowreturn 0b0110011;case '|':return 0b0000101;case '-':return 0b0000010;case '_':return 0b0001000;case '0':return 0b1111101;case '1':return 0b1100000;case '2':return 0b111110;case '3':return 0b1111010;case '4':return 0b1100011;case '5':return 0b1011011;case '6':return 0b1011111;case '7':return 0b1110000;case '8':return 0b1111111;case '9':return 0b1111011;case 'A':case 'a':return 0b1110111;case 'b':case 'B':return 0b1001111;case 'c'://	return 0b0001110;case 'C':return 0b0011101;case 'd':case 'D':return 0b1101110;case 'e'://	return 0b0001110;case 'E':return 0b0011111;case 'f'://	return 0b0000111;case 'F':return 0b0010111;case 'G':case 'g':return 0b1011101;case 'h'://	return 0b1000111;case 'H':return 0b1100111;case 'i'://	return 0b1000000;case 'I':return 0b1100000;case 'J':case 'j':return 0b1101000;case 'l'://	return 0b1100000;case 'L':return 0b0001101;case 'm':case 'M':return 0b1010100;case 'n':case 'N':return 0b1000110;case 'O': // we can keep this for zero//	return 0b1111101;case 'o':return 0b1001110;case 'P':case 'p':return 0b0110111;case 'q':case 'Q':return 0b1110011;case 'r':case 'R':return 0b0000110;case 'S':case 's':return 0b1011011;case 't':case 'T':return 0b0001111;case 'u'://	return 0b1001100;case 'U':return 0b1101101;case 'Y':case 'y':return 0b1101011;case 'z':case 'Z':return 0b0111110;case ' ':default:return 0b0000000;}
}

Battery_levels.ino

/*Battery LevelsDisplays the various battery levels with 500mspause between.The circuit:cs to pin 13wr to pin 12Data to pin 8backlight to pin 10Created 9 dec 2018By valerio\new (5N44P)https://github.com/valerionew/ht1621-7-seg*/#include <HT1621.h> // include our libraryHT1621 lcd; // create an "lcd" objectunsigned char LCD_tmp[5];void setup(){// start the lcd:// cs to pin 13// wr to pin 12// Data to pin 8// backlight to pin 10// you can chose whichever pin you wantlcd.begin(13, 12, 8, 10); // (cs, wr, Data, backlight)// if no backlight control is given, you can also use:// lcd.begin(13, 12, 8); // (cs, wr, Data)lcd.backlight(); // turn on the backlight ledlcd.clear(); // clear the screen
}void loop(){static unsigned int num = 0;num++;LCD_tmp[0] = num/10000%10; // 万位:第1位显示的内容(左->右)LCD_tmp[1] = num/1000%10;       // 千位LCD_tmp[2] = num/100%10;       // 百位LCD_tmp[3] = num/10%10; // 十位LCD_tmp[4] = num%10; // 个位if(num >= 100000){num = 0;}//设置四前面千/百/十位不要显示0if(LCD_tmp[0] <= 0 && num < 10000){LCD_tmp[0]=10;} if(LCD_tmp[1] <= 0 && num < 1000){LCD_tmp[1]=10;} // CODE[10] 是 0X00 不显示if(LCD_tmp[2] <= 0 && num < 100){LCD_tmp[2]=10;}if(LCD_tmp[3] <= 0 && num < 10){LCD_tmp[3]=10;}lcd.setBatteryLevel(3,LCD_tmp);delay(100);  lcd.setBatteryLevel(2);
//  delay(500);
//  lcd.setBatteryLevel(3);
//  delay(500);
}

成果展示

“Arduino UNO TH1621 LCD成果展示”



资料下载

  • 【CSDN】汇总:TH1621 LCD开发资料(20240406)

参考资料

  • [1] 【Github】ht1621-7-seg (forked from anxzhu/segment-lcd-with-ht1621)
  • [2] 【CSDN@weiDev101】LCD Glass段码屏的驱动
  • [3] 【CSDN】STM32F103学习笔记(4)——LCD段码屏HT1621使用

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

vue 原理【详解】MVVM、响应式、模板编译、虚拟节点 vDom、diff 算法

vue 的设计模式 —— MVVM M —— Model 模型&#xff0c;即数据V —— View 视图&#xff0c;即DOM渲染VM —— ViewModel 视图模型&#xff0c;用于实现Model和View的通信&#xff0c;即数据改变驱动视图渲染&#xff0c;监听视图事件修改数据 初次渲染 将模板编译为 render …

【Mybatis-Plus】Mybatis-Plus增删改查示例

示例一&#xff1a;delete 这个删除&#xff0c;是我们直接可以把这条记录给放进去&#xff0c;那么这条记录里面如果说有的属性为空的话&#xff0c;它是不会去管的&#xff0c;但是有些属性它不为空的话&#xff0c;那么它就会根据属性。作为一个equal的条件去做一个删除的一…

msvcr120.dll丢失的解决办法,msvcr120.dll文件丢失的相关介绍

今天小编在使用电脑的时候&#xff0c;突然弹出了一个关于msvcr120.dll文件丢失的问题&#xff01;当出现这种情况时&#xff0c;相信大家都会感到困惑吧&#xff1f;不过&#xff0c;别担心&#xff01;下面就来和大家分享一下解决msvcr120.dll文件丢失问题的几种方法&#xf…

城市内涝与海绵城市规划设计中的水文水动力模拟

原文链接&#xff1a;城市内涝与海绵城市规划设计中的水文水动力模拟https://mp.weixin.qq.com/s?__bizMzUzNTczMDMxMg&mid2247601198&idx5&sn35b9e5e3961ea2f190f9742236a7217f&chksmfa820dc9cdf584df97633f64d19bdc3e5f7d1a5a85000c8f040e1953c51b9b39c87b5…

Docker 集成 redis,并在nacos进行配置时需要注意点

安装redis镜像 docker pull redis:6.0.6redis配置文件 创建相关配置文件 mkdir /apps/redis cd /apps/redis touch redis.conf vim redis.confredis.conf内容&#xff1a; #开启保护 protected-mode yes #开启远程连接 bind 0.0.0.0 #自定义密码 port 6379 timeout 0 # 900s内…

Go语言中channel和互斥锁的应用场景

面对一个并发问题,我们的解决方案是使用channel还是互斥锁来实现并不总是很清晰。因为Go提倡使用通信来共享内存,所以一个常见的错误就是总是强制使用channel,不管实际情况如何。但是我们应该把这两种选择作为互补手段。 首先,简单回顾一下Go语言中的channel:channel是一种交…

DL00295-基于AirSim仿真环境的无人机深度强化学习算法路径规划完整实现含详细说明文档

-创建了一个开放的AI Gym环境&#xff0c;包括多旋翼和固定翼无人机的运动学模型。 -提供了一些UE4环境来训练和测试深度强化学习DRL导航策略。 -基于AirSim和SB3。 完整代码链接见文末。 DL00295-基于AirSim仿真环境的无人机深度强化学习算法路径规划完整实现含详细说明文档

Linux-docker安装数据库redis

1.拉取redis镜像 docker pull redis # 下载最新的redis版本 docker pull redis:版本号 # 下载指定的redis版本ps&#xff1a;我这是已经下载最新版本的redis 2.查看redis镜像 docker images3.创建挂在路径并授权 mkdir -p /usr/local/redis/data mkdir -p /usr/local…

AI大模型基石:文字与数字的起源与演变

AI大模型基石&#xff1a;文字与数字的起源与演变 1、文字 1.1、起源 我们的祖先在还没有发明文字和语言之前就已经开始使用“咿咿呀呀”的声音来传播信息了&#xff0c;比如在野外活动遇到危险&#xff0c;然后发出“咿咿呀呀”的声音来提醒同伴小心&#xff0c;同伴在接收到…

向大众日报投稿需要准备哪些材料?

向大众日报投稿通常需要准备以下材料&#xff1a; 稿件正文&#xff1a;这是投稿的核心部分&#xff0c;确保内容符合大众日报的主题和风格。作者信息&#xff1a;包括姓名、联系方式&#xff08;如电话、邮箱等&#xff09;。个人简介&#xff1a;简要介绍自己的背景和相关经…

数据结构--链式栈

一.链式栈的栈顶在哪里? 二.链栈的结构: typedef struct LSNode{ int data; struct LSNode* next; }LSNode ,*PLStack; //链栈的节点.由于栈顶在第一个数据节点,所以不需要top指针 三.链式栈的实现: //初始化LSNode* p (LSNode*)malloc(sizeof(LSNode));assert(p ! NULL)…

03-JAVA设计模式-享元模式

享元模式 什么是享元模式 享元模式&#xff08;Flyweight Pattern&#xff09;是一种对象结构型设计模式&#xff0c;用于减少创建对象的数量&#xff0c;以减少内存占用和提高系统性能。它通过共享已经存在的对象来避免创建大量相似的对象&#xff0c;从而降低内存消耗。 在…

蓝桥杯真题Day48 倒计时5天 练了几道真题小程序+回溯剪枝应用一个小程序

[蓝桥杯 2023 省 A] 更小的数 题目描述 小蓝有一个长度均为 n 且仅由数字字符 0∼9 组成的字符串&#xff0c;下标从0到 n−1&#xff0c;你可以将其视作是一个具有n位的十进制数字num&#xff0c;小蓝可以从num 中选出一段连续的子串并将子串进行反转&#xff0c;最多反转一次…

如何在 JavaScript 中创建自定义事件?

理解 JavaScript 中的事件 在深入研究自定义事件之前&#xff0c;我们首先了解 JavaScript 中事件的概念。事件是浏览器中发生的操作或事件&#xff0c;由用户交互&#xff08;如单击、鼠标移动或键盘输入&#xff09;或浏览器本身&#xff08;如页面加载、调整大小等&#xf…

算法——栈

. - 力扣&#xff08;LeetCode&#xff09; 给你一个以字符串表示的非负整数 num 和一个整数 k &#xff0c;移除这个数中的 k 位数字&#xff0c;使得剩下的数字最小。请你以字符串形式返回这个最小的数字。 class Solution { public:string removeKdigits(string num, int k…

【Shell语言学堂】数组练习题

数组练习 1、使用数组和循环实现冒泡排序2、将冒泡排序的代码重构为2个函数&#xff0c;2个关系是a函数调用b函数自定义数组参数&#xff1a; 3、声明一个存储的全整数数组&#xff0c;对其中的每一个值进行10处理4、对硬盘使用空间占比的排序5、对当前目录的文件大小进行排序 …

BFS宽度优先搜索例题(蓝桥杯)——逃跑的牛

问题描述&#xff1a; 农夫John的一头牛逃跑了&#xff0c;他想要将逃跑的牛找回来。现假设农夫John和牛的位置都在一条直线上&#xff0c;农夫John的初始位置为N&#xff08;0≤N≤100,000&#xff09;&#xff0c;牛的初始位置为K&#xff08;0≤K≤100,000&#xff09;。农夫…

多层解密,窃取重要信息!AgentTesla商业间谍木马持续活跃

何为AgentTesla&#xff1f; AgentTesla是一款“老牌”恶意软件即服务“MAAS”恶意程序&#xff0c;在过去的几年间&#xff0c;一直保持着较高的活跃度。其主要通过社工钓鱼邮件传播&#xff0c;“商贸信”和伪装航运公司钓鱼邮件是该木马经常使用的社工钓鱼方式。通过社工钓…

前端开发攻略---轻松实现排序功能:利用JavaScript创建直观的拖拽排序体验

拖拽事件主要包括以下几种&#xff1a; dragstart&#xff08;拖拽开始&#xff09;&#xff1a;当用户开始拖拽一个元素时触发&#xff0c;通常在被拖拽的元素上绑定此事件。在该事件的处理函数中&#xff0c;可以设置被拖拽元素的一些属性或数据。 drag&#xff08;拖拽移动…

从零开始写 Docker(十)---实现 mydocker logs 查看容器日志

本文为从零开始写 Docker 系列第十篇&#xff0c;实现类似 docker logs 的功能&#xff0c;使得我们能够查查看容器日志。 完整代码见&#xff1a;https://github.com/lixd/mydocker 欢迎 Star 推荐阅读以下文章对 docker 基本实现有一个大致认识&#xff1a; 核心原理&#x…