Skip to content

Commit 4cddd06

Browse files
authored
Merge pull request #451 from arduino/marqdevx/learn/GS-fix
Learn, Getting Started: fix typos [PC-916]
2 parents 66d1f53 + 9ea7443 commit 4cddd06

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

content/learn/01.starting-guide/00.getting-started-arduino/getting-started-arduino.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ To control actuators, it is common to use `digitalWrite()` and `analogWrite()`.
190190

191191
```arduino
192192
digitalWrite(LED, HIGH); //turn on an LED
193-
digitalWrite(LED, LOW); //turn off an LED
193+
digitalWrite(LED, LOW); //turn off an LED
194194
195195
analogWrite(motor, 255); //set a motor to maximum capacity
196-
analogWrite(motor, 25); //set a motor to 10% of its capacity
196+
analogWrite(motor, 25); //set a motor to 10% of its capacity
197197
```
198198

199199
#### Input & Output
@@ -203,13 +203,12 @@ Sensors and actuators, are typically referred to as **inputs and outputs**. When
203203
A basic example of this is a **button** and an **LED**. We can write a conditional that checks if a button is pressed, turn on the LED, and turn it off if the button is not pressed. In an Arduino program, it looks like this:
204204

205205
```arduino
206-
int buttonState = digitalRead(buttonPin); //read and store the button state (0 or 1)
206+
int buttonState = digitalRead(buttonPin); //read and store the button state (0 or 1)
207207
208-
if(buttonState == HIGH){ //check if state is high (button is pressed)
209-
digitalWrite(LED, HIGH) //turn on LED
210-
}
211-
else {
212-
digitalWrite(LED, LOW); //turn off LED
208+
if(buttonState == HIGH){ //check if state is high (button is pressed)
209+
digitalWrite(LED, HIGH); //turn on LED
210+
} else {
211+
digitalWrite(LED, LOW); //turn off LED
213212
}
214213
```
215214

@@ -523,11 +522,13 @@ unsigned long currentMillis = millis();
523522
524523
//conditional that checks whether 1 second has passed since last event
525524
if (currentMillis - previousMillis_1 >= interval_1) {
525+
previousMillis_1 = millis();
526526
//execute a piece of code, every *1 second*
527527
}
528528
529529
//conditional that checks whether 2 seconds have passed since last event
530530
if (currentMillis - previousMillis_2 >= interval_2) {
531+
previousMillis_2 = millis();
531532
//execute a piece of code, every *2 seconds*
532533
}
533534
@@ -607,7 +608,7 @@ float
607608
int
608609
long
609610
short
610-
String()
611+
String
611612
```
612613

613614
To store data in for example an `int` (integer):
@@ -631,7 +632,7 @@ String exampleSentence = "This is a string!";
631632
For simple switches and true/false, we use booleans:
632633

633634
```arduino
634-
bool exampleSwitch = true/false;
635+
bool exampleSwitch = true; // true/false
635636
```
636637

637638
### Serial Communication
@@ -754,10 +755,10 @@ while (variable == true) {
754755
}
755756
```
756757

757-
A basic use of a `for` loop is to execute a block of code a number of times (in this case, 10).
758+
A basic use of a `for` loop is to execute a block of code a custom number of times (in this case, 10).
758759

759760
```arduino
760-
for (int x = 0; x <= 10; x++) {
761+
for (int x = 0; x < 10; x++) {
761762
//do something 10 times
762763
}
763764
```
@@ -810,29 +811,31 @@ if(value > 10) {
810811

811812
#### Boolean Operators
812813

813-
Boolean operators (logical not `!`, and `&&`, or `||`) can for example be used for more advanced conditionals.
814+
Boolean operators (logical NOT `!`, AND `&&` and OR `||`) can for example be used for more advanced conditionals.
814815

815-
To use the and `&&` operator:
816+
To use the AND `&&` operator:
816817

817818
```arduino
818819
if(value > 10 && otherValue > 10){
819820
//do something if only if *both* conditions are met
820821
}
821822
```
822823

823-
To use the or `||` operator:
824+
To use the OR `||` operator:
824825

825826
```arduino
826827
if(value > 10 || otherValue > 10){
827828
//do something if a one *or* the other condition is met
828829
}
829830
```
830831

831-
To use the not `!` operator:
832+
To use the NOT `!` operator:
832833

834+
```arduino
833835
if(!value){
834836
//do something if value is false (!)
835837
}
838+
```
836839

837840
#### Compound Operators
838841

0 commit comments

Comments
 (0)