diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 5c9d735dc..6d67f08b3 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -1,3 +1,8 @@ +:source-highlighter: pygments +:pygments-style: arduino +:ext-relative: adoc + + = analogWrite() @@ -9,8 +14,10 @@ === Description 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. [%hardbreaks] - -image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption="", title="A beautiful Arduino UNO"] +On most Arduino boards (those with the ATmega168 or ATmega328), 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. +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. +You do not need to call `pinMode()` to set the pin as an output before calling `analogWrite()`. +The `analogWrite` function has nothing to do with the analog pins or the `analogRead` function. [%hardbreaks] @@ -21,8 +28,8 @@ image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption=" [float] === Parameters -`pin`: the pin to write to. + -`value`: the duty cycle: between 0 (always off) and 255 (always on). +`pin`: the pin to write to. Allowed data types: int. + +`value`: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: int [float] @@ -40,7 +47,7 @@ Nothing -- [float] -=== Example +=== Example Code Sets the output to the LED proportional to the value read from the potentiometer. @@ -66,23 +73,21 @@ void loop() [float] === Notes and Warnings -This is because of interactions with the `millis()` and `delay()` functions -[%hardbreaks] -image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption="", title="A beautiful Arduino UNO"] +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. [%hardbreaks] [float] === See also [role="language"] -* #LANGUAGE# http://arduino.cc/en/Reference/AnalogRead[analogRead()] -* #LANGUAGE# http://arduino.cc/en/Reference/AnalogRead[analogRead()] +* #LANGUAGE# link:analogRead{ext-relative}[analogRead()] +* #LANGUAGE# link:analogWriteResolution{ext-relative}[analogWriteResolution()] [role="definition"] -* #DEFINITION# http://arduino.cc/en/Tutorial/PWM[PWM] +* #DEFINITION# http://arduino.cc/en/Tutorial/PWM[PWM^] [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Blink[Blink] +* #EXAMPLE# http://arduino.cc/en/Tutorial/Blink[Blink^] -- // HOW TO USE SECTION ENDS diff --git a/Language/Functions/Communication/serial.adoc b/Language/Functions/Communication/serial.adoc index 03996f445..2c1561746 100644 --- a/Language/Functions/Communication/serial.adoc +++ b/Language/Functions/Communication/serial.adoc @@ -1,3 +1,7 @@ +:source-highlighter: pygments +:pygments-style: arduino +:ext-relative: adoc + = Serial() @@ -59,15 +63,16 @@ http://arduino.cc[serialEvent()] [float] === See also -[role="language"] -* #LANGUAGE# http://arduino.cc/en/Reference/AnalogRead[analogRead()] -* #LANGUAGE# http://arduino.cc/en/Reference/AnalogRead[analogRead()] - -[role="definition"] -* #DEFINITION# http://arduino.cc/en/Tutorial/PWM[PWM] [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Blink[Blink] +* #EXAMPLE# http://arduino.cc/en/Tutorial/ReadAsciiString[ReadAsciiString^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/ASCIITable[ASCII TAble^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/Dimmer[Dimmer^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/Graph[Graph^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/PhysicalPixel[Physical Pixel^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/SerialCallResponse[Serial Call Response^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/SerialCallResponseASCII[Serial Call Response ASCII^] + -- // SEEALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Structure/Boolean Operators/&&.adoc b/Language/Structure/Boolean Operators/&&.adoc index bd24a03c8..bee377ad9 100644 --- a/Language/Structure/Boolean Operators/&&.adoc +++ b/Language/Structure/Boolean Operators/&&.adoc @@ -1,3 +1,7 @@ +:source-highlighter: pygments +:pygments-style: arduino +:ext-relative: adoc + = && (and) @@ -8,16 +12,11 @@ [float] === Description Boolean Operators can be used inside the condition of an `if` statement. + -&& is true only if both operands are true, for instance in this example: - -[source,arduino] ----- -if (digitalRead(2) == HIGH && digitalRead(3) == HIGH) { // read two switches - // ... -} +`&&` is true only if both operands are true, for instance in this example: + +`if (digitalRead(2) == HIGH && digitalRead(3) == HIGH)` +[%hardbreaks] is true only if both inputs are high. ----- [%hardbreaks] -- @@ -31,7 +30,7 @@ is true only if both inputs are high. -- [float] -=== Example +=== Example Code [source,arduino] @@ -43,16 +42,16 @@ if (a >= 10 && a <= 20){} // true if a is between 10 and 20 [float] === Notes and Warnings -Make sure you don't mistake the boolean AND operator, && (double ampersand) for the bitwise AND operator & (single ampersand). They are entirely different beasts. +Make sure you don't mistake the boolean AND operator, `&&` (double ampersand) for the bitwise AND operator `&` (single ampersand). They are entirely different beasts. [float] === See also [role="language"] -* #LANGUAGE# http://arduino.cc/en/Reference/BitwiseAnd[&] (bitwise AND) -* #LANGUAGE# http://arduino.cc/en/Reference/BitwiseAnd[|] (bitwise OR) -* #LANGUAGE# http://arduino.cc/en/Reference/BitwiseXorNot[~] (bitwise NOT) -* #LANGUAGE# http://arduino.cc/en/Reference/If[if] +* #LANGUAGE# link:BitwiseAnd{ext-relative}[&^] (bitwise AND) +* #LANGUAGE# link:BitwiseOr{ext-relative}[|^] (bitwise OR) +* #LANGUAGE# link:BitwiseXorNot{ext-relative}[~^] (bitwise NOT) +* #LANGUAGE# link:If{ext-relative}[if^] -- // HOW TO USE SECTION ENDS diff --git a/Language/Structure/Further Syntax/CurlyBraces.adoc b/Language/Structure/Further Syntax/CurlyBraces.adoc index 528cfc17b..95be3816c 100644 --- a/Language/Structure/Further Syntax/CurlyBraces.adoc +++ b/Language/Structure/Further Syntax/CurlyBraces.adoc @@ -1,3 +1,7 @@ +:source-highlighter: pygments +:pygments-style: arduino +:ext-relative: adoc + = {} Curly Braces @@ -26,7 +30,7 @@ Unbalanced braces can often lead to cryptic, impenetrable compiler errors that c -- [float] -=== Example +=== Example Code The main uses of curly braces are listed in the examples below. @@ -73,7 +77,7 @@ for (initialisation; termination condition; incrementing expr) [float] -==== Functions +==== Conditional Statements [source,arduino] @@ -95,5 +99,13 @@ else [%hardbreaks] +[float] +=== See also +[role="language"] +* #LANGUAGE# link:SemiColon{ext-relative}[;^] (semicolon) +* #LANGUAGE# link:SingleComment{ext-relative}[//^] (single line comment) +* #LANGUAGE# link:MultiComments{ext-relative}[/* */^] (multi-line comment) + + -- // HOW TO USE SECTION ENDS diff --git a/Language/Structure/Main/setup.adoc b/Language/Structure/Main/setup.adoc index 645bbb514..7e96be04c 100644 --- a/Language/Structure/Main/setup.adoc +++ b/Language/Structure/Main/setup.adoc @@ -1,3 +1,7 @@ +:source-highlighter: pygments +:pygments-style: arduino +:ext-relative: adoc + = setup() @@ -29,7 +33,7 @@ Nothing -- [float] -=== Example +=== Example Code [source,arduino] ---- @@ -50,3 +54,8 @@ void loop() -- // HOW TO USE SECTION ENDS + +[float] +=== See also +[role="language"] +* #LANGUAGE# link:Loop{ext-relative}[loop^] diff --git a/Language/Variables/Constants/high-low.adoc b/Language/Variables/Constants/high-low.adoc deleted file mode 100644 index 5b387e270..000000000 --- a/Language/Variables/Constants/high-low.adoc +++ /dev/null @@ -1,2 +0,0 @@ - -= HIGH | LOW diff --git a/Language/Variables/Utilities/sizeof.adoc b/Language/Variables/Utilities/sizeof.adoc deleted file mode 100644 index 80ad17ffe..000000000 --- a/Language/Variables/Utilities/sizeof.adoc +++ /dev/null @@ -1,2 +0,0 @@ - -= sizeof() diff --git a/README.md b/README.md index 2e2d8be5e..a563c96bd 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,25 @@ If you want to contribute to the Language Reference or edit existing content, yo Please note that every Reference file should include as least a Description, some Example Code, and links to other relevant infos (See Also section). If you need to add images to the Asciidoc please create a folder called attachments in the same directory as the Asciidoc file. Images can be saved in SVG and PNG format, max size 200KB. + +##Folder Structure +``` +reference-en +├─ AsciiDoc_sample +│   ├── AsciiDoc_Dictionary +│   │   ├── AsciiDoc_Template-Dictionary.adoc +│   │   └── attachments +│   └── Reference_Terms +│   ├── AsciiDoc_Template-Parent_Of_Entities.adoc +│     ├── AsciiDoc_Template-Single_Entity.adoc +│     └── attachments +├── Language +│   ├── Functions +│   ├── Structure +│   └── Variables +├── LICENCE.md +└── README.md + +``` + +Within the Language folder, the file tree follows the same structure as in the [Arduino Reference webpage](http://arduino.cc/en/Reference/HomePage).