Skip to content

Commit 9ee8149

Browse files
author
Giuseppe Masino
committed
Translated analogWrite()
1 parent bbe5d88 commit 9ee8149

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

Language/Functions/Analog IO/analogWrite.adoc

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,32 @@ subCategories: [ "Analog I/O" ]
1616
--
1717

1818
[float]
19-
=== Description
20-
Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady square wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz.
19+
=== Descrizione
20+
Scrive un valore analogico (http://arduino.cc/en/Tutorial/PWM[onda PWM]) ad un pin.
21+
Può essere usato per illuminare un LED a luminosità variabile o pilotare un motore a diverse velocità.
22+
Dopo una chiamata a `analogWrite()`, il pin genererà un'onda quadra costante con il duty cycle specificato fino alla prossima chiamata a `analogWrite()` ( oppure `digitalRead()` o `digitalWrite()` ) sullo stesso pin.
23+
La frequenza del segnale PWM su molti pin è approssimativamente 490 Hz.
24+
Sulla Uno e schede simili, i pin 5 e 6 hanno una frequenza di circa 980 Hz.
2125
[%hardbreaks]
22-
On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support `analogWrite()` on pins 9, 10, and 11.
23-
The Arduino DUE supports `analogWrite()` on pins 2 through 13, plus pins DAC0 and DAC1. Unlike the PWM pins, DAC0 and DAC1 are Digital to Analog converters, and act as true analog outputs.
24-
You do not need to call `pinMode()` to set the pin as an output before calling `analogWrite()`.
25-
The `analogWrite` function has nothing to do with the analog pins or the `analogRead` function.
26+
Sulla maggior parte delle schede Arduino ( quelle con ATmega168 o ATmega328P ), questa funzione lavora sui pin 3, 5, 6, 9, 10, e 11.
27+
Sull'Arduino Mega, lavora sui pin dal 2 al 13 e dal 44 al 46.
28+
Le schede Arduino più vecchie con un ATmega8 supportano `analogWrite()` solo sui pin 9, 10, e 11.
29+
Arduino DUE supporta `analogWrite()` sui pin da 2 a 13, oltre che sui pin DAC0 e DAC1.
30+
Diversamente dai pin PWM, DAC0 e DAC1 sono convertitori digitale-analogico, e si comportano come veri output analogici.
31+
Non hai bisogno di chiamare `pinMode()` per impostare il pin come output prima di chiamare `analogWrite()`.
32+
La funzione `analogWrite` non ha nulla a che vedere con i pin analogici o la funzione `analogRead`.
2633
[%hardbreaks]
2734

2835

2936
[float]
30-
=== Syntax
31-
`analogWrite(pin, value)`
37+
=== Sintassi
38+
`analogWrite(pin, valore)`
3239

3340

3441
[float]
3542
=== Parameters
36-
`pin`: the pin to write to. Allowed data types: int. +
37-
`value`: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: int
43+
`pin`: Il pin sul quale scrivere. Tipi di dato permessi: int. +
44+
`valore`: il duty cycle: tra 0 ( sempre spento ) e 255 ( sempre acceso ). Tipi di dato permessi: int
3845

3946

4047
[float]
@@ -52,33 +59,33 @@ Nothing
5259
--
5360

5461
[float]
55-
=== Example Code
56-
Sets the output to the LED proportional to the value read from the potentiometer.
62+
=== Codice di Esempio
63+
Imposta l'output del LED in modo proporzionale al valore letto dal potenziometro.
5764

5865

5966
[source,arduino]
6067
----
61-
int ledPin = 9; // LED connected to digital pin 9
62-
int analogPin = 3; // potentiometer connected to analog pin 3
63-
int val = 0; // variable to store the read value
68+
int ledPin = 9; // il LED connesso al pin 9
69+
int analogPin = 3; // potenziometro connesso al pin A3
70+
int val = 0; // variabile per conservare il valore letto
6471
6572
void setup()
6673
{
67-
pinMode(ledPin, OUTPUT); // sets the pin as output
74+
pinMode(ledPin, OUTPUT); // imposta il pin come output
6875
}
6976
7077
void loop()
7178
{
72-
val = analogRead(analogPin); // read the input pin
73-
analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
79+
val = analogRead(analogPin); // leggi il pin di input
80+
analogWrite(ledPin, val / 4); // i valori di analogRead vanno da 0 a 1023, i valori di analogWrite da 0 a 255
7481
}
7582
----
7683
[%hardbreaks]
7784

7885

7986
[float]
80-
=== Notes and Warnings
81-
The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the `millis()` and `delay()` functions, which share the same internal timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle settings (e.g. 0 - 10) and may result in a value of 0 not fully turning off the output on pins 5 and 6.
87+
=== Note e Avvertimenti
88+
Gli output PWM generati sui pin 5 e 6 avranno un duty cyle più alto di quello atteso. Questo a causa dell'interazione con le funzioni `millis()` e `delay()`, che condividono lo stesso timer interno usato per generare questi output PWM. Questo si noterà in particolare con impostazioni basse del duty-cycle (es. 0 - 10) e potrebbe risultare in un valore di 0 che non spegne completamente l'output sui pin 5 e 6.
8289

8390
--
8491
// HOW TO USE SECTION ENDS
@@ -89,16 +96,16 @@ The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cy
8996
--
9097

9198
[float]
92-
=== See also
99+
=== Vedi anche
93100

94101
[role="language"]
95-
* #LANGUAGE# link:../../zero-due-mkr-family/analogwriteresolution[analogWriteResolution()]
102+
* #LINGUAGGIO# link:../../zero-due-mkr-family/analogwriteresolution[analogWriteResolution()]
96103

97104
[role="definition"]
98-
* #DEFINITION# http://arduino.cc/en/Tutorial/PWM[PWM^]
105+
* #DEFINIZIONE# http://arduino.cc/en/Tutorial/PWM[PWM^]
99106

100107
[role="example"]
101-
* #EXAMPLE# http://arduino.cc/en/Tutorial/Blink[Blink^]
108+
* #ESEMPIO# http://arduino.cc/en/Tutorial/Blink[Blink^]
102109

103110
--
104111
// SEE ALSO SECTION ENDS

0 commit comments

Comments
 (0)