4. Embedded Programming

 The assignment this week is to choose a microcontroller, browse through the data sheet for your microcontroller, program said microcontroller development board to interact (with local input &/or output) and communicate (remotely).

Chosen Microcontroller

 After looking throught the spec sheets and getting a good look at the microcontollers I chose the Arduino Uno R3. not only have I had previously used an Arduino before, but it also seemed to be the easiest to read and the most solid.

Arduino Adder:

 I started by designing the output of the Arduino and the board in Tinkercad, I would connect four lights to the Arduino to be lit up to display the sum in binary.



 I then realized that four lights would not be enough as four-digit binary numbers added together would sometimes equate to a five-digit binary number. I added the extra light and continued.



 Next, I started on my code by looking up examples of binary addition in C++, the coding language Arduino is similar to and I am familiar with. I found a great example on stack overflow that I will fix so that it can add, the correct lights will activate, and it will output the binary number starting with the rightmost digit.

Adding binary numbers in C++ - Stack Overflow

 I had a few problems with the code not working with the Arduino language. It first wouldn’t output text which I fixed by changing “main” to “loop”, then the displayed number was incorrect which was fixed by making the last three “if” statements in the first for loop into “else if” statements, and lastly the lights just displayed the binary number the wrong way which I fixed by flipping the order of the connected lights. Now the project is fully finished with a nice output of 24 or 11000 in binary.

Adder Code

Group Page:

  • week 4 group page.


  • Useful links