Skip to content

bulk-fixing links #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ You can visit the [Activate an Arduino Pro Gateway with IoT Cloud](https://suppo
### Migrate Existing Gateway


If you had a gateway setup prior to the [A2A to TTS migration](linktoblogpost.com ), you will need to complete the following steps to use the Pro Gateway.
If you had a gateway setup prior to the A2A to TTS migration, you will need to complete the following steps to use the Pro Gateway.

To perform the Arduino Pro gateway migration:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Connect the three wires from the potentiometer to your board. The first goes fro

By turning the shaft of the potentiometer, you change the amount of resistance on either side of the wiper, which is connected to the center pin of the potentiometer. This changes the voltage at the center pin. When the resistance between the center and the side connected to 5 volts is close to zero (and the resistance on the other side is close to 10k ohm), the voltage at the center pin nears 5 volts. When the resistances are reversed, the voltage at the center pin nears 0 volts, or ground. This voltage is the *analog voltage* that you're reading as an input.

The Arduino boards have a circuit inside called an *analog-to-digital converter or ADC* that reads this changing voltage and converts it to a number between 0 and 1023. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and the input value is 0. When the shaft is turned all the way in the opposite direction, there are 5 volts going to the pin and the input value is 1023. In between, [analogRead](https://www.arduino.cc/en/Reference/AnalogRead)() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.
The Arduino boards have a circuit inside called an *analog-to-digital converter or ADC* that reads this changing voltage and converts it to a number between 0 and 1023. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and the input value is 0. When the shaft is turned all the way in the opposite direction, there are 5 volts going to the pin and the input value is 1023. In between, [analogRead](https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/)() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

### Schematic

Expand All @@ -44,7 +44,7 @@ In the sketch below, the only thing that you do in the setup function is to begi

`Serial.begin(9600);`

Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between 0 and 1023, perfect for an [`int`datatype](https://www.arduino.cc/en/Reference/Int)) coming in from your potentiometer:
Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between 0 and 1023, perfect for an [`int`datatype](https://www.arduino.cc/reference/en/language/variables/data-types/int/)) coming in from your potentiometer:

`int sensorValue = analogRead(A0);`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Next, initialize digital pin 2, the pin that will read the output from your butt

Now that your setup has been completed, move into the main loop of your code. When your button is pressed, 5 volts will freely flow through your circuit, and when it is not pressed, the input pin will be connected to ground through the 10k ohm resistor. This is a digital input, meaning that the switch can only be in either an on state (seen by your Arduino as a "1", or HIGH) or an off state (seen by your Arduino as a "0", or LOW), with nothing in between.

The first thing you need to do in the main loop of your program is to establish a variable to hold the information coming in from your switch. Since the information coming in from the switch will be either a "1" or a "0", you can use an [`int`datatype](https://www.arduino.cc/en/Reference/Int). Call this variable `sensorValue`, and set it to equal whatever is being read on digital pin 2. You can accomplish all this with just one line of code:
The first thing you need to do in the main loop of your program is to establish a variable to hold the information coming in from your switch. Since the information coming in from the switch will be either a "1" or a "0", you can use an [`int`datatype](https://www.arduino.cc/reference/en/language/variables/data-types/int/). Call this variable `sensorValue`, and set it to equal whatever is being read on digital pin 2. You can accomplish all this with just one line of code:

`int sensorValue = digitalRead(2);`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Connect the three wires from the potentiometer to your board. The first goes to

By turning the shaft of the potentiometer, you change the amount of resistance on either side of the wiper which is connected to the center pin of the potentiometer. This changes the voltage at the center pin. When the resistance between the center and the side connected to 5 volts is close to zero (and the resistance on the other side is close to 10 kilohms), the voltage at the center pin nears 5 volts. When the resistances are reversed, the voltage at the center pin nears 0 volts, or ground. This voltage is the **analog voltage** that you're reading as an input.

The microcontroller of the board has a circuit inside called an *analog-to-digital converter* or *ADC* that reads this changing voltage and converts it to a number between 0 and 1023. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and the input value is 0. When the shaft is turned all the way in the opposite direction, there are 5 volts going to the pin and the input value is 1023. In between, [analogRead](https://www.arduino.cc/en/Reference/AnalogRead)() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.
The microcontroller of the board has a circuit inside called an *analog-to-digital converter* or *ADC* that reads this changing voltage and converts it to a number between 0 and 1023. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and the input value is 0. When the shaft is turned all the way in the opposite direction, there are 5 volts going to the pin and the input value is 1023. In between, [analogRead](https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/)() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

### Schematic

Expand All @@ -40,11 +40,11 @@ In the program below, the very first thing you'll do will be in the setup functi

`Serial.begin(9600);`

Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between 0 and 1023, perfect for an [`int`datatype](https://www.arduino.cc/en/Reference/Int)) coming in from your potentiometer:
Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between 0 and 1023, perfect for an [`int`datatype](https://www.arduino.cc/reference/en/language/variables/data-types/int/)) coming in from your potentiometer:

`int sensorValue = analogRead(A0);`

To change the values from 0-1023 to a range that corresponds to the voltage the pin is reading, you'll need to create another variable, a [`float`](https://www.arduino.cc/en/Reference/Float), and do a little math. To scale the numbers between 0.0 and 5.0, divide 5.0 by 1023.0 and multiply that by **sensorValue** :
To change the values from 0-1023 to a range that corresponds to the voltage the pin is reading, you'll need to create another variable, a [`float`](https://www.arduino.cc/reference/en/language/variables/data-types/float/), and do a little math. To scale the numbers between 0.0 and 5.0, divide 5.0 by 1023.0 and multiply that by **sensorValue** :

`float voltage= sensorValue * (5.0 / 1023.0);`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The following line make pin 13, with the onboard LED, an output :

Now that your setup has been completed, move into the main loop of your code. When your button is not pressed, the internal pull-up resistor connects to 5 volts. This causes the Arduino to report "1" or HIGH. When the button is pressed, the Arduino pin is pulled to ground, causing the Arduino report a "0", or LOW.

The first thing you need to do in the main loop of your program is to establish a variable to hold the information coming in from your switch. Since the information coming in from the switch will be either a "1" or a "0", you can use an [`int`datatype](https://www.arduino.cc/en/Reference/Int). Call this variable `sensorValue`, and set it to equal whatever is being read on digital pin 2. You can accomplish all this with just one line of code:
The first thing you need to do in the main loop of your program is to establish a variable to hold the information coming in from your switch. Since the information coming in from the switch will be either a "1" or a "0", you can use an [`int`datatype](https://www.arduino.cc/reference/en/language/variables/data-types/int/). Call this variable `sensorValue`, and set it to equal whatever is being read on digital pin 2. You can accomplish all this with just one line of code:

`int sensorValue = digitalRead(2);`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ In the sketch below, after declaring two pin assignments (analog 0 for our poten

Next, in the main loop, `sensorValue` is assigned to store the raw analog value read from the potentiometer. Arduino has an `analogRead` range from 0 to 1023, and an `analogWrite` range only from 0 to 255, therefore the data from the potentiometer needs to be converted to fit into the smaller range before using it to dim the LED.

In order to convert this value, use a function called [map()](https://www.arduino.cc/en/Reference/Map):
In order to convert this value, use a function called [map()](https://www.arduino.cc/reference/en/language/functions/math/map/):

`outputValue = map(sensorValue, 0, 1023, 0, 255);`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Photoresistor

At the beginning of this sketch, the variable `sensorPin` is set to to analog pin 0, where your potentiometer is attached, and `ledPin` is set to digital pin 13. You'll also create another variable, `sensorValue` to store the values read from your sensor.

The [`analogRead()`](https://www.arduino.cc/en/Reference/AnalogRead) command converts the input voltage range, 0 to 5 volts, to a digital value between 0 and 1023. This is done by a circuit inside the microcontroller called an *analog-to-digital converter* or *ADC*.
The [`analogRead()`](https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/unctions/analog-io/analogread/) command converts the input voltage range, 0 to 5 volts, to a digital value between 0 and 1023. This is done by a circuit inside the microcontroller called an *analog-to-digital converter* or *ADC*.

By turning the shaft of the potentiometer, you change the amount of resistance on either side of the center pin (or wiper) of the potentiometer. This changes the relative resistances between the center pin and the two outside pins, giving you a different voltage at the analog input. When the shaft is turned all the way in one direction, there is no resistance between the center pin and the pin connected to ground. The voltage at the center pin then is 0 volts, and `analogRead()` returns 0. When the shaft is turned all the way in the other direction, there is no resistance between the center pin and the pin connected to +5 volts. The voltage at the center pin then is 5 volts, and `analogRead()` returns 1023. In between, `analogRead()` returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Connect the longer, positive legs (anodes) of 12 LEDs to digital pins 2-13 throu

### Code

In the `setup()` function of the code below, a [`for()`](https://www.arduino.cc/en/Reference/For) loop is used to assign digital pins 2-13 of the Mega as outputs.
In the `setup()` function of the code below, a [`for()`](https://www.arduino.cc/reference/en/language/structure/control-structure/for/) loop is used to assign digital pins 2-13 of the Mega as outputs.

Next, in the `loop()` function of the program below, a trio of nested `for()` loops are used.

Expand Down
4 changes: 2 additions & 2 deletions content/built-in-examples/03.analog/Smoothing/Smoothing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags:
- Code
---

This sketch reads repeatedly from an analog input, calculating a running average and printing it to the computer. This example is useful for smoothing out the values from jumpy or erratic sensors, and also demonstrates the use of [arrays](https://www.arduino.cc/en/Reference/Array) to store data.
This sketch reads repeatedly from an analog input, calculating a running average and printing it to the computer. This example is useful for smoothing out the values from jumpy or erratic sensors, and also demonstrates the use of [arrays](https://www.arduino.cc/reference/en/language/variables/data-types/array/) to store data.

### Hardware

Expand All @@ -34,7 +34,7 @@ Connect one pin of a potentiometer to 5V, the center pin to analog pin 0, and th

### Code

The code below sequentially stores 10 readings from your analog sensor into an [arrays](https://www.arduino.cc/en/Reference/Array), one by one. With each new value, the sum of all the numbers is generated and divided, producing an average value which then be used to smooth outlying data. Because this averaging takes place each time a new value is added to the array (rather then waiting for 10 new values, for instance) there is no lag time in calculating this running average.
The code below sequentially stores 10 readings from your analog sensor into an [arrays](https://www.arduino.cc/reference/en/language/variables/data-types/array/), one by one. With each new value, the sum of all the numbers is generated and divided, producing an average value which then be used to smooth outlying data. Because this averaging takes place each time a new value is added to the array (rather then waiting for 10 new values, for instance) there is no lag time in calculating this running average.

Altering the size of the array used, by changing `numReadings` to a larger value will smooth the data collected even further.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RGB LEDs with a common anode share a common power pin. Instead of turning a pin

### Code

You'll first set up some [global variables](/referencehttps://www.arduino.cc/en/language/variables/variable-scope-qualifiers/scope/) for the pins your LED will connect to. This will make it easier to differentiate which one is red, green, and blue in the main part of your program:
You'll first set up some [global variables](/reference/en/language/variables/variable-scope-qualifiers/scope/) for the pins your LED will connect to. This will make it easier to differentiate which one is red, green, and blue in the main part of your program:

```arduino
const int redPin = 3;
Expand All @@ -65,7 +65,7 @@ pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
```

In the [loop](https://www.arduino.cc/en/Reference/Loop)(), check to see if there is any data in the serial buffer. By making this a [while()](https://www.arduino.cc/en/Reference/While) statement, it will run as long as there is information waiting to be read :
In the [loop](https://www.arduino.cc/en/Reference/Loop)(), check to see if there is any data in the serial buffer. By making this a [while()](https://www.arduino.cc/reference/en/language/structure/control-structure/while/) statement, it will run as long as there is information waiting to be read :

```arduino
while (Serial.available() > 0) {
Expand Down Expand Up @@ -109,7 +109,7 @@ Serial.print(green, HEX);
Serial.println(blue, HEX);
```

Finally, close up your brackets from the [if](https://www.arduino.cc/en/Reference/If) statement, while statement, and main loop :
Finally, close up your brackets from the [if](https://www.arduino.cc/reference/en/language/structure/control-structure/if/) statement, while statement, and main loop :

```arduino
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tags:
- Code
---

This variation on the [For Loop Iteration](/built-in-examples/control-structures/ForLoopIteration) example shows how to use an [**array**](https://www.arduino.cc/en/Reference/Array). An array is a variable with multiple parts. If you think of a variable as a cup that holds values, you might think of an array as an ice cube tray. It's like a series of linked cups, all of which can hold the same maximum value.
This variation on the [For Loop Iteration](/built-in-examples/control-structures/ForLoopIteration) example shows how to use an [**array**](https://www.arduino.cc/reference/en/language/variables/data-types/array/). An array is a variable with multiple parts. If you think of a variable as a cup that holds values, you might think of an array as an ice cube tray. It's like a series of linked cups, all of which can hold the same maximum value.

The [For Loop Iteration](/built-in-examples/control-structures/ForLoopIteration) example shows you how to light up a series of LEDs attached to pins 2 through 7 of the Arduino board, with certain limitations (the pins have to be numbered contiguously, and the LEDs have to be turned on in sequence).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags:
featuredImage: 'board'
---

Often you want to iterate over a series of pins and do something to each one. For instance, this example blinks 6 LEDs attached to the Arduino by using a [**for()**](https://www.arduino.cc/en/Reference/For) loop to cycle back and forth through digital pins 2-7. The LEDS are turned on and off, in sequence, by using both the [digitalWrite()](https://www.arduino.cc/en/Reference/DigitalWrite) and [delay()](https://www.arduino.cc/en/Reference/Delay) functions .
Often you want to iterate over a series of pins and do something to each one. For instance, this example blinks 6 LEDs attached to the Arduino by using a [**for()**](https://www.arduino.cc/reference/en/language/structure/control-structure/for/) loop to cycle back and forth through digital pins 2-7. The LEDS are turned on and off, in sequence, by using both the [digitalWrite()](https://www.arduino.cc/en/Reference/DigitalWrite) and [delay()](https://www.arduino.cc/reference/en/language/functions/time/delay/) functions .

We also call this example "[Knight Rider](http://en.wikipedia.org/wiki/KITT)" in memory of a TV-series from the 80's where David Hasselhoff had an AI machine named KITT driving his Pontiac. The car had been augmented with plenty of LEDs in all possible sizes performing flashy effects. In particular, it had a display that scanned back and forth across a line, as shown in this exciting [fight between KITT and KARR](https://www.youtube.com/watch?v=PO5E5mQIy_Q). This example duplicates the KITT display.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tags:
- Code
---

An if statement allows you to choose between two discrete options, TRUE or FALSE. When there are more than two options, you can use multiple if statements, or you can use the [**switch**](https://www.arduino.cc/en/Reference/SwitchCase) statement. Switch allows you to choose between several discrete options. This tutorial shows you how to use it to switch between four desired states of a photo resistor: really dark, dim, medium, and bright.
An if statement allows you to choose between two discrete options, TRUE or FALSE. When there are more than two options, you can use multiple if statements, or you can use the [**switch**](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) statement. Switch allows you to choose between several discrete options. This tutorial shows you how to use it to switch between four desired states of a photo resistor: really dark, dim, medium, and bright.

This program first reads the photoresistor. Then it uses the `map()` function to map its output to one of four values: 0, 1, 2, or 3. Finally, it uses the `switch()` statement to print one of four messages back to the computer depending on which of the four values is returned.

Expand Down
Loading