Background Image

Embedded Programming made in 🎀pink🎀

Hey there guuuuurl, welcome to this week's assignment where we're diving into the world of super fun Arduino and Python programming yaaaaay🧸

Okay, so let me break it down for you in girl pink terms hun 💅🏼 so we are in the same page. Let's start with the basics: the syntax rules. We'll be comparing Python and C++ because, why not? lol

Python makes life easy. You just throw in a value, and Python figures out the rest. No need to sweat about declaring types! Check its syntax:

Imagen 1

Now, C++ is a bit more formal. You gotta tell it what type of data you're dealing with upfront:

Imagen 1

Alright, so let’s talk about the 🐘 in the room guys… programming in Python versus Arduino, which language is BETTER??

    So programming in Python is super chill, easy-to-read language (or so I’ve been told) used for all sorts of stuff like web development, data analysis, etc…

  • Python runs on an interpreter, so it's pretty straightforward and portable across different systems. This means that every single line of code you do will be read from begging to end as a single line command, so the symptoms will be a little to none perceived delay in your devices which still sounds good to me right?

  • Anyways if you do not feel very comfortable with this or you are programming something the old-fashioned way then Arduino is this open-source hardware prototyping platform that's a compiling code type. This means that your code will be read as an embedded package.

  • It's got its own simplified version of C/C++ for coding, which is perfect for controlling sensors, lights, and all that electronic cute stuff awww My personal opinion (because I prefer Arduino) it’s that if you're aaaaaaall into hardware projects, Arduino is where it's at, this is because of its origin of embedding the code and processing it faster to your components. For this week’s assignment I decided to program my board with a print which shows me the distance an object is between my cute ultrasonic sensor and it. First I had to test my board and plate with another code to see if it would totally run or if I actually did ruined it all… I decided to try Python first because I already knew how to use Arduino and this Fab Lab is totally about taking risks and trying something new.

  • I programmed the RGB led that is in my XIAO so it changed colors with a simple delay, very rainbow 🌈 ish lol. For this I imported a universal library to my laptop and downloaded the ones that said: Neopixel and Adafruit_pixelbuf so I could call them from my MU code editor.

  • Imagen 1 Imagen 1

    After I made some tests playing with the Red Green Blue values I decided that it was time to start the programming of my assignment in Arduino. Here you can see the difference between both languajes, it´s the same code, it did the same but each one in a different languaje.

    Imagen 1 Imagen 1

    For my code I searched how to get this done in an Arduino board and found out some inspiring codes that got me started, I noticed that they all had something in common : declaring the pins, printing the results and delaying the results some seconds so it had a better outcome. I mixed up the codes and added a touch of myself to make this one work out.

This were the code references I used to take inspiration, omg I watched like 5 different videos to get into a result but it was totally worth it yaaaas.

Imagen 1

And so it did! It worked out and everytime an object was close to it immediately the results changed. For this week’s assignment I won’t upload a video cus’ last time Git played hard on me because of the weight of one file and even divided itself into another bran

Imagen 1 Imagen 1

For all of this super knowledge and incredible lessons this is the Fab lab´s Puebla weekly task, feel free to take a look so you can undertsand it much better

⬇️

  • Puebla´s Fab academy class of week 6
  • AND NOW THE MAIN 🍽️✨DISH✨🍽️ OF THE WEEK 6 GUUURL THE CONSTRUCION OF MY PRETTY BOARD

    So I decided to try out my XIAO board (For the design information click the link below, everything is at my week 4 assigment bae), cus, why not gurl? I did everything good so it could work out so to try this out I started by hooking up an ultrasonic sensor to it. Now get some popcorn and a soda, here's how I programmed it to print out distances.

  • Electronic desgin
  • First things first, I 🔥 up my Arduino app, 'cause that's where the magic happens. Then, I grabbed my ultrasonic sensor and soldered it to my XIAO board. It's like connecting the dots, for starters. Always be careful to solder it nicely and smooth, remember that it needs to look bright and shiny with any lumps in it.

    For the reconfiguration of the xiao always remember to hit BOOT button so every code that was previosly uploaded in it goes away. Always always always import your libraries before using them.

    Imagen 1

    Next up, I dove into the code. I wrote this neat little script that goes something like this:

    Alright that’s done and now for the software section… I set up the pins for the ultrasonic sensor in the setup() function. Then, in the loop() function, we do this little dance where we send out ultrasonic pulses, measure the time it takes for them to bounce back, and then calculate the distance based on that time. And then I printed out those distances to the serial monitor. It's like our little device is chatting with us, telling us how far things are. That was super cute because my cute board was talking to me aww.

    Now check out my pretty board construction

    My hard work pics📸

    My fab files