21 lines
397 B
C++
21 lines
397 B
C++
int sensorPin = A0;
|
|
int LED = 13;
|
|
int sensorValue = 0;
|
|
|
|
void setup() {
|
|
// put your setup code here, to run once:
|
|
Serial.begin(9600);
|
|
pinMode(LED,OUTPUT);
|
|
}
|
|
|
|
void loop() {
|
|
// put your main code here, to run repeatedly:
|
|
sensorValue = analogRead(sensorPin);
|
|
digitalWrite(LED, HIGH);
|
|
delay(sensorValue);
|
|
digitalWrite(LED,LOW);
|
|
delay(sensorValue);
|
|
|
|
Serial.println(sensorValue);
|
|
}
|