【51 MCU】 Flame sensor usage and code

Publisher:blq0681Latest update time:2022-07-01 Source: csdn Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Here we use 4 wires, but the principle of 3 wires is the same.

The IO port is customized in the program. The one used below is P3^0


#include

void main()

{

while(1)

{

P2=0xff; //Initialize LED

   if(P3_0==0) //The sensor detects a flame signal

   P2=0x00; //LED is fully lit

}

}


wiring:

AO: Analog output signal

DO: digital output signal


This article only uses the digital output signal DO- to connect to P3^0 port, Vcc and Gnd are power supply and ground respectively

insert image description here

Reference address:【51 MCU】 Flame sensor usage and code

Previous article:[51 MCU] Detailed explanation of the initial value calculation of the timer
Next article:C51 MCU writes an external interrupt (entry-level MCU)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号