|
아두이노 전자파 측정기 소스변환
은비 | 2018-12-05
|
|
|---|---|
|
int inPin = 5; // analog 5
int val = 0; // where to store info from analog 5
int pin11 = 11; // output of red led
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(inPin); // reads in the values from analog 5 and
//assigns them to val
if(val >= 1){
val = constrain(val, 1, 100); // mess with these values
val = map(val, 1, 100, 1, 255); // to change the response distance of the device
analogWrite(pin11, val); // *note also messing with the resistor should change
// the sensitivity
}else{ // analogWrite(pin11, val); just tuns on the led with
// the intensity of the variable val
analogWrite(pin11, 0); // the else statement is just telling the microcontroller
// to turn off the light if there is no EMF detected
}
Serial.println(val); // use output to aid in calibrating
}
아두이노 시리얼 통신 할 수 있도록 소스 변환 해주실 수 있나요 ㅠㅠ 급합니당 엘이디 깜빡임 말구 전자파가 어느정도 인지 값을 보고 싶은데 ㅠㅜ 도와쥬세요 |
|
| 이전글 | 2개의 DC모터 속도 맞춘느 방법 아시나요? | 2018-12-04 |
| 다음글 | 아두이노 스마트 홈 키트 조도센서 질문 드립니다.... | 2018-12-05 |