⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 led buttons yanshishuoming
💻 C
字号:
// This program is designed for STR-P711 Board.
// It shows how to work with button and leds

#include "system.h"
#include "leds.h"
#include <iostr711.h>

#define BUT_PRESSED    IOPORT1_PD_bit.no14

//it's a simple delay
void Delay (unsigned long a) { while (--a!=0); }

// variable for pressed button
char push_but    = 1;

int main()
{

  // Init frecuency
  FreqInit();

  // System init
  SysInit();

  // Init leds
  InitLeds();
  Led1_On();
  Led2_Off();


  // loop forever
  while(1) {


    // button BUT is pressed
    if((BUT_PRESSED == 1)&&(push_but == 1)) {
      Led1_Off();
      Led2_On();
      push_but = 0;
    }
    if((BUT_PRESSED == 0)&&(push_but == 0)) {
      Led1_On();
      Led2_Off();
      push_but = 1;
    }


  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -