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
| /* | |
| * Control an LED using an array. | |
| * | |
| * Create a pattern with LED on and off information in one array, | |
| * and on/off durations in a second array. | |
| * | |
| * | |
| */ | |
| const int ledPin = 7; |
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
| /* | |
| * An example of how to create an use an array of integers | |
| * We'll declare an array of 5 integers. | |
| * We'll print the contents in the serial monitor. | |
| * We'll do some calculations, store the results, and print the results in the serial monitor. | |
| * | |
| */ | |
| int my_integers[6] = {1, 2, 3, 4, 5} ; // We want this array to contain 5 integers, | |
| // so we'll declare it with size 6. |
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
| /* | |
| * An example of how to create an use an array of chars | |
| * We'll declare an array of 5 chars. | |
| * We'll print the contents in the serial monitor. | |
| * | |
| * The table of ASCII character from https://en.wikipedia.org/wiki/ASCII | |
| * is useful. | |
| * | |
| */ |
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
| /* | |
| * Control an LED using an array, like in example 3, but the | |
| * pattern is configurable. | |
| * | |
| * Create a pattern with LED on and off information in one array, | |
| * and on/off durations in a second array. | |
| * | |
| * | |
| */ |
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
| #include <SPI.h> | |
| #include "nRF24L01.h" | |
| #include "RF24.h" | |
| class RF24Test: public RF24 | |
| { | |
| public: RF24Test(int a, int b): RF24(a,b) {} | |
| }; | |
| RF24Test radio(9,10); |
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
| // give a name to the pin to which the LED is connected: | |
| int led = 9; | |
| // the setup routine runs once when you press reset: | |
| void setup() { | |
| // initialize the digital pin as an output. | |
| pinMode(led, OUTPUT); | |
| } | |
| // the loop routine runs over and over again forever: |
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 led = 9; // the pin that the LED is attached to | |
| int brightness = 0; // the bigger this number, the brighter the LED is | |
| int fadeAmount = 5; // the bigger this number, the faster the the LED will fade on or off | |
| // the setup routine runs once when you press reset: | |
| void setup() { | |
| pinMode(led, OUTPUT); // declare pin 9 to be an output: | |
| } | |
| // the loop routine runs over and over again forever: |
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
| // Line Sensor Breakout - Analog | |
| int out; | |
| void setup() | |
| { | |
| Serial.begin(9600); // sets the serial port to 9600 | |
| } | |
| void loop() | |
| { |
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
| // the setup function runs once when you press reset: | |
| void setup() { | |
| // initialize serial communication at 9600 bits per second: | |
| Serial.begin(9600); | |
| } | |
| // the loop routine runs over and over again forever: | |
| void loop() { | |
| // read the input on analog pin 0: | |
| int sensorValue = analogRead(A0); | |
| // print out the value you read: |
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 out; | |
| void setup() | |
| { | |
| Serial.begin(9600); // sets the serial port to 9600 | |
| } | |
| void loop() | |
| { | |
| out = analogRead(0); // read analog input pin 0 |