diff --git a/404.html b/404.html index c0225d7..2876cab 100644 --- a/404.html +++ b/404.html @@ -893,6 +893,27 @@ + + + + + + +
  • + + + + + Day 15 + + + + +
  • + + + + diff --git a/barduino/index.html b/barduino/index.html index 3c7ff4b..3028513 100644 --- a/barduino/index.html +++ b/barduino/index.html @@ -916,6 +916,27 @@ + + + + + + +
  • + + + + + Day 15 + + + + +
  • + + + + diff --git a/howto/index.html b/howto/index.html index 90c98f8..d4a375e 100644 --- a/howto/index.html +++ b/howto/index.html @@ -973,6 +973,27 @@ + + + + + + +
  • + + + + + Day 15 + + + + +
  • + + + + diff --git a/images/OTGMode.png b/images/OTGMode.png new file mode 100644 index 0000000..edca1e0 Binary files /dev/null and b/images/OTGMode.png differ diff --git a/index.html b/index.html index 9eb99e8..67958cf 100644 --- a/index.html +++ b/index.html @@ -914,6 +914,27 @@ + + + + + + +
  • + + + + + Day 15 + + + + +
  • + + + + @@ -1130,6 +1151,7 @@

    Adventronics Calendar Challenge

    15. Keyboard (1)

    +

    Day 15

    1. UP RIGHT DOWN LEFT
    2. diff --git a/search/search_index.json b/search/search_index.json index 99600f8..ff43db5 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Adventronics Calendar Challenge","text":"

      1. Light me up! (1)

      Day 01

      2. Say cheeeeese! (1)

      Day 02

      1. Be creative

      3. Sticker Challenge (1)

      Day 03

      1. Let's see your graphic design skills

      4. Talk morse to me (1)

      Day 04

      1. -... .- .-. -.. ..- .. -. ---

      5. Jingle Bells! (1)

      Day 05

      1. Sing with me

      6. Barduino wishes you a Merry Christmas! (1)

      Day 06

      1. Don't forget the stamp

      7. Pianino (1)

      Day 07

      1. Play me!

      8. Will you get the lowest temperature? (1)

      Day 08

      1. Challenge accepted

      9. LED's get artistic (1)

      Day 09

      1. Try using one of those apps: Iphone Android

      10. Can you imagine the new Barduino? (1)

      Day 10

      1. How it should be?

      11. Christmas lights (1)

      Day 11

      1. Colorful lights

      12. Ligth a candle in the dark (1)

      Day 12

      1. Try using the light sensor...

      13. Visual effects (1)

      Day 13

      1. Maybe with p5js?

      14. Dress me up (1)

      Day 14

      1. Protect me

      15. Keyboard (1)

      1. UP RIGHT DOWN LEFT

      16. Let's play! (1)

      1. Can I be the controller?

      17. How AI imagines me? (1)

      1. A picture is worth a thousand words

      18. How is the weather? (1)

      1. Check this API

      19. Let's party! (1)

      20. Change my name (1)

      1. How should I be called in the future?

      21. ChatGPT can you help me write a Cristmas card? (1)

      1. From the Barduino?

      22. Let's send it to someone (1)

      1. From Barduino with love

      23. Barduino meets traditions (1)

      1. Make me feel part of the family

      24. Caga tioino (1)

      1. Don't forget I'm from Barcelona!

      Made with from Fablab Barcelona

      "},{"location":"barduino/","title":"Barduino","text":"

      Here you can find a bit more info about the Barduino.

      "},{"location":"howto/","title":"How to participate","text":"

      Embark on a dynamic journey with our Adventronics Calendar \u2013 an electrifying twist on the traditional advent calendar! Instead of the usual sweet treats, each of the 24 windows reveals a challenge centered around the Barduino. Every day we will share with you in this page more details of the challenge and a possible solution, but be creative with your own solutions. These challenges encompass coding, design, and entertaining activities that you can seamlessly weave into your December routine. While the first five participants to finish the challenge will earn a coveted Barduino sweatshirt*, the true essence lies in the joy of learning, the thrill of tackling electronics, and the camaraderie of sharing your experiences with fellow participants.

      "},{"location":"howto/#progress","title":"Progress","text":"

      To track your progress, share a video or photo in our dedicated Telegram group using the hashtag #AdventronicsDay followed by the day's number (e.g., #AdventronicsDay05). Utilize this group to seek guidance, pose questions, and exchange insights with the vibrant community of participants. Get ready for 24 days of innovation, learning, and festive fun!

      "},{"location":"howto/#social-media","title":"Social media","text":"

      You can share it on social media tagging @fablabbcn and using the hashtag #adventronics and/or #barduino and we will repost so we can have a collection of challenges.

      "},{"location":"howto/#schedule","title":"Schedule","text":"

      Every morning the exercise for the day will be explained in this page and an example will be proposed.

      * If there is less than 5 finishers, the prize will be given to the ones with more challenges done if they completed more than 12.

      "},{"location":"template/","title":"Solution template","text":"

      This is a colaborative repo. We will upload a possible solution, but there are many possibilities. If you want to upload your own solution, please follow this template and you can contact us or do a pull request to upload it to the repo in the correct folder solutions/day#.

      "},{"location":"template/#title","title":"Title","text":""},{"location":"template/#description","title":"Description","text":"

      Describe in a few lines which is your soution and the idea behind it.

      "},{"location":"template/#hardware-optional","title":"Hardware (Optional)","text":"

      If you have more hardware than the Barduino, explain what did you use and how to connect it to the board.

      "},{"location":"template/#arduino-libraries-optional","title":"Arduino Libraries (optional)","text":"

      You may have used some libraries to make it work, please link them here.

      "},{"location":"template/#arduino-code","title":"Arduino code","text":"
      Paste your code here and commented if you want.\n
      "},{"location":"template/#hero-shot","title":"Hero shot","text":"

      Upload a short video or image of the final result.

      "},{"location":"template/#explanation-optional","title":"Explanation (optional)","text":"

      Explain your code here.

      "},{"location":"solutions/01/01/","title":"Day one:","text":"

      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

      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:

      "},{"location":"solutions/01/01/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/01/01/#arduino-code","title":"Arduino code","text":"
      // constants won't change. Used here to set a pin number:\nconst int led = 48;  // the LED of the Barduino is connected to pin 48\n\n// Variables will change:\nint ledState = LOW;  // ledState used to set the LED\n\n// Generally, you should use \"unsigned long\" for variables that hold time\n// The value will quickly become too large for an int to store\nunsigned long previousMillis = 0;  // will store last time LED was updated\n\n// constants won't change:\nconst long interval = 1000;  // interval at which to blink (milliseconds)\n\nvoid setup() {\n  // set the digital pin as output:\n  pinMode(led, OUTPUT);\n}\n\nvoid loop() {\n  // check to see if it's time to blink the LED; that is, if the difference\n  // between the current time and last time you blinked the LED is bigger than\n  // the interval at which you want to blink the LED.\n  unsigned long currentMillis = millis();\n\n  if (currentMillis - previousMillis >= interval) {\n    // save the last time you blinked the LED\n    previousMillis = currentMillis;\n    // if the LED is off turn it on and vice-versa:\n    if (ledState == LOW) {\n      ledState = HIGH;\n    } else {\n      ledState = LOW;\n    }\n    // set the LED with the ledState of the variable:\n    digitalWrite(led, ledState);\n  }\n}\n
      "},{"location":"solutions/01/01/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/02/02/","title":"Day two:","text":"

      Take a selfie with the Barduino.

      We don't want to stress you..! Keep it simple and have a nice weekend!

      "},{"location":"solutions/02/02/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/03/03/","title":"Day three:","text":"

      Barduino sticker contest!

      Today we want to test your graphic design skills...

      1. Design a Barduino sticker (it can be related to Adventronics or just the Barduino)
      2. Upload your design to the Telegram group
      3. Vote for your favourite designs adding a reaction to the message (you can vote for 3 proposals)
      4. The poll will be open until Wednesday 6 of December.
      5. On Thursday we will announce the winner and all the participants will have one!

      Here you can find some SVG's of the Barduino.

      Good luck!

      We reserve the right to reject a proposal if we consider it not appropiate.

      "},{"location":"solutions/03/03/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/04/04/","title":"Day four:","text":"

      Communicate using morse code using the Barduino.

      dot dot dash... Use your resources to encode a message, and try to decode the rest of messages!

      Here is my solution, using the LED and the buzzer. Try to do it yourself first, and check this one if you don't manage.

      "},{"location":"solutions/04/04/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/04/04/#arduino-code","title":"Arduino code","text":"
      const int led = 48;\nconst int buzzer = 14;\nconst int freq = 800;\n\nconst int wait = 200;  // Duration of a unit\n\nString message = \"Bon dia Pere\";\n\nvoid setup() {\n  pinMode(led, OUTPUT);\n  ledcAttachPin(buzzer, 1);\n  //pinMode(buzzer, OUTPUT);\n  Serial.begin(115200);\n  delay(2000); //wait 2 seconds to start transmitting\n\n  for (int i = 0; i < message.length(); i++) {\n    char letter = toLowerCase(message[i]);\n    Serial.print(letter);\n    morse(letter);\n    delay(wait * 2);  // wait 3 units if time after each character (1 in each letter and 2 here)\n\n  }\n}\n\nvoid loop() {\n}\n\nvoid dot() {\n  digitalWrite(led, HIGH);\n  ledcWriteTone(1, freq);\n  delay(wait);\n  digitalWrite(led, LOW);\n  ledcWriteTone(1, 0);\n  delay(wait);  //space between parts of a letter\n}\n\nvoid dash() {\n  digitalWrite(led, HIGH);\n  ledcWriteTone(1, freq);\n  delay(wait * 3);  // A dash are 3 dots\n  digitalWrite(led, LOW);\n  ledcWriteTone(1, 0);\n  delay(wait);  //space between parts of a letter\n}\n\nvoid morse(char letter) {\n  switch (letter) {\n    case 'a':\n      dot();\n      dash();\n      break;\n    case 'b':\n      dash();\n      dot();\n      dot();\n      dot();\n      break;\n    case 'c':\n      dash();\n      dot();\n      dash();\n      dot();\n      break;\n    case 'd':\n      dash();\n      dot();\n      dot();\n      break;\n    case 'e':\n      dot();\n      break;\n    case 'f':\n      dot();\n      dot();\n      dash();\n      dot();\n      break;\n    case 'g':\n      dash();\n      dash();\n      dot();\n      break;\n    case 'h':\n      dot();\n      dot();\n      dot();\n      dot();\n      break;\n    case 'i':\n      dot();\n      dot();\n      break;\n    case 'j':\n      dot();\n      dash();\n      dash();\n      dash();\n      break;\n    case 'k':\n      dash();\n      dot();\n      dash();\n      break;\n    case 'l':\n      dot();\n      dash();\n      dot();\n      dot();\n      break;\n    case 'm':\n      dash();\n      dash();\n      break;\n    case 'n':\n      dash();\n      dot();\n      break;\n    case 'o':\n      dash();\n      dash();\n      dash();\n      break;\n    case 'p':\n      dot();\n      dash();\n      dash();\n      dot();\n      break;\n    case 'q':\n      dash();\n      dash();\n      dot();\n      dash();\n      break;\n    case 'r':\n      dot();\n      dash();\n      dot();\n      break;\n    case 's':\n      dot();\n      dot();\n      dot();\n      break;\n    case 't':\n      dash();\n      break;\n    case 'u':\n      dot();\n      dot();\n      dash();\n      break;\n    case 'v':\n      dot();\n      dot();\n      dot();\n      dash();\n      break;\n    case 'w':\n      dot();\n      dash();\n      dash();\n      break;\n    case 'x':\n      dash();\n      dot();\n      dot();\n      dash();\n      break;\n    case 'y':\n      dash();\n      dot();\n      dash();\n      dash();\n      break;\n    case 'z':\n      dash();\n      dash();\n      dot();\n      dot();\n      break;\n    case '0':\n      dash();\n      dash();\n      dash();\n      dash();\n      dash();\n      break;\n    case '1':\n      dot();\n      dash();\n      dash();\n      dash();\n      dash();\n      break;\n    case '2':\n      dot();\n      dot();\n      dash();\n      dash();\n      dash();\n      break;\n    case '3':\n      dot();\n      dot();\n      dot();\n      dash();\n      dash();\n      break;\n    case '4':\n      dot();\n      dot();\n      dot();\n      dot();\n      dash();\n      break;\n    case '5':\n      dot();\n      dot();\n      dot();\n      dot();\n      dot();\n      break;\n    case '6':\n      dash();\n      dot();\n      dot();\n      dot();\n      dot();\n      break;\n    case '7':\n      dash();\n      dash();\n      dot();\n      dot();\n      dot();\n      break;\n    case '8':\n      dash();\n      dash();\n      dash();\n      dot();\n      dot();\n      break;\n    case '9':\n      dash();\n      dash();\n      dash();\n      dash();\n      dot();\n      break;\n    case ' ':\n      delay(wait * 5);  //wait 7 units of time if there is a space (1 from the last character, 5 here and 1 in the loop)\n    default:\n      break;\n  }\n}\n
      "},{"location":"solutions/04/04/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/05/05/","title":"Day five:","text":"

      Play a Christmas carol (or a song you like) using the Barduino.

      Time to make some music! Use the buzzer (or any other thing!) to make some music, the idea is to play a Christmas carol. As we come from many different places, try to play one from your hometown, to have a nice collection of tunes

      Here is my version of A Betlem m'en vull anar

      "},{"location":"solutions/05/05/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/05/05/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n\nnote_t notes[] = { NOTE_E, NOTE_F, NOTE_G, NOTE_G, NOTE_C, NOTE_A, NOTE_G, NOTE_MAX, NOTE_F, NOTE_E, NOTE_D, NOTE_E, NOTE_F, NOTE_G, NOTE_E, NOTE_C, NOTE_E, NOTE_F, NOTE_G, NOTE_G, NOTE_C, NOTE_A, NOTE_G, NOTE_MAX, NOTE_F, NOTE_E, NOTE_D, NOTE_F, NOTE_E, NOTE_G, NOTE_C };\n//int notes2[] = {E, F, G, G, c, A, G, M, F, E, D, E, F, G, E, C, E, F, G, G, c, A, G, M, F, E, D, F, E, G, C};\nint tempos[] = { 1, 1, 2, 2, 2, 2, 4, 2, 1, 1, 2, 2, 2, 2, 4, 2, 1, 1, 2, 2, 2, 2, 4, 2, 1, 1, 2, 2, 2, 2, 4 };\nint octave[] = { 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 };\n\nconst int buzzer = 14;\nconst int tempo = 130;\n\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint hue = 0;\nint hueInterval = 65535 / 31;\n\nvoid setup() {\n  ledcAttachPin(buzzer, 1);\n  Serial.begin(115200);\n  for (int i = 0; i < 31; i++) {\n    if (notes[i] != NOTE_MAX) {\n      ledcWriteNote(1, notes[i], octave[i]);\n    } else {\n      ledcWriteTone(1, 0);\n    }\n    pixels.setPixelColor(0, pixels.ColorHSV(hue, 255, 255));\n    pixels.show();\n    hue = hue + hueInterval;\n    delay(tempo * tempos[i]);\n  }\n  ledcWriteTone(1, 0);\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, 0, 0));\n  pixels.show();\n}\n\nvoid loop() {\n}\n
      "},{"location":"solutions/05/05/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/06/06/","title":"Day six:","text":"

      Sending Christmas cards it's a classic, you have to make sure you send them on time for Christmas (yes, an email is faster, but in paper is something cute and by email it's just spam... and you know it!). So we wanted to help you, the challenge today it's just to create a Christmas postcard with the Barduino on it!

      Extra points if you send them in paper!

      "},{"location":"solutions/06/06/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/07/07/","title":"Day seven:","text":"

      Make an instrument wit the Barduino.

      2 days ago you played some preprogrammed tunes, but now it's time to read some inputs and make sounds acording to them! Be creative, you can play with the different inputs...

      Here is my solution, playing notes with the touch pads reacting to light! I ave to practice a lot more...

      "},{"location":"solutions/07/07/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/07/07/#arduino-code","title":"Arduino code","text":"
      const int buzzer = 14;\nint pressed = 0;\n\nconst int photo = 3;\nconst int threshold = 27000;\n\nunsigned long values[] = {0,0,0,0};\nint playing = 0;\n\nnote_t notes[] = {NOTE_C, NOTE_D, NOTE_E, NOTE_F, NOTE_G, NOTE_A, NOTE_B};\n\nvoid setup() {\n  ledcAttachPin(buzzer, 1);\n  pinMode(photo, INPUT);\n  Serial.begin(115200);\n}\n\nvoid loop() {\n  unsigned long max = 0;\n  int max_i;\n  for (int i=0; i<4; i++){\n    values[i] = touchRead(i+4);\n    //Serial.println(values[i]);\n    if (values[i] > max){\n      max = values[i];\n      max_i = i;\n    }\n  }\n  if (max > threshold && playing != max_i + 4){\n    playing = max_i + 4;\n    int val = map(analogRead(photo), 0, 4095, 0, 35);\n    //int val = 33;\n    Serial.println(val%7);\n    int note = val%7+max_i;\n    int oct = (val/7)+2;\n    if (note > 7){\n      note = note - 7;\n      oct = oct + 1;\n    }\n\n    Serial.print(\"Note: \");\n    Serial.print(note);\n    Serial.print(\"  Oct: \");\n    Serial.println(oct);\n    ledcWriteNote(1, notes[note], oct);\n  }\n  else if (max <= threshold && playing != 0){\n    Serial.println(\"off\");\n    playing = 0;\n    ledcWriteTone(1, 0);\n  }\n}\n
      "},{"location":"solutions/07/07/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/08/08/","title":"Day eight:","text":"

      Challenge!! Who will get the lowest temperature?

      Use the temperature sensor to win, upload a picture of the temperature printed on Serial and a picture of the situation. It's not allowed to put the Barduino in the fridge... \ud83d\ude1c Give it some time for the temperature to stabilize, it can take up to 15 minutes.

      Tip, you can power the board with you phone and read the Serial there with an app in Android (I don't know if that's possible with iPhones).

      "},{"location":"solutions/08/08/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/08/08/#arduino-code","title":"Arduino code","text":"
      #include <Temperature_LM75_Derived.h>\n\nTI_TMP102 temperature;\n\nconst int push = 0;\nbool pressed = false;\n\nvoid setup() {\n  pinMode(push, INPUT);\n  Serial.begin(115200);\n  Wire.begin();\n}\n\nvoid loop() {\n  if (!digitalRead(push) && !pressed) {\n    pressed = true;\n    Serial.print(\"Temperature = \");\n    Serial.print(temperature.readTemperatureC());\n    Serial.println(\" C\");\n  } else if (digitalRead(push)) {\n    pressed = false;\n  }\n}\n
      "},{"location":"solutions/08/08/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/09/09/","title":"Day nine:","text":"

      LED's get artistic..! Today's callenge is to do light painting using the Barduino. You can use the Neopixel to get different colors!

      To capture the image you can use this apps for Android and Iphone.

      "},{"location":"solutions/09/09/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/09/09/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nconst int but = 0;\n\nint state = 0;\nbool pressed = 0;\nbool color = false;\n\nint hue = 0;\n\nvoid setup() {\n  pixels.begin();\n  pixels.setBrightness(64);\n  pinMode(but, INPUT);\n}\n\nvoid loop() {\n  if (!digitalRead(but) && !pressed) {\n    pressed = true;\n    color = !color;\n    if (color) {\n      state = state + 1;\n      if (state > 4) {\n        state = 0;\n      }\n      Serial.println(state);\n    }\n  } else if (digitalRead(but)) {\n    pressed = false;\n  }\n  if (color) {\n    switch (state) {\n      case 0:\n        pixels.setPixelColor(0, pixels.Color(255, 0, 0));\n        break;\n      case 1:\n        pixels.setPixelColor(0, pixels.Color(255, 200, 0));\n        break;\n      case 2:\n        pixels.setPixelColor(0, pixels.Color(255, 255, 255));\n        break;\n      case 3:\n        pixels.setPixelColor(0, pixels.Color(0, 255, 0));\n        break;\n      case 4:\n        pixels.setPixelColor(0, 0, 0, 255);\n        break;\n      default:\n        break;\n    }\n  } else {\n    pixels.setPixelColor(0, 0, 0, 0);\n  }\n  pixels.show();\n}\n
      "},{"location":"solutions/09/09/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/10/10/","title":"Day ten:","text":"

      New Barduino coocreation! We are very happy on how the Barduino is working, but there is always space for improving. We would like to know how do you imagine the Barduino 4.1, the next version of the Barduino. Creat an sketch of your ideal board, showing what you miss on the Barduino or what would you add to it to make it even better. You can change the shape and pins, just be creative and imagine everything is possible. You can share an image of a sketch and a explanation of your ideas.

      Here is my sketch, I imagine a Barduino with the shape of Fablab Barcelona logo, with a very simple base board where you can connect different stacking shields, and extend it using I2C and/or SPI connections on the sides like a puzzle piece. Let's see which ideas you have, an maybe we will make the Barduino 4.1 based on your ideas!

      "},{"location":"solutions/10/10/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/11/11/","title":"Day eleven:","text":"

      Let's light up the Barduinos! Winter Holidays are always full of lights, why not we use the Barduino to create our own? Use the neopixel and your creativity to make a nice light animation to celebrate this days!

      "},{"location":"solutions/11/11/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/11/11/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint hue = 0;\nint saturation = 255;\nint value = 0;\n\nint state = 0;\n\nint increment = 5;\nint speed = 5;\n\n\nvoid setup() {\n  pixels.begin();\n}\n\nvoid loop() {\n  value = value + increment;\n  if (value >= 255) {\n    value = 255;\n    increment = -increment;\n  } else if (value <= 0) {\n    value = 0;\n    increment = -increment;\n    speed = random(5, 30);\n    ++state;\n    if (state == 1) {\n      hue = 21845;\n    } else if (state == 2) {\n      hue = 43690;\n    } else if (state == 3) {\n      hue = 10922;\n    } else {\n      state = 0;\n      hue = 0;\n    }\n  }\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, saturation, value));\n  pixels.show();\n  delay(speed);\n}\n
      "},{"location":"solutions/11/11/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/12/12/","title":"Day twelve:","text":"

      Use the light sensor to detect when to light up your Barduino as a candle. There is nothing more \"Chritsmasy\" than the light of a candle, with family, friends or just te blanket on the sofa. Use the Barduino as a candle? Why not!

      The idea is to make it automatic, so when it detects a low level of light it will light up simulating a candle, you will need to create a nice animation with the neopixel (don't try to light it up on fire...)

      "},{"location":"solutions/12/12/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/12/12/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint pt = 3;\n\nint hue = 0;\nint saturation = 255;\nint value = 0;\n\nint maxVal = 100;\nint minVal = 50;\n\nint increment = 5;\nint speed = 5;\n\nint treshold = 500;\n\n\nvoid setup() {\n  pixels.begin();\n  Serial.begin(115200);\n  pinMode(pt, INPUT);\n}\n\nvoid loop() {\n  int light = analogRead(pt);\n  Serial.println(light);\n  if (light <= treshold) {\n    int brightness = 255;\n    candle(brightness);\n  } else {\n    pixels.setPixelColor(0, pixels.ColorHSV(hue, saturation, 0));\n    pixels.show();\n    delay(500);\n  }\n}\n\nvoid candle(int brightness) {\n  pixels.setBrightness(brightness);\n  value = value + increment;\n  if (value >= maxVal) {\n    value = maxVal;\n    increment = -random(1, 5);\n  } else if (value <= minVal) {\n    value = minVal;\n    increment = random(1, 5);\n    speed = random(10, 30);\n    hue = random(2000, 4000);\n  }\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, saturation, value));\n  pixels.show();\n  delay(speed);\n}\n
      "},{"location":"solutions/12/12/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/13/13/","title":"Day thirteen:","text":"

      Connect you Barduino with somthing else than the Serial Monitor. Today is about expanding the Barduino, using other tools to visualize what's happenning in your board. A nice option is p5js, but feel free to use any other tool!

      Tip, the simplest way to do so is using Serial communication, but you can try other things like Bluetooth, MQTT or publishing a web page from the ESP32.

      "},{"location":"solutions/13/13/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/13/13/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint hue = 1;\n\nconst int but = 0;\nconst int R = 5;\nconst int L = 7;\n\nconst int treshold = 30000;\n\nbool pressed = false;\n\nvoid setup() {\n  pixels.begin();\n  pixels.setBrightness(100);\n  Serial.begin(115200);\n}\n\nvoid loop() {\n  if (touchRead(R) > treshold && touchRead(R) >touchRead(L)){\n    hue = hue + 100;\n    delay(10);\n  }\n  else if (touchRead(L) > treshold && touchRead(L) >touchRead(R)){\n    hue = hue - 100;\n    delay(10);\n  }\n  if (hue < 1){\n    hue = 65535;\n  }\n  else if (hue >= 65535){\n    hue = 1;\n  }\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, 255, 255));\n  pixels.show();\n  if (!digitalRead(but) && !pressed){\n    pressed = true;\n    Serial.println(hue);\n  }\n  else if (digitalRead(but)){\n    pressed = false;\n  }\n}\n
      "},{"location":"solutions/13/13/#p5js","title":"P5js","text":""},{"location":"solutions/13/13/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/14/14/","title":"Day fourteen:","text":"

      Let's test your 3D design skills! Desgin an enclousure to secure the Barduino but alowing te user to use it's features. Extra points for the ones who actualy fabricates it!

      Tip, use this SVG files to get the exact measurements of the board.

      "},{"location":"solutions/14/14/#possible-solution","title":"Possible solution!","text":"

      Here you can find the Rhino 6 file and the STL file. There are some thing's that needs to get adjusted, like a hole for the antenna and bring the usb hole higher.

      "},{"location":"solutions/14/14/#hero-shot","title":"Hero shot","text":""}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Adventronics Calendar Challenge","text":"

      1. Light me up! (1)

      Day 01

      2. Say cheeeeese! (1)

      Day 02

      1. Be creative

      3. Sticker Challenge (1)

      Day 03

      1. Let's see your graphic design skills

      4. Talk morse to me (1)

      Day 04

      1. -... .- .-. -.. ..- .. -. ---

      5. Jingle Bells! (1)

      Day 05

      1. Sing with me

      6. Barduino wishes you a Merry Christmas! (1)

      Day 06

      1. Don't forget the stamp

      7. Pianino (1)

      Day 07

      1. Play me!

      8. Will you get the lowest temperature? (1)

      Day 08

      1. Challenge accepted

      9. LED's get artistic (1)

      Day 09

      1. Try using one of those apps: Iphone Android

      10. Can you imagine the new Barduino? (1)

      Day 10

      1. How it should be?

      11. Christmas lights (1)

      Day 11

      1. Colorful lights

      12. Ligth a candle in the dark (1)

      Day 12

      1. Try using the light sensor...

      13. Visual effects (1)

      Day 13

      1. Maybe with p5js?

      14. Dress me up (1)

      Day 14

      1. Protect me

      15. Keyboard (1)

      Day 15

      1. UP RIGHT DOWN LEFT

      16. Let's play! (1)

      1. Can I be the controller?

      17. How AI imagines me? (1)

      1. A picture is worth a thousand words

      18. How is the weather? (1)

      1. Check this API

      19. Let's party! (1)

      20. Change my name (1)

      1. How should I be called in the future?

      21. ChatGPT can you help me write a Cristmas card? (1)

      1. From the Barduino?

      22. Let's send it to someone (1)

      1. From Barduino with love

      23. Barduino meets traditions (1)

      1. Make me feel part of the family

      24. Caga tioino (1)

      1. Don't forget I'm from Barcelona!

      Made with from Fablab Barcelona

      "},{"location":"barduino/","title":"Barduino","text":"

      Here you can find a bit more info about the Barduino.

      "},{"location":"howto/","title":"How to participate","text":"

      Embark on a dynamic journey with our Adventronics Calendar \u2013 an electrifying twist on the traditional advent calendar! Instead of the usual sweet treats, each of the 24 windows reveals a challenge centered around the Barduino. Every day we will share with you in this page more details of the challenge and a possible solution, but be creative with your own solutions. These challenges encompass coding, design, and entertaining activities that you can seamlessly weave into your December routine. While the first five participants to finish the challenge will earn a coveted Barduino sweatshirt*, the true essence lies in the joy of learning, the thrill of tackling electronics, and the camaraderie of sharing your experiences with fellow participants.

      "},{"location":"howto/#progress","title":"Progress","text":"

      To track your progress, share a video or photo in our dedicated Telegram group using the hashtag #AdventronicsDay followed by the day's number (e.g., #AdventronicsDay05). Utilize this group to seek guidance, pose questions, and exchange insights with the vibrant community of participants. Get ready for 24 days of innovation, learning, and festive fun!

      "},{"location":"howto/#social-media","title":"Social media","text":"

      You can share it on social media tagging @fablabbcn and using the hashtag #adventronics and/or #barduino and we will repost so we can have a collection of challenges.

      "},{"location":"howto/#schedule","title":"Schedule","text":"

      Every morning the exercise for the day will be explained in this page and an example will be proposed.

      * If there is less than 5 finishers, the prize will be given to the ones with more challenges done if they completed more than 12.

      "},{"location":"template/","title":"Solution template","text":"

      This is a colaborative repo. We will upload a possible solution, but there are many possibilities. If you want to upload your own solution, please follow this template and you can contact us or do a pull request to upload it to the repo in the correct folder solutions/day#.

      "},{"location":"template/#title","title":"Title","text":""},{"location":"template/#description","title":"Description","text":"

      Describe in a few lines which is your soution and the idea behind it.

      "},{"location":"template/#hardware-optional","title":"Hardware (Optional)","text":"

      If you have more hardware than the Barduino, explain what did you use and how to connect it to the board.

      "},{"location":"template/#arduino-libraries-optional","title":"Arduino Libraries (optional)","text":"

      You may have used some libraries to make it work, please link them here.

      "},{"location":"template/#arduino-code","title":"Arduino code","text":"
      Paste your code here and commented if you want.\n
      "},{"location":"template/#hero-shot","title":"Hero shot","text":"

      Upload a short video or image of the final result.

      "},{"location":"template/#explanation-optional","title":"Explanation (optional)","text":"

      Explain your code here.

      "},{"location":"solutions/01/01/","title":"Day one:","text":"

      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

      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:

      "},{"location":"solutions/01/01/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/01/01/#arduino-code","title":"Arduino code","text":"
      // constants won't change. Used here to set a pin number:\nconst int led = 48;  // the LED of the Barduino is connected to pin 48\n\n// Variables will change:\nint ledState = LOW;  // ledState used to set the LED\n\n// Generally, you should use \"unsigned long\" for variables that hold time\n// The value will quickly become too large for an int to store\nunsigned long previousMillis = 0;  // will store last time LED was updated\n\n// constants won't change:\nconst long interval = 1000;  // interval at which to blink (milliseconds)\n\nvoid setup() {\n  // set the digital pin as output:\n  pinMode(led, OUTPUT);\n}\n\nvoid loop() {\n  // check to see if it's time to blink the LED; that is, if the difference\n  // between the current time and last time you blinked the LED is bigger than\n  // the interval at which you want to blink the LED.\n  unsigned long currentMillis = millis();\n\n  if (currentMillis - previousMillis >= interval) {\n    // save the last time you blinked the LED\n    previousMillis = currentMillis;\n    // if the LED is off turn it on and vice-versa:\n    if (ledState == LOW) {\n      ledState = HIGH;\n    } else {\n      ledState = LOW;\n    }\n    // set the LED with the ledState of the variable:\n    digitalWrite(led, ledState);\n  }\n}\n
      "},{"location":"solutions/01/01/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/02/02/","title":"Day two:","text":"

      Take a selfie with the Barduino.

      We don't want to stress you..! Keep it simple and have a nice weekend!

      "},{"location":"solutions/02/02/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/03/03/","title":"Day three:","text":"

      Barduino sticker contest!

      Today we want to test your graphic design skills...

      1. Design a Barduino sticker (it can be related to Adventronics or just the Barduino)
      2. Upload your design to the Telegram group
      3. Vote for your favourite designs adding a reaction to the message (you can vote for 3 proposals)
      4. The poll will be open until Wednesday 6 of December.
      5. On Thursday we will announce the winner and all the participants will have one!

      Here you can find some SVG's of the Barduino.

      Good luck!

      We reserve the right to reject a proposal if we consider it not appropiate.

      "},{"location":"solutions/03/03/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/04/04/","title":"Day four:","text":"

      Communicate using morse code using the Barduino.

      dot dot dash... Use your resources to encode a message, and try to decode the rest of messages!

      Here is my solution, using the LED and the buzzer. Try to do it yourself first, and check this one if you don't manage.

      "},{"location":"solutions/04/04/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/04/04/#arduino-code","title":"Arduino code","text":"
      const int led = 48;\nconst int buzzer = 14;\nconst int freq = 800;\n\nconst int wait = 200;  // Duration of a unit\n\nString message = \"Bon dia Pere\";\n\nvoid setup() {\n  pinMode(led, OUTPUT);\n  ledcAttachPin(buzzer, 1);\n  //pinMode(buzzer, OUTPUT);\n  Serial.begin(115200);\n  delay(2000); //wait 2 seconds to start transmitting\n\n  for (int i = 0; i < message.length(); i++) {\n    char letter = toLowerCase(message[i]);\n    Serial.print(letter);\n    morse(letter);\n    delay(wait * 2);  // wait 3 units if time after each character (1 in each letter and 2 here)\n\n  }\n}\n\nvoid loop() {\n}\n\nvoid dot() {\n  digitalWrite(led, HIGH);\n  ledcWriteTone(1, freq);\n  delay(wait);\n  digitalWrite(led, LOW);\n  ledcWriteTone(1, 0);\n  delay(wait);  //space between parts of a letter\n}\n\nvoid dash() {\n  digitalWrite(led, HIGH);\n  ledcWriteTone(1, freq);\n  delay(wait * 3);  // A dash are 3 dots\n  digitalWrite(led, LOW);\n  ledcWriteTone(1, 0);\n  delay(wait);  //space between parts of a letter\n}\n\nvoid morse(char letter) {\n  switch (letter) {\n    case 'a':\n      dot();\n      dash();\n      break;\n    case 'b':\n      dash();\n      dot();\n      dot();\n      dot();\n      break;\n    case 'c':\n      dash();\n      dot();\n      dash();\n      dot();\n      break;\n    case 'd':\n      dash();\n      dot();\n      dot();\n      break;\n    case 'e':\n      dot();\n      break;\n    case 'f':\n      dot();\n      dot();\n      dash();\n      dot();\n      break;\n    case 'g':\n      dash();\n      dash();\n      dot();\n      break;\n    case 'h':\n      dot();\n      dot();\n      dot();\n      dot();\n      break;\n    case 'i':\n      dot();\n      dot();\n      break;\n    case 'j':\n      dot();\n      dash();\n      dash();\n      dash();\n      break;\n    case 'k':\n      dash();\n      dot();\n      dash();\n      break;\n    case 'l':\n      dot();\n      dash();\n      dot();\n      dot();\n      break;\n    case 'm':\n      dash();\n      dash();\n      break;\n    case 'n':\n      dash();\n      dot();\n      break;\n    case 'o':\n      dash();\n      dash();\n      dash();\n      break;\n    case 'p':\n      dot();\n      dash();\n      dash();\n      dot();\n      break;\n    case 'q':\n      dash();\n      dash();\n      dot();\n      dash();\n      break;\n    case 'r':\n      dot();\n      dash();\n      dot();\n      break;\n    case 's':\n      dot();\n      dot();\n      dot();\n      break;\n    case 't':\n      dash();\n      break;\n    case 'u':\n      dot();\n      dot();\n      dash();\n      break;\n    case 'v':\n      dot();\n      dot();\n      dot();\n      dash();\n      break;\n    case 'w':\n      dot();\n      dash();\n      dash();\n      break;\n    case 'x':\n      dash();\n      dot();\n      dot();\n      dash();\n      break;\n    case 'y':\n      dash();\n      dot();\n      dash();\n      dash();\n      break;\n    case 'z':\n      dash();\n      dash();\n      dot();\n      dot();\n      break;\n    case '0':\n      dash();\n      dash();\n      dash();\n      dash();\n      dash();\n      break;\n    case '1':\n      dot();\n      dash();\n      dash();\n      dash();\n      dash();\n      break;\n    case '2':\n      dot();\n      dot();\n      dash();\n      dash();\n      dash();\n      break;\n    case '3':\n      dot();\n      dot();\n      dot();\n      dash();\n      dash();\n      break;\n    case '4':\n      dot();\n      dot();\n      dot();\n      dot();\n      dash();\n      break;\n    case '5':\n      dot();\n      dot();\n      dot();\n      dot();\n      dot();\n      break;\n    case '6':\n      dash();\n      dot();\n      dot();\n      dot();\n      dot();\n      break;\n    case '7':\n      dash();\n      dash();\n      dot();\n      dot();\n      dot();\n      break;\n    case '8':\n      dash();\n      dash();\n      dash();\n      dot();\n      dot();\n      break;\n    case '9':\n      dash();\n      dash();\n      dash();\n      dash();\n      dot();\n      break;\n    case ' ':\n      delay(wait * 5);  //wait 7 units of time if there is a space (1 from the last character, 5 here and 1 in the loop)\n    default:\n      break;\n  }\n}\n
      "},{"location":"solutions/04/04/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/05/05/","title":"Day five:","text":"

      Play a Christmas carol (or a song you like) using the Barduino.

      Time to make some music! Use the buzzer (or any other thing!) to make some music, the idea is to play a Christmas carol. As we come from many different places, try to play one from your hometown, to have a nice collection of tunes

      Here is my version of A Betlem m'en vull anar

      "},{"location":"solutions/05/05/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/05/05/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n\nnote_t notes[] = { NOTE_E, NOTE_F, NOTE_G, NOTE_G, NOTE_C, NOTE_A, NOTE_G, NOTE_MAX, NOTE_F, NOTE_E, NOTE_D, NOTE_E, NOTE_F, NOTE_G, NOTE_E, NOTE_C, NOTE_E, NOTE_F, NOTE_G, NOTE_G, NOTE_C, NOTE_A, NOTE_G, NOTE_MAX, NOTE_F, NOTE_E, NOTE_D, NOTE_F, NOTE_E, NOTE_G, NOTE_C };\n//int notes2[] = {E, F, G, G, c, A, G, M, F, E, D, E, F, G, E, C, E, F, G, G, c, A, G, M, F, E, D, F, E, G, C};\nint tempos[] = { 1, 1, 2, 2, 2, 2, 4, 2, 1, 1, 2, 2, 2, 2, 4, 2, 1, 1, 2, 2, 2, 2, 4, 2, 1, 1, 2, 2, 2, 2, 4 };\nint octave[] = { 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 };\n\nconst int buzzer = 14;\nconst int tempo = 130;\n\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint hue = 0;\nint hueInterval = 65535 / 31;\n\nvoid setup() {\n  ledcAttachPin(buzzer, 1);\n  Serial.begin(115200);\n  for (int i = 0; i < 31; i++) {\n    if (notes[i] != NOTE_MAX) {\n      ledcWriteNote(1, notes[i], octave[i]);\n    } else {\n      ledcWriteTone(1, 0);\n    }\n    pixels.setPixelColor(0, pixels.ColorHSV(hue, 255, 255));\n    pixels.show();\n    hue = hue + hueInterval;\n    delay(tempo * tempos[i]);\n  }\n  ledcWriteTone(1, 0);\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, 0, 0));\n  pixels.show();\n}\n\nvoid loop() {\n}\n
      "},{"location":"solutions/05/05/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/06/06/","title":"Day six:","text":"

      Sending Christmas cards it's a classic, you have to make sure you send them on time for Christmas (yes, an email is faster, but in paper is something cute and by email it's just spam... and you know it!). So we wanted to help you, the challenge today it's just to create a Christmas postcard with the Barduino on it!

      Extra points if you send them in paper!

      "},{"location":"solutions/06/06/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/07/07/","title":"Day seven:","text":"

      Make an instrument wit the Barduino.

      2 days ago you played some preprogrammed tunes, but now it's time to read some inputs and make sounds acording to them! Be creative, you can play with the different inputs...

      Here is my solution, playing notes with the touch pads reacting to light! I ave to practice a lot more...

      "},{"location":"solutions/07/07/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/07/07/#arduino-code","title":"Arduino code","text":"
      const int buzzer = 14;\nint pressed = 0;\n\nconst int photo = 3;\nconst int threshold = 27000;\n\nunsigned long values[] = {0,0,0,0};\nint playing = 0;\n\nnote_t notes[] = {NOTE_C, NOTE_D, NOTE_E, NOTE_F, NOTE_G, NOTE_A, NOTE_B};\n\nvoid setup() {\n  ledcAttachPin(buzzer, 1);\n  pinMode(photo, INPUT);\n  Serial.begin(115200);\n}\n\nvoid loop() {\n  unsigned long max = 0;\n  int max_i;\n  for (int i=0; i<4; i++){\n    values[i] = touchRead(i+4);\n    //Serial.println(values[i]);\n    if (values[i] > max){\n      max = values[i];\n      max_i = i;\n    }\n  }\n  if (max > threshold && playing != max_i + 4){\n    playing = max_i + 4;\n    int val = map(analogRead(photo), 0, 4095, 0, 35);\n    //int val = 33;\n    Serial.println(val%7);\n    int note = val%7+max_i;\n    int oct = (val/7)+2;\n    if (note > 7){\n      note = note - 7;\n      oct = oct + 1;\n    }\n\n    Serial.print(\"Note: \");\n    Serial.print(note);\n    Serial.print(\"  Oct: \");\n    Serial.println(oct);\n    ledcWriteNote(1, notes[note], oct);\n  }\n  else if (max <= threshold && playing != 0){\n    Serial.println(\"off\");\n    playing = 0;\n    ledcWriteTone(1, 0);\n  }\n}\n
      "},{"location":"solutions/07/07/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/08/08/","title":"Day eight:","text":"

      Challenge!! Who will get the lowest temperature?

      Use the temperature sensor to win, upload a picture of the temperature printed on Serial and a picture of the situation. It's not allowed to put the Barduino in the fridge... \ud83d\ude1c Give it some time for the temperature to stabilize, it can take up to 15 minutes.

      Tip, you can power the board with you phone and read the Serial there with an app in Android (I don't know if that's possible with iPhones).

      "},{"location":"solutions/08/08/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/08/08/#arduino-code","title":"Arduino code","text":"
      #include <Temperature_LM75_Derived.h>\n\nTI_TMP102 temperature;\n\nconst int push = 0;\nbool pressed = false;\n\nvoid setup() {\n  pinMode(push, INPUT);\n  Serial.begin(115200);\n  Wire.begin();\n}\n\nvoid loop() {\n  if (!digitalRead(push) && !pressed) {\n    pressed = true;\n    Serial.print(\"Temperature = \");\n    Serial.print(temperature.readTemperatureC());\n    Serial.println(\" C\");\n  } else if (digitalRead(push)) {\n    pressed = false;\n  }\n}\n
      "},{"location":"solutions/08/08/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/09/09/","title":"Day nine:","text":"

      LED's get artistic..! Today's callenge is to do light painting using the Barduino. You can use the Neopixel to get different colors!

      To capture the image you can use this apps for Android and Iphone.

      "},{"location":"solutions/09/09/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/09/09/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nconst int but = 0;\n\nint state = 0;\nbool pressed = 0;\nbool color = false;\n\nint hue = 0;\n\nvoid setup() {\n  pixels.begin();\n  pixels.setBrightness(64);\n  pinMode(but, INPUT);\n}\n\nvoid loop() {\n  if (!digitalRead(but) && !pressed) {\n    pressed = true;\n    color = !color;\n    if (color) {\n      state = state + 1;\n      if (state > 4) {\n        state = 0;\n      }\n      Serial.println(state);\n    }\n  } else if (digitalRead(but)) {\n    pressed = false;\n  }\n  if (color) {\n    switch (state) {\n      case 0:\n        pixels.setPixelColor(0, pixels.Color(255, 0, 0));\n        break;\n      case 1:\n        pixels.setPixelColor(0, pixels.Color(255, 200, 0));\n        break;\n      case 2:\n        pixels.setPixelColor(0, pixels.Color(255, 255, 255));\n        break;\n      case 3:\n        pixels.setPixelColor(0, pixels.Color(0, 255, 0));\n        break;\n      case 4:\n        pixels.setPixelColor(0, 0, 0, 255);\n        break;\n      default:\n        break;\n    }\n  } else {\n    pixels.setPixelColor(0, 0, 0, 0);\n  }\n  pixels.show();\n}\n
      "},{"location":"solutions/09/09/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/10/10/","title":"Day ten:","text":"

      New Barduino coocreation! We are very happy on how the Barduino is working, but there is always space for improving. We would like to know how do you imagine the Barduino 4.1, the next version of the Barduino. Creat an sketch of your ideal board, showing what you miss on the Barduino or what would you add to it to make it even better. You can change the shape and pins, just be creative and imagine everything is possible. You can share an image of a sketch and a explanation of your ideas.

      Here is my sketch, I imagine a Barduino with the shape of Fablab Barcelona logo, with a very simple base board where you can connect different stacking shields, and extend it using I2C and/or SPI connections on the sides like a puzzle piece. Let's see which ideas you have, an maybe we will make the Barduino 4.1 based on your ideas!

      "},{"location":"solutions/10/10/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/11/11/","title":"Day eleven:","text":"

      Let's light up the Barduinos! Winter Holidays are always full of lights, why not we use the Barduino to create our own? Use the neopixel and your creativity to make a nice light animation to celebrate this days!

      "},{"location":"solutions/11/11/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/11/11/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint hue = 0;\nint saturation = 255;\nint value = 0;\n\nint state = 0;\n\nint increment = 5;\nint speed = 5;\n\n\nvoid setup() {\n  pixels.begin();\n}\n\nvoid loop() {\n  value = value + increment;\n  if (value >= 255) {\n    value = 255;\n    increment = -increment;\n  } else if (value <= 0) {\n    value = 0;\n    increment = -increment;\n    speed = random(5, 30);\n    ++state;\n    if (state == 1) {\n      hue = 21845;\n    } else if (state == 2) {\n      hue = 43690;\n    } else if (state == 3) {\n      hue = 10922;\n    } else {\n      state = 0;\n      hue = 0;\n    }\n  }\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, saturation, value));\n  pixels.show();\n  delay(speed);\n}\n
      "},{"location":"solutions/11/11/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/12/12/","title":"Day twelve:","text":"

      Use the light sensor to detect when to light up your Barduino as a candle. There is nothing more \"Chritsmasy\" than the light of a candle, with family, friends or just te blanket on the sofa. Use the Barduino as a candle? Why not!

      The idea is to make it automatic, so when it detects a low level of light it will light up simulating a candle, you will need to create a nice animation with the neopixel (don't try to light it up on fire...)

      "},{"location":"solutions/12/12/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/12/12/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint pt = 3;\n\nint hue = 0;\nint saturation = 255;\nint value = 0;\n\nint maxVal = 100;\nint minVal = 50;\n\nint increment = 5;\nint speed = 5;\n\nint treshold = 500;\n\n\nvoid setup() {\n  pixels.begin();\n  Serial.begin(115200);\n  pinMode(pt, INPUT);\n}\n\nvoid loop() {\n  int light = analogRead(pt);\n  Serial.println(light);\n  if (light <= treshold) {\n    int brightness = 255;\n    candle(brightness);\n  } else {\n    pixels.setPixelColor(0, pixels.ColorHSV(hue, saturation, 0));\n    pixels.show();\n    delay(500);\n  }\n}\n\nvoid candle(int brightness) {\n  pixels.setBrightness(brightness);\n  value = value + increment;\n  if (value >= maxVal) {\n    value = maxVal;\n    increment = -random(1, 5);\n  } else if (value <= minVal) {\n    value = minVal;\n    increment = random(1, 5);\n    speed = random(10, 30);\n    hue = random(2000, 4000);\n  }\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, saturation, value));\n  pixels.show();\n  delay(speed);\n}\n
      "},{"location":"solutions/12/12/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/13/13/","title":"Day thirteen:","text":"

      Connect you Barduino with somthing else than the Serial Monitor. Today is about expanding the Barduino, using other tools to visualize what's happenning in your board. A nice option is p5js, but feel free to use any other tool!

      Tip, the simplest way to do so is using Serial communication, but you can try other things like Bluetooth, MQTT or publishing a web page from the ESP32.

      "},{"location":"solutions/13/13/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/13/13/#arduino-code","title":"Arduino code","text":"
      #include <Adafruit_NeoPixel.h>\n#define PIN 38\n#define NUMPIXELS 1\n\nAdafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\n\nint hue = 1;\n\nconst int but = 0;\nconst int R = 5;\nconst int L = 7;\n\nconst int treshold = 30000;\n\nbool pressed = false;\n\nvoid setup() {\n  pixels.begin();\n  pixels.setBrightness(100);\n  Serial.begin(115200);\n}\n\nvoid loop() {\n  if (touchRead(R) > treshold && touchRead(R) >touchRead(L)){\n    hue = hue + 100;\n    delay(10);\n  }\n  else if (touchRead(L) > treshold && touchRead(L) >touchRead(R)){\n    hue = hue - 100;\n    delay(10);\n  }\n  if (hue < 1){\n    hue = 65535;\n  }\n  else if (hue >= 65535){\n    hue = 1;\n  }\n  pixels.setPixelColor(0, pixels.ColorHSV(hue, 255, 255));\n  pixels.show();\n  if (!digitalRead(but) && !pressed){\n    pressed = true;\n    Serial.println(hue);\n  }\n  else if (digitalRead(but)){\n    pressed = false;\n  }\n}\n
      "},{"location":"solutions/13/13/#p5js","title":"P5js","text":""},{"location":"solutions/13/13/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/14/14/","title":"Day fourteen:","text":"

      Let's test your 3D design skills! Desgin an enclousure to secure the Barduino but alowing te user to use it's features. Extra points for the ones who actualy fabricates it!

      Tip, use this SVG files to get the exact measurements of the board.

      "},{"location":"solutions/14/14/#possible-solution","title":"Possible solution!","text":"

      Here you can find the Rhino 6 file and the STL file. There are some thing's that needs to get adjusted, like a hole for the antenna and bring the usb hole higher.

      "},{"location":"solutions/14/14/#hero-shot","title":"Hero shot","text":""},{"location":"solutions/15/15/","title":"Day fifteen:","text":"

      Transform your Barduino in a Keyboard! The ESP32S3 has a USB-OTG mode, making it possible to be recognised as a keyboard by the computer. Use it to create your own keyboard.

      Arduino Tips

      If you use the same method I used to create a HID (Human Interface Device) keyboard you have to change the USB Mode: USB-OTG (Tiny USB) setting under Tools in Arduino. Using this mode, you have to use Boot Mode to program the board (Press Boot 00 button while reseting). When programming the board may change the Port number, so to programmed back you may need to change the port.

      "},{"location":"solutions/15/15/#possible-solution","title":"Possible solution!","text":""},{"location":"solutions/15/15/#arduino-code","title":"Arduino code","text":"
      #include \"USB.h\"\n#include \"USBHIDKeyboard.h\"\nUSBHIDKeyboard Keyboard;\n\nconst int but = 0;\nint previousButtonState = HIGH; \nbool pressed = false;\n\nvoid setup() {\n  pinMode(but, INPUT);\n  Keyboard.begin();\n  USB.begin();\n}\n\nvoid loop() {\n  if (!digitalRead(but) && !pressed) {\n    pressed = true;\n    Keyboard.println(\"Adventronics day 15 challenge COMPLETED!\");\n  }\n  else if (digitalRead(but)){\n    pressed = false;\n  }\n}\n
      "},{"location":"solutions/15/15/#hero-shot","title":"Hero shot","text":"

      Adventronics day 15 challenge COMPLETED!

      "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 59123ab..4a71384 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ diff --git a/solutions/01/01/index.html b/solutions/01/01/index.html index e2c5ef1..3d7a452 100644 --- a/solutions/01/01/index.html +++ b/solutions/01/01/index.html @@ -977,6 +977,27 @@ + + + + + + +
    3. + + + + + Day 15 + + + + +
    4. + + + + diff --git a/solutions/02/02/index.html b/solutions/02/02/index.html index 20d34e4..8d9dc39 100644 --- a/solutions/02/02/index.html +++ b/solutions/02/02/index.html @@ -953,6 +953,27 @@ + + + + + + +
    5. + + + + + Day 15 + + + + +
    6. + + + + diff --git a/solutions/03/03/index.html b/solutions/03/03/index.html index dc008f7..05fb8a8 100644 --- a/solutions/03/03/index.html +++ b/solutions/03/03/index.html @@ -953,6 +953,27 @@ + + + + + + +
    7. + + + + + Day 15 + + + + +
    8. + + + + diff --git a/solutions/04/04/index.html b/solutions/04/04/index.html index 65dc669..e9b52ad 100644 --- a/solutions/04/04/index.html +++ b/solutions/04/04/index.html @@ -977,6 +977,27 @@ + + + + + + +
    9. + + + + + Day 15 + + + + +
    10. + + + + diff --git a/solutions/05/05/index.html b/solutions/05/05/index.html index d766b5f..8d78f2b 100644 --- a/solutions/05/05/index.html +++ b/solutions/05/05/index.html @@ -977,6 +977,27 @@ + + + + + + +
    11. + + + + + Day 15 + + + + +
    12. + + + + diff --git a/solutions/06/06/index.html b/solutions/06/06/index.html index ac38643..3c90627 100644 --- a/solutions/06/06/index.html +++ b/solutions/06/06/index.html @@ -953,6 +953,27 @@ + + + + + + +
    13. + + + + + Day 15 + + + + +
    14. + + + + diff --git a/solutions/07/07/index.html b/solutions/07/07/index.html index 24c784b..ae1f88d 100644 --- a/solutions/07/07/index.html +++ b/solutions/07/07/index.html @@ -977,6 +977,27 @@ + + + + + + +
    15. + + + + + Day 15 + + + + +
    16. + + + + diff --git a/solutions/08/08/index.html b/solutions/08/08/index.html index c220276..650ded9 100644 --- a/solutions/08/08/index.html +++ b/solutions/08/08/index.html @@ -977,6 +977,27 @@ + + + + + + +
    17. + + + + + Day 15 + + + + +
    18. + + + + diff --git a/solutions/09/09/index.html b/solutions/09/09/index.html index 4c3b6f4..a241ce6 100644 --- a/solutions/09/09/index.html +++ b/solutions/09/09/index.html @@ -977,6 +977,27 @@ + + + + + + +
    19. + + + + + Day 15 + + + + +
    20. + + + + diff --git a/solutions/10/10/index.html b/solutions/10/10/index.html index bd6ffb7..5908405 100644 --- a/solutions/10/10/index.html +++ b/solutions/10/10/index.html @@ -953,6 +953,27 @@ + + + + + + +
    21. + + + + + Day 15 + + + + +
    22. + + + + diff --git a/solutions/11/11/index.html b/solutions/11/11/index.html index 55bf3aa..12193c6 100644 --- a/solutions/11/11/index.html +++ b/solutions/11/11/index.html @@ -977,6 +977,27 @@ + + + + + + +
    23. + + + + + Day 15 + + + + +
    24. + + + + diff --git a/solutions/12/12/index.html b/solutions/12/12/index.html index 4f658ff..9f0cbbc 100644 --- a/solutions/12/12/index.html +++ b/solutions/12/12/index.html @@ -977,6 +977,27 @@ + + + + + + +
    25. + + + + + Day 15 + + + + +
    26. + + + + diff --git a/solutions/13/13/index.html b/solutions/13/13/index.html index 89823ee..92796e0 100644 --- a/solutions/13/13/index.html +++ b/solutions/13/13/index.html @@ -986,6 +986,27 @@ + + + + + + +
    27. + + + + + Day 15 + + + + +
    28. + + + + diff --git a/solutions/14/14/index.html b/solutions/14/14/index.html index 0f62c2c..08c8a4f 100644 --- a/solutions/14/14/index.html +++ b/solutions/14/14/index.html @@ -16,7 +16,7 @@ - + @@ -962,6 +962,27 @@ + + + + + + +
    29. + + + + + Day 15 + + + + +
    30. + + + + diff --git a/solutions/15/15/index.html b/solutions/15/15/index.html new file mode 100644 index 0000000..9e83771 --- /dev/null +++ b/solutions/15/15/index.html @@ -0,0 +1,1293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Day 15 - Adventronics Calendar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + Skip to content + + +
      +
      + +
      + + + + +
      + + +
      + +
      + + + + + + + + + +
      +
      + + + +
      +
      +
      + + + + + + + +
      +
      +
      + + + +
      +
      +
      + + + +
      +
      +
      + + + +
      +
      + + + + + + + +

      Day fifteen:

      +

      Transform your Barduino in a Keyboard! The ESP32S3 has a USB-OTG mode, making it possible to be recognised as a keyboard by the computer. Use it to create your own keyboard.

      +
      +

      Arduino Tips

      +

      If you use the same method I used to create a HID (Human Interface Device) keyboard you have to change the USB Mode: USB-OTG (Tiny USB) setting under Tools in Arduino. +arduino usb otg +Using this mode, you have to use Boot Mode to program the board (Press Boot 00 button while reseting). When programming the board may change the Port number, so to programmed back you may need to change the port.

      +
      +

      Possible solution!

      +

      Arduino code

      +
      #include "USB.h"
      +#include "USBHIDKeyboard.h"
      +USBHIDKeyboard Keyboard;
      +
      +const int but = 0;
      +int previousButtonState = HIGH; 
      +bool pressed = false;
      +
      +void setup() {
      +  pinMode(but, INPUT);
      +  Keyboard.begin();
      +  USB.begin();
      +}
      +
      +void loop() {
      +  if (!digitalRead(but) && !pressed) {
      +    pressed = true;
      +    Keyboard.println("Adventronics day 15 challenge COMPLETED!");
      +  }
      +  else if (digitalRead(but)){
      +    pressed = false;
      +  }
      +}
      +
      +

      Hero shot

      +

      Adventronics day 15 challenge COMPLETED!

      + + + + + + + + + + + + + + + + + + +
      +
      + + + +
      + +
      + + + +
      +
      +
      +
      + + + + + + + + + + \ No newline at end of file diff --git a/template/index.html b/template/index.html index 702b653..d25f7d9 100644 --- a/template/index.html +++ b/template/index.html @@ -13,7 +13,7 @@ - + @@ -904,6 +904,27 @@ + + + + + + +
    31. + + + + + Day 15 + + + + +
    32. + + + + diff --git a/video/day15.mp4 b/video/day15.mp4 new file mode 100644 index 0000000..a0accf1 Binary files /dev/null and b/video/day15.mp4 differ