当前位置: 首页 > news >正文

【雕爷学编程】Arduino动手做(187)---1.3寸OLED液晶屏模块2

37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种的。鉴于本人手头积累了一些传感器和执行器模块,依照实践出真知(一定要动手做)的理念,以学习和交流为目的,这里准备逐一动手试试多做实验,不管成功与否,都会记录下来——小小的进步或是搞不掂的问题,希望能够抛砖引玉。

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百八十七:1.3寸OLED液晶屏 I2C IIC通信 4针模块 1106/1306驱动 128*64像素

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

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)
实验一百八十一:1.3寸OLED液晶屏 I2C IIC通信 4针模块 1106/1306驱动 132*64像素
项目之三:基于Adafruit_SH1106库的标准屏幕测试

实验开源代码

/*【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)实验一百八十一:1.3寸OLED液晶屏 I2C IIC通信 4针模块 1106/1306驱动 132*64像素项目之三:基于Adafruit_SH1106库的标准屏幕测试实验接线:oled模块    Ardunio UnoGND---------GND接地线VCC---------5V 接电源SDA---------D6SCL ------- D4
*///#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH1106.h>#define OLED_RESET 4
Adafruit_SH1106 display(OLED_RESET);#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH  16
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,B00000001, B11000000,B00000001, B11000000,B00000011, B11100000,B11110011, B11100000,B11111110, B11111000,B01111110, B11111111,B00110011, B10011111,B00011111, B11111100,B00001101, B01110000,B00011011, B10100000,B00111111, B11100000,B00111111, B11110000,B01111100, B11110000,B01110000, B01110000,B00000000, B00110000
};#if (SH1106_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SH1106.h!");
#endifvoid setup()   {Serial.begin(9600);// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)display.begin(SH1106_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)// init done// Show image buffer on the display hardware.// Since the buffer is intialized with an Adafruit splashscreen// internally, this will display the splashscreen.display.display();delay(2000);// Clear the buffer.display.clearDisplay();// draw a single pixeldisplay.drawPixel(10, 10, WHITE);// Show the display buffer on the hardware.// NOTE: You _must_ call display after making any drawing commands// to make them visible on the display hardware!display.display();delay(2000);display.clearDisplay();// draw many linestestdrawline();display.display();delay(2000);display.clearDisplay();// draw rectanglestestdrawrect();display.display();delay(2000);display.clearDisplay();// draw multiple rectanglestestfillrect();display.display();delay(2000);display.clearDisplay();// draw mulitple circlestestdrawcircle();display.display();delay(2000);display.clearDisplay();// draw a white circle, 10 pixel radiusdisplay.fillCircle(display.width() / 2, display.height() / 2, 10, WHITE);display.display();delay(2000);display.clearDisplay();testdrawroundrect();delay(2000);display.clearDisplay();testfillroundrect();delay(2000);display.clearDisplay();testdrawtriangle();delay(2000);display.clearDisplay();testfilltriangle();delay(2000);display.clearDisplay();// draw the first ~12 characters in the fonttestdrawchar();display.display();delay(2000);display.clearDisplay();// draw scrolling text/* testscrolltext();delay(2000);display.clearDisplay();*/// text display testsdisplay.setTextSize(1);display.setTextColor(WHITE);display.setCursor(0, 0);display.println("Hello, world!");display.setTextColor(BLACK, WHITE); // 'inverted' textdisplay.println(3.141592);display.setTextSize(2);display.setTextColor(WHITE);display.print("0x"); display.println(0xDEADBEEF, HEX);display.display();delay(2000);// miniature bitmap displaydisplay.clearDisplay();display.drawBitmap(30, 16,  logo16_glcd_bmp, 16, 16, 1);display.display();// invert the displaydisplay.invertDisplay(true);delay(1000);display.invertDisplay(false);delay(1000);// draw a bitmap icon and 'animate' movementtestdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH);
}void loop() {
}void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {uint8_t icons[NUMFLAKES][3];// initializefor (uint8_t f = 0; f < NUMFLAKES; f++) {icons[f][XPOS] = random(display.width());icons[f][YPOS] = 0;icons[f][DELTAY] = random(5) + 1;Serial.print("x: ");Serial.print(icons[f][XPOS], DEC);Serial.print(" y: ");Serial.print(icons[f][YPOS], DEC);Serial.print(" dy: ");Serial.println(icons[f][DELTAY], DEC);}while (1) {// draw each iconfor (uint8_t f = 0; f < NUMFLAKES; f++) {display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, WHITE);}display.display();delay(200);// then erase it + move itfor (uint8_t f = 0; f < NUMFLAKES; f++) {display.drawBitmap(icons[f][XPOS], icons[f][YPOS],  logo16_glcd_bmp, w, h, BLACK);// move iticons[f][YPOS] += icons[f][DELTAY];// if its gone, reinitif (icons[f][YPOS] > display.height()) {icons[f][XPOS] = random(display.width());icons[f][YPOS] = 0;icons[f][DELTAY] = random(5) + 1;}}}
}void testdrawchar(void) {display.setTextSize(1);display.setTextColor(WHITE);display.setCursor(0, 0);for (uint8_t i = 0; i < 168; i++) {if (i == '\n') continue;display.write(i);if ((i > 0) && (i % 21 == 0))display.println();}display.display();
}void testdrawcircle(void) {for (int16_t i = 0; i < display.height(); i += 2) {display.drawCircle(display.width() / 2, display.height() / 2, i, WHITE);display.display();}
}void testfillrect(void) {uint8_t color = 1;for (int16_t i = 0; i < display.height() / 2; i += 3) {// alternate colorsdisplay.fillRect(i, i, display.width() - i * 2, display.height() - i * 2, color % 2);display.display();color++;}
}void testdrawtriangle(void) {for (int16_t i = 0; i < min(display.width(), display.height()) / 2; i += 5) {display.drawTriangle(display.width() / 2, display.height() / 2 - i,display.width() / 2 - i, display.height() / 2 + i,display.width() / 2 + i, display.height() / 2 + i, WHITE);display.display();}
}void testfilltriangle(void) {uint8_t color = WHITE;for (int16_t i = min(display.width(), display.height()) / 2; i > 0; i -= 5) {display.fillTriangle(display.width() / 2, display.height() / 2 - i,display.width() / 2 - i, display.height() / 2 + i,display.width() / 2 + i, display.height() / 2 + i, WHITE);if (color == WHITE) color = BLACK;else color = WHITE;display.display();}
}void testdrawroundrect(void) {for (int16_t i = 0; i < display.height() / 2 - 2; i += 2) {display.drawRoundRect(i, i, display.width() - 2 * i, display.height() - 2 * i, display.height() / 4, WHITE);display.display();}
}void testfillroundrect(void) {uint8_t color = WHITE;for (int16_t i = 0; i < display.height() / 2 - 2; i += 2) {display.fillRoundRect(i, i, display.width() - 2 * i, display.height() - 2 * i, display.height() / 4, color);if (color == WHITE) color = BLACK;else color = WHITE;display.display();}
}void testdrawrect(void) {for (int16_t i = 0; i < display.height() / 2; i += 2) {display.drawRect(i, i, display.width() - 2 * i, display.height() - 2 * i, WHITE);display.display();}
}void testdrawline() {for (int16_t i = 0; i < display.width(); i += 4) {display.drawLine(0, 0, i, display.height() - 1, WHITE);display.display();}for (int16_t i = 0; i < display.height(); i += 4) {display.drawLine(0, 0, display.width() - 1, i, WHITE);display.display();}delay(250);display.clearDisplay();for (int16_t i = 0; i < display.width(); i += 4) {display.drawLine(0, display.height() - 1, i, 0, WHITE);display.display();}for (int16_t i = display.height() - 1; i >= 0; i -= 4) {display.drawLine(0, display.height() - 1, display.width() - 1, i, WHITE);display.display();}delay(250);display.clearDisplay();for (int16_t i = display.width() - 1; i >= 0; i -= 4) {display.drawLine(display.width() - 1, display.height() - 1, i, 0, WHITE);display.display();}for (int16_t i = display.height() - 1; i >= 0; i -= 4) {display.drawLine(display.width() - 1, display.height() - 1, 0, i, WHITE);display.display();}delay(250);display.clearDisplay();for (int16_t i = 0; i < display.height(); i += 4) {display.drawLine(display.width() - 1, 0, 0, i, WHITE);display.display();}for (int16_t i = 0; i < display.width(); i += 4) {display.drawLine(display.width() - 1, 0, i, display.height() - 1, WHITE);display.display();}delay(250);
}/*void testscrolltext(void) {display.setTextSize(2);display.setTextColor(WHITE);display.setCursor(10,0);display.clearDisplay();display.println("scroll");display.display();display.startscrollright(0x00, 0x0F);delay(2000);display.stopscroll();delay(1000);display.startscrollleft(0x00, 0x0F);delay(2000);display.stopscroll();delay(1000);display.startscrolldiagright(0x00, 0x07);delay(2000);display.startscrolldiagleft(0x00, 0x07);delay(2000);display.stopscroll();}*/

实验场景图

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

【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)
实验一百八十一:1.3寸OLED液晶屏 I2C IIC通信 4针模块 1106/1306驱动 132*64像素
项目之三:基于Adafruit_SH1106库的标准屏幕测试显示

