Skip to content

Commit 49ddf29

Browse files
committed
Initial Commit
1 parent 7196826 commit 49ddf29

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

7_if_statement_conditional.ino

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// C++ code
2+
//
3+
const int analogPin = A0;
4+
const int ledPin = 13;
5+
const int threshold = 400;
6+
void setup()
7+
{
8+
pinMode(ledPin, OUTPUT);
9+
Serial.begin(9600);
10+
}
11+
12+
void loop()
13+
{
14+
int analogValue = analogRead(analogPin);
15+
if(analogValue>threshold){
16+
digitalWrite(ledPin,HIGH);
17+
}else{
18+
digitalWrite(ledPin,LOW);
19+
}
20+
Serial.println(analogValue);
21+
delay(1);
22+
}

7_if_statement_conditional.png

96.4 KB
Loading

0 commit comments

Comments
 (0)