Skip to content

Commit 5ebf446

Browse files
Create arduinoCharInput.ino
1 parent 1f25d13 commit 5ebf446

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
int analogPin = 3;
3+
int data = 0;
4+
char userInput;
5+
6+
void setup(){
7+
8+
Serial.begin(9600); // setup serial
9+
10+
}
11+
12+
void loop(){
13+
14+
if(Serial.available()> 0){
15+
16+
userInput = Serial.read(); // read user input
17+
18+
if(userInput == 'g'){ // if we get expected value
19+
20+
data = analogRead(analogPin); // read the input pin
21+
Serial.println(data);
22+
23+
} // if user input 'g'
24+
} // Serial.available
25+
} // Void Loop
26+
27+
28+
29+

0 commit comments

Comments
 (0)