实验视频剪辑

https://v.youku.com/v_show/id_XNTgwOTMyMTk3Ng==.html?firsttime=0

在这里插入图片描述
【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)
实验一百八十一:1.3寸OLED液晶屏 I2C IIC通信 4针模块 1106/1306驱动 132*64像素
项目之四:初始化ss_oled库

实验开源代码

/*【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)实验一百八十一:1.3寸OLED液晶屏 I2C IIC通信 4针模块 1106/1306驱动 132*64像素项目之四:初始化ss_oled库实验接线:oled模块    Ardunio UnoGND---------GND接地线VCC---------5V 接电源SDA---------D6SCL ------- D4
*/#include <ss_oled.h>// Use -1 for the Wire library default pins
// or specify the pin numbers to use with the Wire library or bit banging on any GPIO pins
// These are reversed because I did straight-through wiring for my SSD1306
// and it has the 4-pin header as GND,VCC,SCL,SDA, but the GROVE connector is
// GND,VCC,SDA,SCL
#define GROVE_SDA_PIN 32
#define GROVE_SCL_PIN 26
// These are the pin numbers for the M5Stack Atom default I2C
#define SDA_PIN 8
#define SCL_PIN 9
// Set this to -1 to disable or the GPIO pin number connected to the reset
// line of your display if it requires an external reset
#define RESET_PIN -1
// let ss_oled figure out the display address
#define OLED_ADDR -1
// don't rotate the display
#define FLIP180 0
// don't invert the display
#define INVERT 0
// Bit-Bang the I2C bus
#define USE_HW_I2C 0// Change these if you're using different OLED displays
#define MY_OLED1 OLED_128x64
#define MY_OLED2 OLED_128x64// 2 copies of the SSOLED structure. Each structure is about 56 bytes
// There is no limit to the number of simultaneous displays which can be controlled by ss_oled 
SSOLED ssoled[2];void setup() {
char *msgs[] = {(char *)"SSD1306 @ 0x3C", (char *)"SSD1306 @ 0x3D",(char *)"SH1106 @ 0x3C",(char *)"SH1106 @ 0x3D"};
int rc;
// The I2C SDA/SCL pins set to -1 means to use the default Wire library
// If pins were specified, they would be bit-banged in software
// This isn't inferior to hw I2C and in fact allows you to go faster on certain CPUs
// The reset pin is optional and I've only seen it needed on larger OLEDs (2.4")
//    that can be configured as either SPI or I2C
//
//oledInit(SSOLED *, type, oled_addr, rotate180, invert, bWire, SDA_PIN, SCL_PIN, RESET_PIN, speed)rc = oledInit(&ssoled[0], MY_OLED1, OLED_ADDR, FLIP180, INVERT, 1, SDA_PIN, SCL_PIN, RESET_PIN, 400000L); // use standard I2C bus at 400Khzif (rc != OLED_NOT_FOUND){oledFill(&ssoled[0], 0, 1);oledWriteString(&ssoled[0], 0,0,0,msgs[rc], FONT_NORMAL, 0, 1);oledWriteString(&ssoled[0], 0,8,3,(char *)"Display", FONT_STRETCHED, 0, 1);oledWriteString(&ssoled[0], 0,56,6,(char *)"0", FONT_STRETCHED, 0, 1);}
rc = oledInit(&ssoled[1], MY_OLED2, OLED_ADDR, FLIP180, INVERT, 0, GROVE_SDA_PIN, GROVE_SCL_PIN, RESET_PIN, 400000L); // use standard I2C bus at 400Khzif (rc != OLED_NOT_FOUND){oledFill(&ssoled[1], 0, 1);oledSetTextWrap(&ssoled[1], 1);oledWriteString(&ssoled[1], 0,0,0,msgs[rc], FONT_SMALL, 0, 1);oledWriteString(&ssoled[1], 0,4,2,(char *)"Display", FONT_NORMAL, 0, 1);oledWriteString(&ssoled[1], 0,28,3,(char *)"1", FONT_NORMAL, 0, 1);}
} /* setup() */void loop() {// put your main code here, to run repeatedly:} /* loop() */

实验场景图

在这里插入图片描述

相关文章:

【雕爷学编程】Arduino动手做(187)---1.3寸OLED液晶屏模块2

37款传感器与模块的提法&#xff0c;在网络上广泛流传&#xff0c;其实Arduino能够兼容的传感器模块肯定是不止37种的。鉴于本人手头积累了一些传感器和执行器模块&#xff0c;依照实践出真知&#xff08;一定要动手做&#xff09;的理念&#xff0c;以学习和交流为目的&#x…...

Windows用户如何安装新版本cpolar内网穿透

Windows用户如何安装新版本cpolar内网穿透 文章目录 Windows用户如何安装新版本cpolar内网穿透 在科学技术高度发达的今天&#xff0c;我们身边充斥着各种电子产品&#xff0c;这些电子产品不仅为我们的工作带来极大的便利&#xff0c;也让生活变得丰富多彩。我们可以使用便携的…...

MacBookPro安装Win10,Wifi不能用了,触控板不能用了(2)

一、问题 去年在MacBookPro上装过Win10&#xff0c;当初只分配了60G空间。各方面原因需要重装系统&#xff0c;上个月装了一晚上&#xff0c;也无法连接Wifi&#xff0c;触控板只能当鼠标左键用。 后来发现是没有相关驱动造成的&#xff0c;于是从Mac系统联网找到网卡驱动&am…...

理解C++中变量的作用域

理解C中变量的作用域 常规变量&#xff08;如前面定义的所有变量&#xff09;的作用域很明确&#xff0c;只能在作用域内使用它们&#xff0c;如果您在作用域外使用它们&#xff0c;编译器将无法识别&#xff0c;导致程序无法通过编译。在作用域外面&#xff0c;变量是未定义的…...

vue+element-ui给全局请求设置一个loading样式

老项目后台管理&#xff0c;要在每个页面请求的时候都添加一个loading&#xff0c;为了统一和防止一个页面多次请求页面出现闪烁的情况同意在request.js中添加了一个全局loading。 想要的效果&#xff1a; 1.在请求的时候创建一个loading样式&#xff0c;请求结束是关闭。 2…...

传球游戏

题目描述 上体育课的时候&#xff0c;小蛮的老师经常带着同学们一起做游戏。这次&#xff0c;老师带着同学们一起做传球游戏。 游戏规则是这样的&#xff1a;n个同学站成一个圆圈&#xff0c;其中的一个同学手里拿着一个球&#xff0c;当老师吹哨子时开始传球&#xff0c;每个…...

智能卡通用安全检测指南 思度文库

范围 本标准规定了智能卡类产品进行安全性检测的一般性过程和方法。 本标准适用于智能卡安全性检测评估和认证。 规范性引用文件 下列文件对于本文件的应用是必不可少的。凡是注日期的引用文件&#xff0c;仅注日期的版本适用于本文件。凡是不注日期的引用文件&#xff0c;…...

Maven设置阿里云路径(防止加载过慢)

<?xml version"1.0" encoding"UTF-8"?><!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding …...

JavaScript原型链污染漏洞复现与防范

目录 什么是原型链污染漏洞&#xff1f; 复现原型链污染漏洞 防范原型链污染漏洞 什么是原型链污染漏洞&#xff1f; 原型链污染是JavaScript中的一种安全漏洞&#xff0c;利用该漏洞可以修改对象的原型&#xff0c;从而影响对象及其属性的行为。攻击者可以通过修改原型链来…...

初识MySQL数据库之用户管理

目录 一、用户管理 二、用户 1. 用户信息 2. 创建用户 3. 用户登录测试 4. 删除用户 5. 设置用户远端登录 6. 修改密码 6.1 修改当前用户的密码 6.2 root用户修改指定用户的密码 三、权限 1. 数据库中的各个权限含义 2. 给用户授权 3. 查看用户拥有权限 4. 授权…...

JVM 类文件结构(class文件)

JVM 本文链接&#xff1a;https://blog.csdn.net/feather_wch/article/details/132116849 类文件结构 1、class文件的组成 无符号数&#xff1a;基本数据类型 u1 u2 u3 u4 描述 数字字符串索引引用 表&#xff1a;复合数据类型&#xff0c;无符号数 表组&#xff0c; _inf…...

PAT乙题1011

答案 #include<iostream> #include<cstdio> using namespace std; typedef long long int ll; int main() {int n,cnt1;cin >> n;while (n--){ll a, b, c; cin >> a >> b >> c;printf("Case #%d: ", cnt);a b > c ? puts(…...

【并发专题】单例模式的线程安全(进阶理解篇)

目录 背景前置知识类加载运行全过程 单例模式的实现方式一、饿汉式基本介绍源码分析 二、懒汉式基本介绍源码分析改进 三、懒汉式单例终极解决方案&#xff08;静态内部类&#xff09;&#xff08;推荐使用方案&#xff09;基本介绍源码分析 感谢 背景 最近学习了JVM之后&…...

无涯教程-Perl - if...elsif...else语句函数

if 语句后可以跟可选的 elsif ... else 语句&#xff0c;这对于使用单个if ... elsif语句测试各种条件非常有用。 if...elsif...else - 语法 Perl编程语言中的 if ... elsif...else语句的语法是- if(boolean_expression 1) {# Executes when the boolean expression 1 is tr…...

uniapp 实现滑动元素并下方有滚动条显示

用uniapp实现下图的样式 代码如下&#xff1a; <template><view class"content"><view class"data-box" ref"dataBox" touchend"handleEnd"><view class"data-list"><view class"data-ite…...

QT充当客户端模拟浏览器等第三方客户端对https进行双向验证

在 ssl单向证书和双向证书校验测试及搭建流程 文章中&#xff0c;已经做了基于https的单向认证和双向认证&#xff0c;&#xff0c;&#xff0c; 在进行双向认证时&#xff0c;采用的是curl工具或浏览器充当客户端去验证。 此次采用QT提供的接口去开发客户端向服务器发送请求&a…...

【JVM】 垃圾回收篇——自问自答(1)

Q什么是垃圾&#xff1a; 运行程序中&#xff0c;没用任何指针指向的对象。 Q为什么需要垃圾回收&#xff1f; 内存只分配&#xff0c;不整理回收&#xff0c;迟早会被消耗完。 内存碎片的整理&#xff0c;为新对象腾出空间 没有GC程序无法正常进行。 Q 哪些区域有GC&#…...

Image Line FL Studio v21.0.3.3517 Producer版全插件版WIN免费下载完整版

FL Studio 21&#xff0c;也称为 Fruity Loops 21&#xff0c;是一款功能强大的数字音频工作站&#xff0c;被世界各地的音乐制作人和 DJ 使用。无论您是新手还是经验丰富的制作人&#xff0c;FL Studio 21都能为您提供创作专业品质音乐所需的工具。在这篇博文中&#xff0c;我…...

PHP8条件控制语句-PHP8知识详解

我们昨天说了流程控制的结构有顺序结构、选择结构和循环结构。选择结构就是条件结构。 条件控制语句就是对语句中不同条件的值进行判断&#xff0c;进而根据不同的条件执行不同的语句。 在本文中&#xff0c;学习的是if语句、if…else语句、if…elseif语句和switch语句。 1、…...

【PHP代码审计】ctfshow web入门 php特性 93-104

ctfshow web入门 php特性 93-104 web 93web 94web 95web 96web 97web 98web 99web 100web 101web 102web 103web 104 web 93 这段PHP代码是一个简单的源码审计例子&#xff0c;让我们逐步分析它&#xff1a; include("flag.php");: 这行代码将flag.php文件包含进来。…...

CSS元素的显示模式

1、现在我想做成小米左侧边栏这样的效果&#xff0c;该怎么做呢&#xff1f; 2、小米商城触碰之后会显示出新的商品案例 3、一碰到之后会出现这个列表 4、这里涉及到了元素显示模式&#xff1a; 5、用人进行划分可以分为男人和女人&#xff0c;根据男人和女人的特性进行相应的…...

Go strings.Title方法被废弃(Deprecated)

strings.Title的使用 在传统中&#xff0c;我们可以通过如下形式将每个单词的首字母变成大写字母&#xff0c;示例如下&#xff1a; func TestTitle(t *testing.T) { fmt.Println(strings.Title("hello world")) fmt.Println(strings.Title("hell golang&qu…...

vuejs源码分析之全局API(vm.$off)

vue在初始化的时候会给vue对象本身挂载一些全局的api。今天我们一个一个来看这些api。 vm.$off方法 这个方法是用来移除自定义事件监听器。 他的用法 vm.$off(event, calback)第一个参数event取值可以是string字符串&#xff0c;也可以是Array<string>也就是说既可以删…...

elasticSearch常见的面试题

常见的面试问题 描述使用场景 es集群架构3个节点&#xff0c;根据不同的服务创建不同的索引&#xff0c;根据日期和环境&#xff0c;平均每天递增60*2&#xff0c;大约60Gb的数据。 调优技巧 原文参考&#xff1a;干货 | BAT等一线大厂 Elasticsearch面试题解读 - 掘金 设计阶…...

第一课-前提-Stable Diffusion 教程

学习 SD 的前提是电脑配置! SD 参考配置: 建议选择台式机 i5 CPU, 内存16GB,N卡 RTX3060, 8G显存以上的配置(最低配) 在此基础上的配置越高越好。 比如,cpu i7 更好,显卡能有 RTX4090 更好,32显存要能有最好,嘿嘿嘿。 如何查看自己的显卡配置? Win+R 输入 “dxdiag…...

Python 开发工具 Pycharm —— 使用技巧Lv.2

pydoc是python自带的一个文档生成工具&#xff0c;使用pydoc可以很方便的查看类和方法结构 本文主要介绍&#xff1a;1.查看文档的方法、2.html文档说明、3.注释方法、 一、查看文档的方法 **方法1&#xff1a;**启动本地服务&#xff0c;在web上查看文档 命令【python3 -m…...

代码随想录第39天 | 62. 不同路径、63.不同路径II

62. 不同路径 动态规划五部曲&#xff1a; dp[i][j] &#xff1a;表示从&#xff08;0 &#xff0c;0&#xff09;出发&#xff0c;到(i, j) 有dp[i][j]条不同的路径。想要求dp[i][j]&#xff0c;只能有两个方向来推导出来&#xff0c;即dp[i - 1][j] 和 dp[i][j - 1]。dp[i]…...

QMT入门—初识QMT

对于普通投资者来说&#xff0c;每天实时盯盘实在是无聊又无趣&#xff0c;特别是临时有事还会错过行情。如果能把自己的投资策略用代码实现&#xff0c;通过程序来自动买卖股票那该有多好&#xff0c;这样就不会错过行情也不会不按交易纪律来操作了。 解决办法有两种&#xf…...

C 语言的 return 语句

有返回值的函数要带 return 语句, return 后面是一个表达式, return 语句将表达式的值返回给主调函数. 一个函数也可以有多个 return 语句, 比如存在于不同的分支中, 但只能有一条 return 语句被执行, 然后程序的控制权就从被调函数传到主调函数. 对于有返回值但没有带 retur…...

企业级Vue路由角色权限应该怎么做?

角色权限 角色权限&#xff0c;简单来说就是登录的用户能看到系统的哪些页面&#xff0c;不能看到系统的哪些页面。一般是后台管理系统才会涉及到如此复杂的角色权限。 对于 vue 技术栈&#xff0c;实现角色权限一般有两种方式。 第一种是利用 beforeEach 全局前置守卫。 第…...