We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f25d13 commit 5ebf446Copy full SHA for 5ebf446
Part3_InitializationErrorHandling/arduinoCharInput/arduinoCharInput.ino
@@ -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