-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
800e266
commit 36fc9d8
Showing
6 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Day one: | ||
|
||
Use the Barduino to blink an LED. | ||
|
||
Blinking an LED is the *Hello World* of electronics, the first program you upload to check that everything is up and running. No better way to start the challenge than making sure everyting is ok! Easy one to start the challnge :winking_face: | ||
|
||
You can always got to Arduino/File/Examples/01.Basic/Blink, but if you feel a bit more adventurous here you can check a possible solution: | ||
|
||
## Possible solution! | ||
|
||
### Arduino code | ||
|
||
```c++ | ||
// constants won't change. Used here to set a pin number: | ||
const int led = 48; // the LED of the Barduino is connected to pin 48 | ||
|
||
// Variables will change: | ||
int ledState = LOW; // ledState used to set the LED | ||
|
||
// Generally, you should use "unsigned long" for variables that hold time | ||
// The value will quickly become too large for an int to store | ||
unsigned long previousMillis = 0; // will store last time LED was updated | ||
|
||
// constants won't change: | ||
const long interval = 1000; // interval at which to blink (milliseconds) | ||
|
||
void setup() { | ||
// set the digital pin as output: | ||
pinMode(led, OUTPUT); | ||
} | ||
|
||
void loop() { | ||
// check to see if it's time to blink the LED; that is, if the difference | ||
// between the current time and last time you blinked the LED is bigger than | ||
// the interval at which you want to blink the LED. | ||
unsigned long currentMillis = millis(); | ||
|
||
if (currentMillis - previousMillis >= interval) { | ||
// save the last time you blinked the LED | ||
previousMillis = currentMillis; | ||
// if the LED is off turn it on and vice-versa: | ||
if (ledState == LOW) { | ||
ledState = HIGH; | ||
} else { | ||
ledState = LOW; | ||
} | ||
// set the LED with the ledState of the variable: | ||
digitalWrite(led, ledState); | ||
} | ||
} | ||
``` | ||
|
||
## Hero shot | ||
|
||
<video controls autoplay loop style="display: block; margin: auto;"> | ||
<source src="../../../video/day01.mp4" type="video/mp4"> | ||
</video> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Day two: | ||
|
||
Take a selfie with the Barduino. | ||
|
||
We don't want to stress you..! Keep it simple and have a nice monday! :party_popper: | ||
|
||
## Hero shot | ||
|
||
![Day02](../../images/Day02.jpg) |
This file contains 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