BASIC4MCU | 질문게시판 | 답변 : flame sensor 질문입니다
페이지 정보
작성자 master 작성일2022-12-10 06:17 조회1,664회 댓글0건
https://www.basic4mcu.com/bbs/board.php?bo_table=gac&wr_id=22139
본문
int flame=A0;int buzzer=2;int red=11,green=10,blue=9;//void setup(){pinMode(buzzer,OUTPUT);Serial.begin(9600);}//void loop(){int flamesensor = analogRead(flame);Serial.print("Flame Sensor Value: "); Serial.println(flamesensor);//if(flamesensor==1023){ Color(0,0,0); Color(0,0,0); Color(0,0,0); digitalWrite(buzzer,LOW); }else{digitalWrite(buzzer,1);Color(255,0,0); delay(500);Color(0,255,0); delay(500);Color(0,0,255); delay(500);digitalWrite(buzzer,0);}delay(1000);}void Color(int r,int g,int b){ analogWrite(red,r); analogWrite(green,g); analogWrite(blue,b); }
댓글 0
조회수 1,664등록된 댓글이 없습니다.