This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * ref_vs_pointers | |
| * A sketch written to help people understand the use of references and pointers | |
| * Written by Peter Dalmaris, April 8 2016. | |
| * Arduino Tips and Tricks | |
| * txplore.com | |
| * | |
| * Requirements: MemoryFree from https://github.com/McNeight/MemoryFree | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * multitasking_demo | |
| * A sketch written to help people understand how to implement basic multitasking on the Arduino | |
| * Written by Peter Dalmaris, April 21 2016. | |
| * Arduino Tips and Tricks | |
| * txplore.com | |
| * | |
| * Requirements: An Arduino, two LEDs, two 220Ohm resistors, a breadboard, wires. | |
| * Play around with the variables in lines 18 to 26 to create different light show patterns. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * | |
| * This sketch demonstrates the use of the | |
| * Scheduler library. | |
| * | |
| * To use, you will need an Arduino Due or Zero, | |
| * four LEDs, four 220Ohm resistors, jumper wires | |
| * and a breadboard. | |
| * Connect the LEDs to a resistor, and the resistors | |
| * to pins 11, 10, 9, 8 on the Due. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup(){ | |
| Serial.begin(9600); | |
| } | |
| void loop (){ | |
| a_function(); | |
| // Serial.print("In loop: "); | |
| // Serial.println(local_variable); // local_variable is out of scope so compilation will produce an error message | |
| delay(1000); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int local_variable = 0; | |
| void setup(){ | |
| Serial.begin(9600); | |
| } | |
| void loop (){ | |
| a_function(); | |
| Serial.print("In loop: "); | |
| Serial.println(local_variable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int local_variable = 0; | |
| void setup(){ | |
| Serial.begin(9600); | |
| } | |
| void loop (){ | |
| a_function(); | |
| Serial.print("In loop: "); | |
| Serial.println(local_variable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup(){ | |
| Serial.begin(9600); | |
| } | |
| void loop (){ | |
| a_function(); | |
| // Serial.print("In loop: "); | |
| // Serial.println(local_variable); // local_variable is out of scope so compilation will produce an error message | |
| delay(1000); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int a; //A variable which is also access by an interrupt service routine | |
| void setup(){ | |
| } | |
| void loop(){ | |
| a = 1; | |
| int b; | |
| b = a + 1; | |
| Serial.println(b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| volatile int a; //A variable which is also access by an interrupt service routine | |
| void loop(){ | |
| a = 1; | |
| int b; | |
| b = a + 1; | |
| Serial.println(b); | |
| } | |
| void isr0 () { | |
| detachInterrupt(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // In this file I want to show how to create an array of a struct for the Arduino. | |
| // I create a struct that contains ints for RGB color components. | |
| // Then, I create an array of this struct, and use it to display a color | |
| // show on an Adafruit 40 RGB LED shield array. | |
| // Check out my Arduino blog at txplore.com, and my video courses at txplore.tv! | |
| #include <Adafruit_NeoPixel.h> | |
| #ifdef __AVR__ | |
| #include <avr/power.h> |