1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | int analogPin = 0; // 워터센서 analog port 0 연결 선언 int val = 0; // 전류변화값 변수선언 void setup () { Serial.begin (9600); // 시리얼모니터 설정 } void loop() { val = analogRead(analogPin); // analogPin 의 변화값(전류값)을 읽음 Serial.println(val); // 시리얼모니터에 전류값 표시 delay (500); } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | int sensorPin = A0; // select the input pin for the potentiometer int sensorValue = 0; // variable to store the value coming from the sensor void setup() { // declare the ledPin as an OUTPUT: Serial.begin(9600); } void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); delay(1000); Serial.print("sensor = " ); Serial.println(sensorValue); } | cs |
'이것저것 > 잡다한것' 카테고리의 다른 글
Node js + mysql error (0) | 2018.10.07 |
---|---|
아두이노 엑셀연동 (PLX-DAQ) (0) | 2017.03.08 |
라즈베리파이 카메라 파이썬 (0) | 2017.02.13 |
크롬에서 11번가 자동 새 탭 열림 문제해결 (0) | 2016.09.03 |
윈도우 태블릿 - 윈10 업글 (0) | 2016.07.12 |