Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 6:69ce22d142d6, committed 2018-12-12
- Comitter:
- lklang
- Date:
- Wed Dec 12 06:02:54 2018 +0000
- Parent:
- 5:95dd571550d3
- Child:
- 7:37476d579b53
- Commit message:
- Added count for alarms
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Dec 12 03:09:49 2018 +0000
+++ b/main.cpp Wed Dec 12 06:02:54 2018 +0000
@@ -64,6 +64,11 @@
deque<time_t> beat_times;
deque<time_t> pace_times;
+// The number of times each alarm has occured
+unsigned int rate_alarm_count = 0;
+unsigned int pace_alarm_count = 0;
+
+// Threads
Thread pacemaker_thread;
Thread monitor_observe;
Thread monitor_calculate;
@@ -110,7 +115,6 @@
alarm_t.start();
if (alarm == RATE_ALARM)
{
- // SEND MQTT MESSAGE HERE
for (i = 0; i < 3; i++)
{
@@ -118,13 +122,14 @@
while(alarm_t.read_ms() < 200*(i+1));
led_fast_alarm = 0;
}
- sprintf(buf, "Fast Alarm :%d", 1);
+ rate_alarm_count++;
+ sprintf(buf, "Fast Alarm :%d", rate_alarm_count);
pc.printf("Too fast\r\n");
} else if (alarm == PACE_ALARM)
{
- sprintf(buf, "Slow Alarm :%d", 1);
- // SEND MQTT MESSAGE HERE
+ pace_alarm_count++;
+ sprintf(buf, "Slow Alarm :%d", pace_alarm_count);
for (i = 0; i < 3; i++)
{
led_slow_alarm = 1;
