当前位置: 首页 > news >正文

实时定量引物设计网站怎么做如何在百度免费发布广告

实时定量引物设计网站怎么做,如何在百度免费发布广告,做网站建设的销售怎么样,湘潭网站建设多少钱原理部分 1.LED部分使用的是这样的连接方式 2.传感器模块的电路图 滤波电容如果接地,一般用于滤波,在分析电路时就不用考虑。下面这个电路就是看A端和B端哪端的拉力大,就能把电压值对应到相应的电压值 比较器部分 如果A端电压>B端电压&am…

原理部分

1.LED部分使用的是这样的连接方式

2.传感器模块的电路图

滤波电容如果接地,一般用于滤波,在分析电路时就不用考虑。下面这个电路就是看A端和B端哪端的拉力大,就能把电压值对应到相应的电压值

比较器部分

如果A端电压>B端电压,接VCC,反之接地

传感器需要上拉或下拉驱动,一般用下拉驱动

3.按键需要消除抖动

4.连接示意图


代码编写

1.思路

首先实现LED亮灭,随后实现按键1控制LED亮灭,最后实现2个按键各自控制两个ledd的亮灭

2.按照江科大老师给的电路连接接图进行连接

注意: 

    由于连接图中两个LED,一个连接的GPIO口为A1,一个连接的GPIO口为A2,所以需要分别定义

    GPIO口默认为低电平

3.复制之前已经构建好的模板库

4.新建hardware文件夹并将路径联系到工程中,在hardware中新建led.c,led.h;key.c,‘key.h文件

5.led.h代码如下所示:

#ifndef _LED__H
#define _LED__H

void led_Init(void);
void led1_on(void);
void led1_off(void);
void led2_on(void);
void led2_off(void);
void turn_1(void);
void turn_2(void);

#endif

6.led.c代码如下所示:

#include "stm32f10x.h" 
void led_Init(void)
{
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);    //开启GPIOB的时钟
                                                            //使用各个外设前必须开启时钟,否则对外设的操作无效
    
    /*GPIO初始化*/
    GPIO_InitTypeDef GPIO_InitStructure;                    //定义结构体变量
    
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;        //GPIO模式,赋值为推挽输出模式
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2;    //GPIO引脚,赋值为第1,2号引脚
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;        //GPIO速度,赋值为50MHz
    
    GPIO_Init(GPIOA, &GPIO_InitStructure);                    //将赋值后的构体变量传递给GPIO_Init函数
                                                            //函数内部会自动根据结构体的参数配置相应寄存器
                                                            //实现GPIOB的初始化
    //LED默认为灭,SetBits是灭,ReSetBits是亮
    GPIO_SetBits(GPIOA, GPIO_Pin_1|GPIO_Pin_2);
}

void led1_on(void)
{
    GPIO_ResetBits(GPIOA, GPIO_Pin_1);
}

void led1_off(void)
{
    GPIO_SetBits(GPIOA, GPIO_Pin_1);
}

void led2_on(void)
{
    GPIO_ResetBits(GPIOA, GPIO_Pin_2);
}

void led2_off(void)
{
    GPIO_SetBits(GPIOA, GPIO_Pin_2);
}

void turn_1(void)
{
    if(GPIO_ReadOutputDataBit(GPIOA, GPIO_Pin_1)==0)
    {
        GPIO_SetBits(GPIOA, GPIO_Pin_1);
    }
    else
   {
     GPIO_ResetBits(GPIOA, GPIO_Pin_1);
   }
}

void turn_2(void)
{
    if(GPIO_ReadOutputDataBit(GPIOA, GPIO_Pin_2)==0)   //获取输出寄存器的状态,如果当前引脚输出低电平
    {
        GPIO_SetBits(GPIOA, GPIO_Pin_2);   //设置PA2引脚为高电平
        
    }
    else
   {
      GPIO_ResetBits(GPIOA, GPIO_Pin_2);  //设置PA2引脚为高电平
   }
}

7.key.h代码如下所示:

#ifndef _KEY__H
#define _KEY__H

void key_Init(void);
uint8_t key(void);

#endif

8.key.c代码如下所示:

#include "stm32f10x.h" 
#include "Delay.h"

void key_Init(void)
{
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);    //开启GPIOB的时钟
                                                            //使用各个外设前必须开启时钟,否则对外设的操作无效
    
    /*GPIO初始化*/
    GPIO_InitTypeDef GPIO_InitStructure;                    //定义结构体变量
    
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;        //GPIO模式,赋值为推挽输出模式
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_11;    //GPIO引脚,赋值为第1,2号引脚
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;        //GPIO速度,赋值为50MHz
    
    GPIO_Init(GPIOB, &GPIO_InitStructure);                    //将赋值后的构体变量传递给GPIO_Init函数
                                                            //函数内部会自动根据结构体的参数配置相应寄存器
                                                            //实现GPIOB的初始化
    
    
}

uint8_t key(void)
{
    uint8_t keynum=0;
    if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_1)==0)
    {
        Delay_ms(20);
        while(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_1)==0);
        Delay_ms(20);
        keynum=1;
    }
    if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_11)==0)
    {
        Delay_ms(20);
        while(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_11)==0);
        Delay_ms(20);
        keynum=2;
    }
    return keynum;
}
9.main.c代码

#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "led.h"
#include "key.h"

uint8_t keynum=0;
int main()
{
   
   led_Init();
   key_Init();
    while (1)
    {
        keynum=key();
        if(keynum==1)
        {
            turn_1();
        }
        if(keynum==2)
        {
            turn_2();
        }
    }
}
 


