Beats and Bars - Assignment 2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
conehead
Date:
Sun Oct 01 07:00:36 2017 +0000
Commit message:
V1;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 690b6f38fac1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Oct 01 07:00:36 2017 +0000
@@ -0,0 +1,27 @@
+// Damon Hill - 14234098 - 159.270
+// Assignment 2 - Beats and Bars
+#include "mbed.h"
+
+PwmOut yellowLED(LED1);     // declare LED outputs
+PwmOut blueLED(PA_7);
+
+unsigned int beatA,beatB;   // declare beats and PWM period
+float periodA, periodB;
+
+int main()
+{
+    beatA = 3;      // set LED beats
+    beatB = 4;
+    periodA = 12/beatA;     // 12/beat to get time for one beat in a 12 second bar
+    periodB = 12/beatB;
+
+    yellowLED = 1;      //turn LEDs high at start of bar
+    blueLED = 1;
+
+    yellowLED.period(periodA); //set period
+    blueLED.period(periodB);
+    yellowLED.pulsewidth(1);   //pulse led for 1 second
+    blueLED.pulsewidth(1);
+
+    while (1);
+}
\ No newline at end of file
diff -r 000000000000 -r 690b6f38fac1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Oct 01 07:00:36 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/e2bfab296f20
\ No newline at end of file