1) Timer One: Timer One is the class used for
controlling the internal timer of the Arduino, in order to set the periodical
timing for each dose we had to count the smallest scale of time which is in
seconds. We first has to initialize
the timer through initialize() method for the unit to be counted, or more
convenient, how frequent would be the timer initiating an interrupt for processing the ISR (Interrupt Service Routine). Then attach an interrupt to it through the
attachInterrupt () method, which defines the ISR that has to be executed. Then
the timerisr() contains the command that has to be executed, which is initially controlling four separate counters.
Fig. 11: Pills function in ESP.
messages from any ESP8266 wifi module uti- lizing Gmail server. This
instructable depends on Arduino center for ESP8266 WiFi chip, which makes an
independent microcontroller from it (no need of AT summons and ace gadgets). You
can interface sensors and get told by email about changes. We will
utilize SMTP to send messages. Utilizing SMTP Authentication we give just email
and watchword, as a matter, of course, Google utilizes more mind-boggling check
techniques so we have to change settings. Go to your Google account settings
and empower “Allow
less secure applications” at the base of the page. This mean application just needs your
email and secret word when login
to your Gmail account.
Fig. 12: Gmail Sender in ESP.
Securing some global variables which going to be used
later during the program,
then including the library files of the serial
and the timer used along the program is a necessity, we then define the pins
which going to be working as a serial TX and RX as shown in the figure below.
Fig. 13: Definitions in Arduino.
Then the initialization stage or the setup stage as we
call, which in it the initialization of the two serial communication, the soft
and the hard one, all together with the initialization of the timer and attaching
an ISR to it.
As mentioned before, there are two devices used for
the system, both will be discussed
separately providing the code and its core.
First, we import the libraries used for the WiFi and
client, then we define some important variables as global, whose will be used
through the program. All can be shown in the figure below.