4. Embedded programming¶
This week we worked on programing a microcontroller. I worked on two different coding languages which are TinkerCAD circuits and Arduino IDE.
What is a microcontroller?¶
“A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip.”
We are using Arduino Nano 33 BLE Sense and it shows in the diagrammatic image below
Arduino¶
The first program we used was Arduino IDE, so we started to set it up to connect it the microcontroller board and here are the steps below:
1- Installing ‘nano 33 ble’ from boards manager.
2- Going to tools > board and select Arduino Nano 33 ble
3- Connecting the microcontroller with the computer from port
First experiment¶
There are many examples in the program itself that you can use and feel free to check out. I wanted to do a blink test with the microcontroller embedded LED light to make it blink on and off.
I opened the Examples tap and chose Blink from Basics
I adjusted the periods of the blinking randomly
And there is another way you can do it in TinkerCAD to use templates and blocks that assign the order to on or off then gives you the code directly, you just need to write the periods of both the on or off inside the blocks.
And that’s the code directly downloaded from TinkerCAD and it just needs to be uploaded and tested out.
Second experiment¶
On the second experiment I tried translating the Morse code of the word “help” by the same order which is Blink. Using this website it gives you the output directly and you just need to translate the dots to On periods and adjust the periods of the On and Off.
So I used TinkerCAD and what I liked about it that it make things easier for you by putting “repeat” blocks to the simple orders High and Low.
I repeated the simple block making a whole word out of Highs and Lows
And that is the final code copied from TinkerCAD to Arduino and ready to be uploaded!!
Final Result¶
Here is first the Morse code simulator of the word “help”:
Morse code on Vimeo.
And here is the blinking outcome of the word “help” too:
Blink code on Vimeo.