找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2468|回复: 10
打印 上一主题 下一主题
收起左侧

求教用红外对管检测黑白的51单片机代码

[复制链接]
楼主
ID:430832 发表于 2018-12-16 19:51 | 显示全部楼层
#include <reg52.h> #define uchar unsigned char #define uint unsigned int    sbit out=P0^0;   void main() {         out=1;         P1=0x06;         P2=0x7f;         while(1)         {                 if(out==1)                 {                         P1=0x3f;                         P2=0x7f;                 }                 if(out==0)                 {                         P1=0x06;                 P2=0x7f;                 }                         } } //P1为段选   P2为位选
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表