sensor
스위치
디지털 4번에 pull up으로 버튼연결
int buttonPin = 4; int ledPin = 13; boolean value; void setup() { pinMode(buttonPin, INPUT); pinMode(ledPin, OUTPUT); } void loop() { value = digitalRead(buttonPin); if (value == HIGH) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }
CdS
플렉스 센서
온도 센서
LM35
http://www.national.com/ds/LM/LM35.pdf
adafruit http://www.ladyada.net/learn/sensors/tmp36.html
캘리브레이션: http://www.arduino.cc/playground/Main/LM35HigherResolution
적외선 센서
캘리브레이션: 참고출처 http://luckylarry.co.uk/arduino-projects/arduino-using-a-sharp-ir-sensor-for-distance-calculation/
int IRpin = 1; // analog pin for reading the IR sensor void setup() { Serial.begin(9600); // start the serial port } void loop() { float volts = analogRead(IRpin)*0.0048828125; // value from sensor * (5/1024) - if running 3.3.volts then change 5 to 3.3 float distance = 65*pow(volts, -1.10); // worked out from graph 65 = theretical distance / (1/Volts)S - luckylarry.co.uk Serial.println(distance); // print the distance delay(100); // arbitary wait time. }
미션
GP2YOA02에 스펙에 맞추어 캘리브레이션 하기!
sensor.txt · Last modified: 2018/07/18 14:10 by 127.0.0.1