diff --git a/docs/images/Day02-2023.jpg b/docs/images/Day02-2023.jpg new file mode 100644 index 0000000..f032a5c Binary files /dev/null and b/docs/images/Day02-2023.jpg differ diff --git a/docs/images/Day02.jpg b/docs/images/Day02.jpg index f032a5c..68fb432 100644 Binary files a/docs/images/Day02.jpg and b/docs/images/Day02.jpg differ diff --git a/docs/index.md b/docs/index.md index 1a8cedd..75948ab 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,8 +11,7 @@ hide: 1. :light_bulb: !!! tip annotate "2. Say cheeeeese! :cheese: (1)" - Day 02 - [](solutions/02/02.md) + [Day 02](solutions/02/02.md) 1. Be creative !!! bug annotate "3. Sticker Challenge (1)" diff --git a/docs/solutions/01/01.md b/docs/solutions/01/01.md new file mode 100644 index 0000000..23bb568 --- /dev/null +++ b/docs/solutions/01/01.md @@ -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 + + \ No newline at end of file diff --git a/docs/solutions/02/02.md b/docs/solutions/02/02.md new file mode 100644 index 0000000..8dcc728 --- /dev/null +++ b/docs/solutions/02/02.md @@ -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) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index e4a41a6..2216665 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -14,7 +14,7 @@ nav: - howto.md - Solutions: - Day 1: solutions/01/01.md - #- Day 2: solutions/02/02.md + - Day 2: solutions/02/02.md #- Day 3: solutions/03/03.md #- Day 4: solutions/04/04.md #- Day 5: solutions/05/05.md