Sunteți pe pagina 1din 1

Task 6.

2: Finite-State Machine Model


[Rotary button]
if CW: hours++ [Rotary button]
if CCW: hours-- if CW: minutes++
if CCW: minutes--

setHoursClock [Joystick button setMinutesClock


pressed]
entry/ clock Init (); Change minutes of clock.
Change hours of clock Exit/ set time();
Power-up

[Joystick button
pressed]
[Joystick button pressed]
[Rotary button
pressed] Toggle
Alarm Switch();
setMinutesAlarm [Joystick button setHoursAlarm [Joystick button RTClock
pressed] pressed]
Change minutes of alarm. Change hours of alarm. displayTime();
Exit/set alarmExpire,
alarmSwitch(ENABLE);
[Every 1 second]: second
counter increases & green
[Rotary button] LED toggles
[Rotary button]
if CW: alarm minutes++ if CW: alarm hours++ [(time=5s || Any button is
if CCW: alarm minutes-- if CCW: alarm hours-- pressed)] : Turn off red LED [Current Time = Alarm &&
Alarm is enabled]

Alarm State
entry / led_toggle(RED) @ 4 Hz,

S-ar putea să vă placă și