Upload apple_gate.ino
Browse files- apple_gate.ino +26 -0
apple_gate.ino
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
int myNum;
|
2 |
+
int br=9600;
|
3 |
+
int rem;
|
4 |
+
String myColor;
|
5 |
+
String myPrompt="Please Enter Your Color: ";
|
6 |
+
void setup() {
|
7 |
+
// put your setup code here, to run once:
|
8 |
+
Serial.begin(br);
|
9 |
+
}
|
10 |
+
|
11 |
+
void loop() {
|
12 |
+
Serial.println(myPrompt);
|
13 |
+
while (Serial.available()==0){
|
14 |
+
}
|
15 |
+
myColor=Serial.readString();
|
16 |
+
myColor.toLowerCase();
|
17 |
+
if (myColor=="red"){
|
18 |
+
Serial.println("My Color!");
|
19 |
+
}
|
20 |
+
if (myColor!="red"){
|
21 |
+
Serial.print("Your Color is ");
|
22 |
+
Serial.print(myColor);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
|