Skip to content

Commit

Permalink
Update first-project.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zsarge authored Sep 17, 2024
1 parent f486c2e commit 2eeed18
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions docs/getting-started/first-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,6 @@ void loop() {
}
```

Then, you can add this:

```diff
const int pin = LED_BUILTIN;

void setup() {
+ Serial.begin(115200);
pinMode(pin, OUTPUT);
}

bool state = HIGH;

void loop() {
digitalWrite(pin, state);
- state = !state;
- delay(1000);
+ Serial.print("The pin state is: ");
+ Serial.println(state);
+
+ String input = Serial.readStringUntil('\n');
+ Serial.print("recieved: ");
+ Serial.println(input);
+
+ if (input.equals("on")) {
+ state = HIGH;
+ } else if (input.equals("off")) {
+ state = LOW;
+ }
}
```

So, now you should be able to control whether the internal id is on or off.

If you enter "on" into the Serial prompt, it should turn the LED on.
Expand Down

0 comments on commit 2eeed18

Please sign in to comment.