The following diagram shows how
we conceived the functioning of
our program:
Firstly, a sequential succession of
actions, performed by the user, to
update the time: [Acquire
Time].
Secondly, the storage of the time
into the library and the launch of
the timer: [Set time into the
library].
Thirdly, an infinite loop where the
robot automatically updates the
time and writes it every minute:
[Extract time] & [Write
time].
At each moment, switching off the
power will have the effect of
turning off the robot and erase the
current time: [OFF].
- int acquireTime (int stage)
based on C / C ++.
Moreover, this environment allows the use of various different libraries developed by the firm or
by the user community. To take advantage of existing codes, we used two libraries:
Returns the value put on the potentiometer
by the user to update the time. Stage
informs if the value to return is the low
minute(1) [xx:xX], the high minute(2)
[xx:Xx], the low hour(3) [xX:xx] or the high
hour(4) [Xx:xx].
- void makeStep (int motorUsed,
int sense, int coeffOfStep)
Here is a brief explanation about the functions we have written:
Sends the correct state (motorUsed) to the
demultiplexer and uses an instruction from
Stepper.h to make the motor move in the
correct direction (sense) with an attenuation
of the step size (coeffOfStep) if necessary.
Each function calls makeStep with the
correct parameters
- void solenoid (int state)
Sends to the numerical output of the
solenoid its required (state): put on the
whiteboar (1) or put off the whiteboar (0).
- void lightUpLeds (int value)
Converts the value received into binary
sequence and lights up the leds.
- void makeDigit(int digit)
Calls, according to a determined sequence,
functions up(), down(), right(), left() and
solenoid(state) to write (digit). The value of
(digit) is provided by Time.h library when
the update of the time is done, just before
a new writing cycle.