【雕爷学编程】Arduino动手做(195)---HT16k33 矩阵 8*8点阵屏模块6

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

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一百九十五:I2C红色8*8LED点阵屏模块 HT16k33(VK16K33)驱动1088BS 物联网可扩展编程

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

知识点:VK16K33芯片
是一款存储器映射和多功能LED控制驱动芯片。该芯片支持更大 128 点的显示模式(16SEGs×8COMs) 以及更大 13×3 的按键矩阵扫描电路。VK16K33 的软件配置特性使其适用于多种 LED 应用,包括 LED 模块和显示子系统。VK16K33 通过双向I2C 接口可与大多数微控制器进行通信。

功能特点1.工作电压:4.5V~5.5V2.内部 RC 振荡器3.I2C 总线接口4.16×8 位 RAM 用于存储显示数据5.更大显示模式为16×8:16SEGs和8COMs6.读 /写地址自动递增7.多达13×3 按键矩阵扫描功能8. 16阶调光电路9.封装类型:20/24/28-pin SOP VK16K33此系列IC具有低功耗、高抗杂讯及高系统ESD防护能力;VK16K33整合了LED驱动和按键扫描的功能,将控制面板所需要的功能融合于一身,可降低主MCU的负担及需要的I/O数目。采用I2C的介面更可减少控制面板和主板之间的材料成本、进而降低产品整体成本。

VK16K33有28SOP、24SOP和20SOP三种包装,分别对应三种更大显示点数;16x8点LED和13x3个按键、12x8点LED和10x3个按键,以及8x8点LED和8x3个按键。内建显示记忆体及RC振荡电路;工作电压:4.5V~5.5V;VK16K33支持中断信号和轮询两种工作模式。可选择性的提供按键中断信号给MCU,MCU可不须一直检查按键状态。VK16K33与系统控制晶片的传输只需2根信号线,通过VK16K33 侦测按键输入,可减少主版MCU I/O数目及精简主版及面板的布局线路;因此可降低产品整体成本。 VK16K33适用于家电、影音设备、仪表设备、车用装置等LED显示器/面板的控制及驱动。

在这里插入图片描述

在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目十五:不同方向的滚动字符串

实验开源代码

/*
  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  项目十五:不同方向的滚动字符串
  实验接线:
  VK16k33    UNO
  VIN        5V
  GND        GND
  SCL        A5
  SDA        A4
*/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"

Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
  Serial.begin(9600);
  Serial.println("8x8 LED Matrix Test");

  matrix.begin(0x70);  // pass in the address
}

static const uint8_t PROGMEM
smile_bmp[] =
{ B00111100,
  B01000010,
  B10100101,
  B10000001,
  B10100101,
  B10011001,
  B01000010,
  B00111100
},
neutral_bmp[] =
{ B00111100,
  B01000010,
  B10100101,
  B10000001,
  B10111101,
  B10000001,
  B01000010,
  B00111100
},
frown_bmp[] =
{ B00111100,
  B01000010,
  B10100101,
  B10000001,
  B10011001,
  B10100101,
  B01000010,
  B00111100
};

