diff --git a/404.html b/404.html index e9e9111..0bb10be 100644 --- a/404.html +++ b/404.html @@ -851,6 +851,27 @@ + + + + + + +
  • + + + + + Day 13 + + + + +
  • + + + + diff --git a/barduino/index.html b/barduino/index.html index fd5ef96..911014b 100644 --- a/barduino/index.html +++ b/barduino/index.html @@ -874,6 +874,27 @@ + + + + + + +
  • + + + + + Day 13 + + + + +
  • + + + + diff --git a/howto/index.html b/howto/index.html index 1913949..e54be16 100644 --- a/howto/index.html +++ b/howto/index.html @@ -931,6 +931,27 @@ + + + + + + +
  • + + + + + Day 13 + + + + +
  • + + + + diff --git a/index.html b/index.html index 9115732..6815f91 100644 --- a/index.html +++ b/index.html @@ -872,6 +872,27 @@ + + + + + + +
  • + + + + + Day 13 + + + + +
  • + + + + @@ -1074,6 +1095,7 @@

    Adventronics Calendar Challenge

    13. Visual effects (1)

    +

    Day 13

    1. Maybe with p5js?
    2. diff --git a/search/search_index.json b/search/search_index.json index 0becc03..547aa0f 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)

      1. Maybe with p5js?

      14. Dress me up (1)

      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 te 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":""}]} \ 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)

      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":""}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 7b2c3e7..81f5f2c 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 65ffe3c..8461056 100644 --- a/solutions/01/01/index.html +++ b/solutions/01/01/index.html @@ -935,6 +935,27 @@ + + + + + + +
    3. + + + + + Day 13 + + + + +
    4. + + + + diff --git a/solutions/02/02/index.html b/solutions/02/02/index.html index 1aeef72..2da997e 100644 --- a/solutions/02/02/index.html +++ b/solutions/02/02/index.html @@ -911,6 +911,27 @@ + + + + + + +
    5. + + + + + Day 13 + + + + +
    6. + + + + diff --git a/solutions/03/03/index.html b/solutions/03/03/index.html index 490e1ed..c977f9d 100644 --- a/solutions/03/03/index.html +++ b/solutions/03/03/index.html @@ -911,6 +911,27 @@ + + + + + + +
    7. + + + + + Day 13 + + + + +
    8. + + + + diff --git a/solutions/04/04/index.html b/solutions/04/04/index.html index fd274df..62a8487 100644 --- a/solutions/04/04/index.html +++ b/solutions/04/04/index.html @@ -935,6 +935,27 @@ + + + + + + +
    9. + + + + + Day 13 + + + + +
    10. + + + + diff --git a/solutions/05/05/index.html b/solutions/05/05/index.html index 751341b..4947236 100644 --- a/solutions/05/05/index.html +++ b/solutions/05/05/index.html @@ -935,6 +935,27 @@ + + + + + + +
    11. + + + + + Day 13 + + + + +
    12. + + + + diff --git a/solutions/06/06/index.html b/solutions/06/06/index.html index 2e82913..61e167f 100644 --- a/solutions/06/06/index.html +++ b/solutions/06/06/index.html @@ -911,6 +911,27 @@ + + + + + + +
    13. + + + + + Day 13 + + + + +
    14. + + + + diff --git a/solutions/07/07/index.html b/solutions/07/07/index.html index a2bdd19..c5f8489 100644 --- a/solutions/07/07/index.html +++ b/solutions/07/07/index.html @@ -935,6 +935,27 @@ + + + + + + +
    15. + + + + + Day 13 + + + + +
    16. + + + + diff --git a/solutions/08/08/index.html b/solutions/08/08/index.html index 55821d9..b3299dd 100644 --- a/solutions/08/08/index.html +++ b/solutions/08/08/index.html @@ -935,6 +935,27 @@ + + + + + + +
    17. + + + + + Day 13 + + + + +
    18. + + + + diff --git a/solutions/09/09/index.html b/solutions/09/09/index.html index 108727d..9a448d8 100644 --- a/solutions/09/09/index.html +++ b/solutions/09/09/index.html @@ -935,6 +935,27 @@ + + + + + + +
    19. + + + + + Day 13 + + + + +
    20. + + + + diff --git a/solutions/10/10/index.html b/solutions/10/10/index.html index f91ee61..72471de 100644 --- a/solutions/10/10/index.html +++ b/solutions/10/10/index.html @@ -911,6 +911,27 @@ + + + + + + +
    21. + + + + + Day 13 + + + + +
    22. + + + + diff --git a/solutions/11/11/index.html b/solutions/11/11/index.html index 344b3a7..2d39eb6 100644 --- a/solutions/11/11/index.html +++ b/solutions/11/11/index.html @@ -935,6 +935,27 @@ + + + + + + +
    23. + + + + + Day 13 + + + + +
    24. + + + + diff --git a/solutions/12/12/index.html b/solutions/12/12/index.html index b90d7d0..e76022f 100644 --- a/solutions/12/12/index.html +++ b/solutions/12/12/index.html @@ -16,7 +16,7 @@ - + @@ -935,6 +935,27 @@ + + + + + + +
    25. + + + + + Day 13 + + + + +
    26. + + + + @@ -1090,7 +1111,7 @@

      Day twelve:

      -

      Use te 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!

      +

      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...)

      Possible solution!

      Arduino code

      diff --git a/solutions/13/13/index.html b/solutions/13/13/index.html new file mode 100644 index 0000000..fb6600a --- /dev/null +++ b/solutions/13/13/index.html @@ -0,0 +1,1290 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Day 13 - Adventronics Calendar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + Skip to content + + +
      +
      + +
      + + + + +
      + + +
      + +
      + + + + + + + + + +
      +
      + + + +
      +
      +
      + + + + + + + +
      +
      +
      + + + +
      +
      +
      + + + +
      +
      +
      + + + +
      +
      + + + + + + + +

      Day thirteen:

      +

      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.

      +

      Possible solution!

      +

      Arduino code

      +
      #include <Adafruit_NeoPixel.h>
      +#define PIN 38
      +#define NUMPIXELS 1
      +
      +Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
      +
      +int hue = 1;
      +
      +const int but = 0;
      +const int R = 5;
      +const int L = 7;
      +
      +const int treshold = 30000;
      +
      +bool pressed = false;
      +
      +void setup() {
      +  pixels.begin();
      +  pixels.setBrightness(100);
      +  Serial.begin(115200);
      +}
      +
      +void loop() {
      +  if (touchRead(R) > treshold && touchRead(R) >touchRead(L)){
      +    hue = hue + 100;
      +    delay(10);
      +  }
      +  else if (touchRead(L) > treshold && touchRead(L) >touchRead(R)){
      +    hue = hue - 100;
      +    delay(10);
      +  }
      +  if (hue < 1){
      +    hue = 65535;
      +  }
      +  else if (hue >= 65535){
      +    hue = 1;
      +  }
      +  pixels.setPixelColor(0, pixels.ColorHSV(hue, 255, 255));
      +  pixels.show();
      +  if (!digitalRead(but) && !pressed){
      +    pressed = true;
      +    Serial.println(hue);
      +  }
      +  else if (digitalRead(but)){
      +    pressed = false;
      +  }
      +}
      +
      +

      P5js

      + + +

      Hero shot

      + + + + + + + + + + + + + + + + + + +
      +
      + + + +
      + +
      + + + +
      +
      +
      +
      + + + + + + + + + + \ No newline at end of file diff --git a/template/index.html b/template/index.html index cf65cd3..5d15f49 100644 --- a/template/index.html +++ b/template/index.html @@ -13,7 +13,7 @@ - + @@ -862,6 +862,27 @@ + + + + + + +
    27. + + + + + Day 13 + + + + +
    28. + + + + diff --git a/video/day13.mp4 b/video/day13.mp4 new file mode 100644 index 0000000..61bfb6f Binary files /dev/null and b/video/day13.mp4 differ