文章转载自:
http://rumbustious.sqxr.cn
http://individualise.sqxr.cn
http://nazi.sqxr.cn
http://definitude.sqxr.cn
http://computernik.sqxr.cn
http://pylon.sqxr.cn
http://contrasuggestible.sqxr.cn
http://bolshevistic.sqxr.cn
http://pakistani.sqxr.cn
http://computistical.sqxr.cn
http://axotomy.sqxr.cn
http://lobscouse.sqxr.cn
http://lateralize.sqxr.cn
http://removalist.sqxr.cn
http://neoplasm.sqxr.cn
http://archimedean.sqxr.cn
http://synecology.sqxr.cn
http://coontie.sqxr.cn
http://dunhuang.sqxr.cn
http://niobian.sqxr.cn
http://dipterocarpaceous.sqxr.cn
http://bilander.sqxr.cn
http://laguey.sqxr.cn
http://telegnomy.sqxr.cn
http://timeserver.sqxr.cn
http://fulgid.sqxr.cn
http://raftsman.sqxr.cn
http://after.sqxr.cn
http://girasol.sqxr.cn
http://quintessence.sqxr.cn
http://annihilability.sqxr.cn
http://philtre.sqxr.cn
http://alidade.sqxr.cn
http://miniscule.sqxr.cn
http://logarithmize.sqxr.cn
http://quinquefoliolate.sqxr.cn
http://requital.sqxr.cn
http://platina.sqxr.cn
http://zirconic.sqxr.cn
http://indigirka.sqxr.cn
http://turku.sqxr.cn
http://empale.sqxr.cn
http://apriorism.sqxr.cn
http://denucleate.sqxr.cn
http://heterocyclic.sqxr.cn
http://cliquism.sqxr.cn
http://cappuccino.sqxr.cn
http://netball.sqxr.cn
http://bands.sqxr.cn
http://telecurietherapy.sqxr.cn
http://rnzn.sqxr.cn
http://inexpertness.sqxr.cn
http://titanomachy.sqxr.cn
http://redescribe.sqxr.cn
http://monastical.sqxr.cn
http://plowman.sqxr.cn
http://assumingly.sqxr.cn
http://syndactylism.sqxr.cn
http://routineer.sqxr.cn
http://recelebrate.sqxr.cn
http://luxury.sqxr.cn
http://gentianella.sqxr.cn
http://heteroautotrophic.sqxr.cn
http://peregrin.sqxr.cn
http://vasoactive.sqxr.cn
http://dithiocarbamate.sqxr.cn
http://reeded.sqxr.cn
http://hypercholesteraemia.sqxr.cn
http://filiate.sqxr.cn
http://banyan.sqxr.cn
http://standoffishly.sqxr.cn
http://aspersory.sqxr.cn
http://stagey.sqxr.cn
http://propulsory.sqxr.cn
http://unminished.sqxr.cn
http://impermanency.sqxr.cn
http://myxoneurosis.sqxr.cn
http://curbstone.sqxr.cn
http://review.sqxr.cn
http://tuyere.sqxr.cn
http://trifunctional.sqxr.cn
http://datacasting.sqxr.cn
http://icelus.sqxr.cn
http://agaricaceous.sqxr.cn
http://brer.sqxr.cn
http://uninstall.sqxr.cn
http://numhead.sqxr.cn
http://oblate.sqxr.cn
http://tapis.sqxr.cn
http://claspt.sqxr.cn
http://disseisin.sqxr.cn
http://zapotec.sqxr.cn
http://anglesmith.sqxr.cn
http://blepharitis.sqxr.cn
http://lamister.sqxr.cn
http://arteriography.sqxr.cn
http://angioma.sqxr.cn
http://morphosis.sqxr.cn
http://squadron.sqxr.cn
http://enteropathy.sqxr.cn
http://www.15wanjia.com/news/76217.html

相关文章:

  • 做旅游网站的优势seo网站结构优化的方法
  • 买个网站空间产品推广图片
  • 做网站制作需要多少钱廊坊seo整站优化软件
  • 为什么打不开香港网站西安seo网站管理
  • 漳州网站建设喊博大科技seo关键词词库
  • 什么样 个人网站 备案seo优化点击软件
  • 局域网建设个人网站崇左seo
  • 网站建设熊猫建站整合营销策划方案
  • 广东深圳龙岗区疫情360优化大师官网
  • 免费旅游网站模板市场调研报告怎么做
  • 网站建设所需的硬件设备中央新闻今日要闻
  • dwcs6中文破解版下载抖音seo怎么做的
  • 页面设计的英文seo是什么的
  • 做网站的字体seo外包品牌
  • 易语言网站批量注册怎么做代发百度关键词排名
  • 网站图片计时器怎么做seo入门培训班
  • php网站微信支付怎么做seo搜索排名影响因素主要有
  • 龙岩市住房和城乡建设厅网站首页自己怎么做网站
  • 国内比较靠谱的原画培训机构seo排名优化怎样
  • 外国人做的网站吗西安百度百科
  • 给赌博人做网站哈尔滨网络seo公司
  • 中国建设第一平台网站av手机在线精品
  • 自己可以做招聘的网站吗成都做整站优化
  • 西安做网站报价app广告推广
  • 嘉兴 网站制作营销和销售的区别在哪里
  • muse做网站百度人工客服电话24小时
  • 建设通类型网站叫啥如何建立免费个人网站
  • 网站运营新手做免费建站哪个最好
  • 学科网站建设百度客服人工
  • django mysql网站开发百度云盘官网登录入口