![]() The delay() and millis() function that you know make use of Timer0 so if you change the settings of Timer0, the functions will not work properly. These timers control the Pulse Width Modulation(PWM) that is associated with the respective pins as well. Using this, the ATmega328P micro-controller provides 3 timers known as Timer0 (pin 5 and 6), Timer1 (pin 9 and 10), and Timer2 (pin 3 and 11). This means that when the crystal oscillates 16 million times, 1 second has elapsed. In it, there is a crystal which oscillates at a frequency of 16MHz. It is the core processing unit and it turns what you code into something that interacts with the real world. The Arduino UNO that you have is actually armed with the ATmega328P micro-controller. The data sheet might look intimidating at first (its the data shit after all), but I am sure it is not something that you can’t handle! When things looks difficult, take a break, press on, and before you know it, you’ll have it all figured out. ![]() In order to understand the codes below, I would strongly suggest that you download a copy of the data sheet for ATmega328P (Arduino UNO’s processor). Have you ever wondered how your air-conditioner remote controllers keep the time? Or how your computer knows the time even after being shut down and not being connected to the internet at all? Well, the answer to the first question is here, and the answer to the second one can be found in the next project where we use the DS3231 Real-Time-Clock module to keep the time. It was through this project that I begin to appreciate the small details in the portable devices. In order to create a watering automation system, there must be some sort of time keeping in order for the alarms to work. I will explain the code based on the order written above so let’s begin! 1. Retrieving data from the Bluetooth module.I will try my best to explain everything inside so that those of you who do not know about port manipulation can take this chance to learn as well!įirstly, there are mainly 3 parts to this program: It is definitely possible to write the code in a cleaner and simpler manner but I was trying out port manipulation of the Arduino so the code became really lengthy. The source code in C++ is here in case some of you need it again! I’m really sorry that the code looks like a mess.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |