archieve: homework7 test2
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* @name: test2.c
|
||||
* @author: msksbr
|
||||
* @date: 2025-05-24
|
||||
* @description: a test for homework7's homework tests
|
||||
* @version: 1.0
|
||||
* homework zh_CN: 点阵显示心形图形
|
||||
* homework EN: display a heart shape on the led matrix
|
||||
*/
|
||||
|
||||
#include "homework7.h"
|
||||
|
||||
void test2()
|
||||
{
|
||||
unsigned char i; // @var i: a counter for the loop
|
||||
unsigned char code heart[] = {
|
||||
0x00, 0x66, 0xFF, 0xFF,
|
||||
0xFF, 0x7E, 0x3C, 0x18};
|
||||
// @subsection: display a heart shape on the led matrix
|
||||
while (1) // @loop: display the heart shape on the led matrix
|
||||
{
|
||||
for (i = 8; i > 0; i--) // @loop: display the heart shape on the led matrix
|
||||
{
|
||||
switch_138(i); // switch the 74HC138's address to i
|
||||
P2 = ~heart[i]; // display the heart shape on the led matrix
|
||||
delay_ms(1);
|
||||
P2 = 0xFF; // turn off the led matrix
|
||||
}
|
||||
i = 8;
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
test2();
|
||||
}
|
||||
Reference in New Issue
Block a user