📄 f_8_19a_ledtoggle_a.c
字号:
#include "config.h"#include "delay.h"// this code illustrates a WRONG way to toggle// an LED on or off after a switch press and release.// LED will actually be ON while switch is// held down, and OFF when switch the is released.// Does NOT toggle on press and release.// Also, no switch debouncing delay is included. void main(void){ TRISB = 0xEF; // set RB4 as output RB4 = 0; // turn RB4 off while(1) { if (!RB6) { // switch pressed, turn on LED RB4 = 1; } if (RB6) { // switch pressed, turn off LED RB4 = 0; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -