wau2380's playground

[모각코 아두이노] 8일차 / 터치센서 본문

카테고리 없음

[모각코 아두이노] 8일차 / 터치센서

wau2380 2021. 9. 26. 14:26

터치센서는 정전식으로 작동되며, 인체 부위가 닿음의 여부에 따라 0 과 1을 반환합니다.

어쨌든, 오늘은 터치센서를 이용한  

제가 재미로 초음파센서와 서보모터를 이용한 휴지통을 만들어 봤거든요.

코드

#include <HuemonelabKit.h>

ServoMotor motor;
SonarSensor sonar(5,6);

void setup(){
	motor.attach(7);
}

void loop() {
	int value = sonar.read();
    if(value < 10) {
    	motor.write(90);
        delay(1000);
    }
    else{
    	motor.write(0);
    }

결과물

 

게시글 : https://cafe.naver.com/codeuniv/45100

 

[모각코 출석 인증] 5일차 - 아두이노로 배우는 C언어 9월 과정 A조

대한민국 모임의 시작, 네이버 카페

cafe.naver.com

코뮤니티 : https://cafe.naver.com/codeuniv



출처: https://wau2380.tistory.com/24