void loop() {
  matrix.clear();
  matrix.drawBitmap(1, 0, smile_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(1, 0, neutral_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(200);

  matrix.clear();
  matrix.drawBitmap(1, 0, frown_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(200);

  matrix.clear();      // clear display
  matrix.drawPixel(1, 0, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(200);

  matrix.clear();
  matrix.drawLine(1, 0, 7, 7, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(200);

  matrix.clear();
  matrix.drawRect(1, 0, 8, 8, LED_ON);
  matrix.fillRect(2, 2, 4, 4, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(200);

  matrix.clear();
  matrix.drawCircle(3, 3, 3, LED_ON);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(200);

  matrix.setTextSize(1);
  matrix.setTextWrap(false);  // we dont want text to wrap so it scrolls nicely
  matrix.setTextColor(LED_ON);
  for (int8_t x = 0; x >= -36; x--) {
    matrix.clear();
    matrix.setCursor(x, 0);
    matrix.print("Hello");
    matrix.writeDisplay();
    delay(50);
  }
  matrix.setRotation(3);
  for (int8_t x = 7; x >= -36; x--) {
    matrix.clear();
    matrix.setCursor(x, 0);
    matrix.print("World");
    matrix.writeDisplay();
    delay(50);
  }
  matrix.setRotation(0);
}

Arduino实验场景图

在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目十六:滚动的一串数字

实验开源代码

/*
  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  项目十六:滚动的一串数字
  实验接线:
  VK16k33    UNO
  VIN        5V
  GND        GND
  SCL        A5
  SDA        A4
*/

#include <Wire.h>
#include "Grove_LED_Matrix_Driver_HT16K33.h"

Matrix_8x8 matrix;

void setup() {
  Wire.begin();
  matrix.init();
  matrix.setBrightness(0);
  matrix.setBlinkRate(BLINK_OFF);
}

void loop() {
  // 显示数字“0”并延迟 400ns
  matrix.writeNumber(0, 400);
  matrix.display();

  // 显示数字 "-2147483648" 并延迟 (300*11)ns
  // writeNumber()的显示范围是int32_t(从-2147483648到2147483647)
  matrix.writeNumber(-2147483648, 300);
  matrix.display();
}

Arduino实验场景图

在这里插入图片描述

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
项目十七:变换的笑脸与流淌的字符"Hello",“World”

实验开源代码

/*
  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  实验二百零七:I2C红色8*8LED点阵模块VK16k33驱动1088BS树莓派物联网可扩展编程
  项目十七:变换的笑脸与流淌的字符"Hello","World"
  实验接线:
  VK16k33    UNO
  VIN        5V
  GND        GND
  SCL        A5
  SDA        A4
*/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"

Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();

void setup() {
  Serial.begin(9600);
  Serial.println("8x8 LED Matrix Test");
  matrix.begin(0x70);  // pass in the address
}

static const uint8_t PROGMEM
smile_bmp[] =
{ B00111100,
  B01000010,
  B10100101,
  B10000001,
  B10100101,
  B10011001,
  B01000010,
  B00111100
},
neutral_bmp[] =
{ B00111100,
  B01000010,
  B10100101,
  B10000001,
  B10111101,
  B10000001,
  B01000010,
  B00111100
},
frown_bmp[] =
{ B00111100,
  B01000010,
  B10100101,
  B10000001,
  B10011001,
  B10100101,
  B01000010,
  B00111100
};

void loop() {

  matrix.clear();
  matrix.drawBitmap(0, 0, smile_bmp, 8, 8, LED_GREEN);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, neutral_bmp, 8, 8, LED_GREEN);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();
  matrix.drawBitmap(0, 0, frown_bmp, 8, 8, LED_GREEN);
  matrix.writeDisplay();
  delay(500);

  matrix.clear();      // clear display
  matrix.drawPixel(0, 0, LED_GREEN);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.clear();
  matrix.drawLine(0, 0, 7, 7, LED_GREEN);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.clear();
  matrix.drawRect(0, 0, 8, 8, LED_GREEN);
  matrix.fillRect(2, 2, 4, 4, LED_GREEN);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.clear();
  matrix.drawCircle(3, 3, 3, LED_GREEN);
  matrix.writeDisplay();  // write the changes we just made to the display
  delay(500);

  matrix.setTextWrap(false);  // we dont want text to wrap so it scrolls nicely
  matrix.setTextSize(1);
  matrix.setTextColor(LED_GREEN);
  for (int8_t x = 7; x >= -36; x--) {
    matrix.clear();
    matrix.setCursor(x, 0);
    matrix.print("Hello");
    matrix.writeDisplay();
    delay(50);
  }
  matrix.setRotation(3);
  matrix.setTextColor(LED_GREEN);
  for (int8_t x = 7; x >= -36; x--) {
    matrix.clear();
    matrix.setCursor(x, 0);
    matrix.print("World");
    matrix.writeDisplay();
    delay(50);
  }
  matrix.setRotation(0);
}

Arduino实验场景图

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

驴友花雕

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值