Some content is hidden Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner Expand file tree Collapse file tree 73 files changed +1283
-1283
lines changed Open diff view setti
38AC
ngs Original file line number Diff line number Diff line change 11/*
22 DigitalReadSerial
3- Reads a digital input on pin 2, prints the result to the Serial Monitor
3+ Reads a digital input on pin 2, prints the result to the Serial Monitor
44
5- This example code is in the public domain.
5+ This example code is in the public domain.
66 */
77
88// digital pin 2 has a pushbutton attached to it. Give it a name:
Original file line number Diff line number Diff line change 11/*
2- Fade
2+ Fade
33
4- This example shows how to fade an LED on pin 9
5- using the analogWrite() function.
4+ This example shows how to fade an LED on pin 9
5+ using the analogWrite() function.
66
7- The analogWrite() function uses PWM, so if
8- you want to change the pin you're using, be
9- sure to use another PWM capable pin. On most
10- Arduino, the PWM pins are identified with
11- a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
7+ The analogWrite() function uses PWM, so if
8+ you want to change the pin you're using, be
9+ sure to use another PWM capable pin. On most
10+ Arduino, the PWM pins are identified with
11+ a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
1212
13- This example code is in the public domain.
13+ This example code is in the public domain.
1414 */
1515
1616int led = 9 ; // the PWM pin the LED is attached to
Original file line number Diff line number Diff line change 11/* Blink without Delay
22
3- Turns on and off a light emitting diode (LED) connected to a digital
4- pin, without using the delay() function. This means that other code
5- can run at the same time without being interrupted by the LED code.
6-
7- The circuit:
8- - Use the onboard LED.
9- - Note: Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
10- it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
11- the correct LED pin independent of which board is used.
12- If you want to know what pin the on-board LED is connected to on your Arduino model, check
13- the Technical Specs of your board at https://www.arduino.cc/en/Main/Products
14-
15- created 2005
16- by David A. Mellis
17- modified 8 Feb 2010
18- by Paul Stoffregen
19- modified 11 Nov 2013
20- by Scott Fitzgerald
21- modified 9 Jan 2017
22- by Arturo Guadalupi
23-
24-
25- This example code is in the public domain.
26-
27- http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
3+ Turns on and off a light emitting diode (LED) connected to a digital
4+ pin, without using the delay() function. This means that other code
5+ can run at the same time without being interrupted by the LED code.
6+
7+ The circuit:
8+ - Use the onboard LED.
9+ - Note: Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
10+ it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
11+ the correct LED pin independent of which board is used.
12+ If you want to know what pin the on-board LED is connected to on your Arduino model, check
13+ the Technical Specs of your board at https://www.arduino.cc/en/Main/Products
14+
15+ created 2005
16+ by David A. Mellis
17+ modified 8 Feb 2010
18+ by Paul Stoffregen
19+ modified 11 Nov 2013
20+ by Scott Fitzgerald
21+ modified 9 Jan 2017
22+ by Arturo Guadalupi
23+
24+
25+ This example code is in the public domain.
26+
27+ http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
2828 */
2929
3030// constants won't change. Used here to set a pin number:
Original file line number Diff line number Diff line change 11/*
22 Button
33
4- Turns on and off a light emitting diode(LED) connected to digital
5- pin 13, when pressing a pushbutton attached to pin 2.
4+ Turns on and off a light emitting diode(LED) connected to digital
5+ pin 13, when pressing a pushbutton attached to pin 2.
66
77
8- The circuit:
9- - LED attached from pin 13 to ground
10- - pushbutton attached to pin 2 from +5V
11- - 10K resistor attached to pin 2 from ground
8+ The circuit:
9+ - LED attached from pin 13 to ground
10+ - pushbutton attached to pin 2 from +5V
11+ - 10K resistor attached to pin 2 from ground
1212
13- - Note: on most Arduinos there is already an LED on the board
14- attached to pin 13.
13+ - Note: on most Arduinos there is already an LED on the board
14+ attached to pin 13.
1515
1616
17- created 2005
18- by DojoDave <http://www.0j0.org>
19- modified 30 Aug 2011
20- by Tom Igoe
17+ created 2005
18+ by DojoDave <http://www.0j0.org>
19+ modified 30 Aug 2011
20+ by Tom Igoe
2121
22- This example code is in the public domain.
22+ This example code is in the public domain.
2323
24- http://www.arduino.cc/en/Tutorial/Button
24+ http://www.arduino.cc/en/Tutorial/Button
2525 */
2626
2727// constants won't change. They're used here to
Original file line number Diff line number Diff line change 11/*
2- Debounce
2+ Debounce
33
4- Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
5- press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's
6- a minimum delay between toggles to debounce the circuit (i.e. to ignore
7- noise).
4+ Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
5+ press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's
6+ a minimum delay between toggles to debounce the circuit (i.e. to ignore
7+ noise).
88
9- The circuit:
10- - LED attached from pin 13 to ground
11- - pushbutton attached from pin 2 to +5V
12- - 10K resistor attached from pin 2 to ground
9+ The circuit:
10+ - LED attached from pin 13 to ground
11+ - pushbutton attached from pin 2 to +5V
12+ - 10K resistor attached from pin 2 to ground
1313
14- - Note: On most Arduino boards, there is already an LED on the board
15- connected to pin 13, so you don't need any extra components for this example.
14+ - Note: On most Arduino boards, there is already an LED on the board
15+ connected to pin 13, so you don't need any extra components for this example.
1616
1717
18- created 21 November 2006
19- by David A. Mellis
20- modified 30 Aug 2011
21- by Limor Fried
22- modified 28 Dec 2012
23- by Mike Walters
24- modified 30 Aug 2016
25- by Arturo Guadalupi
18+ created 21 November 2006
19+ by David A. Mellis
20+ modified 30 Aug 2011
21+ by Limor Fried
22+ modified 28 Dec 2012
23+ by Mike Walters
24+ modified 30 Aug 2016
25+ by Arturo Guadalupi
2626
2727
28- This example code is in the public domain.
28+ This example code is in the public domain.
2929
30- http://www.arduino.cc/en/Tutorial/Debounce
30+ http://www.arduino.cc/en/Tutorial/Debounce
3131 */
3232
3333// constants won't change. They're used here to
Original file line number Diff line number Diff line change 11/*
2- Input Pull-up Serial
2+ Input Pull-up Serial
33
4- This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a
5- digital input on pin 2 and prints the results to the Serial Monitor.
4+ This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a
5+ digital input on pin 2 and prints the results to the Serial Monitor.
66
7- The circuit:
8- - Momentary switch attached from pin 2 to ground
9- - Built-in LED on pin 13
7+ The circuit:
8+ - Momentary switch attached from pin 2 to ground
9+ - Built-in LED on pin 13
1010
11- Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal
12- 20K-ohm resistor is pulled to 5V. This configuration causes the input to
13- read HIGH when the switch is open, and LOW when it is closed.
11+ Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal
12+ 20K-ohm resistor is pulled to 5V. This configuration causes the input to
13+ read HIGH when the switch is open, and LOW when it is closed.
1414
15- created 14 March 2012
16- by Scott Fitzgerald
15+ created 14 March 2012
16+ by Scott Fitzgerald
1717
18- http://www.arduino.cc/en/Tutorial/InputPullupSerial
18+ http://www.arduino.cc/en/Tutorial/InputPullupSerial
1919
20- This example code is in the public domain
20+ This example code is in the public domain
2121
2222 */
2323
Original file line number Diff line number Diff line change 11/*
22 State change detection (edge detection)
33
4- Often, you don't need to know the state of a digital input all the time,
5- but you just need to know when the input changes from one state to another.
6- For example, you want to know when a button goes from OFF to ON. This is called
7- state change detection, or edge detection.
4+ Often, you don't need to know the state of a digital input all the time,
5+ but you just need to know when the input changes from one state to another.
6+ For example, you want to know when a button goes from OFF to ON. This is called
7+ state change detection, or edge detection.
88
9- This example shows how to detect when a button or button changes from off to on
10- and on to off.
9+ This example shows how to detect when a button or button changes from off to on
10+ and on to off.
1111
12- The circuit:
13- - pushbutton attached to pin 2 from +5V
14- - 10K resistor attached to pin 2 from ground
15- - LED attached from pin 13 to ground (or use the built-in LED on
16- most Arduino boards)
12+ The circuit:
13+ - pushbutton attached to pin 2 from +5V
14+ - 10K resistor attached to pin 2 from ground
15+ - LED attached from pin 13 to ground (or use the built-in LED on
16+ most Arduino boards)
1717
18- created 27 Sep 2005
19- modified 30 Aug 2011
20- by Tom Igoe
18+ created 27 Sep 2005
19+ modified 30 Aug 2011
20+ by Tom Igoe
2121
22- This example code is in the public domain.
22+ This example code is in the public domain.
2323
24- http://www.arduino.cc/en/Tutorial/ButtonStateChange
24+ http://www.arduino.cc/en/Tutorial/ButtonStateChange
2525
2626 */
2727
Original file line number Diff line number Diff line change 11/*
22 keyboard
33
4- Plays a pitch that changes based on a changing analog input
4+ Plays a pitch that changes based on a changing analog input
55
6- circuit:
7- - 3 force-sensing resistors from +5V to analog in 0 through 5
8- - 3 10K resistors from analog in 0 through 5 to ground
9- - 8-ohm speaker on digital pin 8
6+ circuit:
7+ - 3 force-sensing resistors from +5V to analog in 0 through 5
8+ - 3 10K resistors from analog in 0 through 5 to ground
9+ - 8-ohm speaker on digital pin 8
1010
11- created 21 Jan 2010
12- modified 9 Apr 2012
13- by Tom Igoe
11+ created 21 Jan 2010
12+ modified 9 Apr 2012
13+ by Tom Igoe
1414
15- This example code is in the public domain.
15+ This example code is in the public domain.
1616
17- http://www.arduino.cc/en/Tutorial/Tone3
17+ http://www.arduino.cc/en/Tutorial/Tone3
1818
1919 */
2020
Original file line number Diff line number Diff line change 11/*
22 Melody
33
4- Plays a melody
4+ Plays a melody
55
6- circuit:
7- - 8-ohm speaker on digital pin 8
6+ circuit:
7+ - 8-ohm speaker on digital pin 8
88
9- created 21 Jan 2010
10- modified 30 Aug 2011
11- by Tom Igoe
9+ created 21 Jan 2010
10+ modified 30 Aug 2011
11+ by Tom Igoe
1212
13- This example code is in the public domain.
13+ This example code is in the public domain.
1414
15- http://www.arduino.cc/en/Tutorial/Tone
15+ http://www.arduino.cc/en/Tutorial/Tone
1616
1717 */
1818#include " pitches.h"
Original file line number Diff line number Diff line change 11/*
22 Multiple tone player
33
4- Plays multiple tones on multiple pins in sequence
4+ Plays multiple tones on multiple pins in sequence
55
6- circuit:
7- - 3 8-ohm speaker on digital pins 6, 7, and 8
6+ circuit:
7+ - 3 8-ohm speaker on digital pins 6, 7, and 8
88
9- created 8 March 2010
10- by Tom Igoe
11- based on a snippet from Greg Borenstein
9+ created 8 March 2010
10+ by Tom Igoe
11+ based on a snippet from Greg Borenstein
1212
13- This example code is in the public domain.
13+ This example code is in the public domain.
1414
15- http://www.arduino.cc/en/Tutorial/Tone4
15+ http://www.arduino.cc/en/Tutorial/Tone4
1616
1717 */
1818
<
32DB
div class="d-flex flex-column gap-2 pt-3 react-comments-container Comment-module__commit-discussion-comments--GlkCu" id="comments">