📄 leddemo.c
字号:
#include <stdio.h>/* * LED blink function. * this function blink the led */void led_blink(void){ static int led_status = 0; led_status += 1; if(led_status % 2 == 0) *(char *)0x02000000 = 0xff; else *(char *)0x02000000 = 0x00; }/* * LED blink function. * this function blink the led */void seg_blink(void){ static unsigned char seg_value[] = { 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e }; static int seg_status = 0; *((unsigned char *)0x02000004) = seg_value[seg_status]; seg_status += 1; if(seg_status > 15) seg_status = 0;}int main(){ int loopcnt; printf("hello world!!!\n"); *((unsigned char *)0x02000006) = 0x3e; while(1) { led_blink(); seg_blink(); sleep(1); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -