conehead NZ
/
Ass2
Beats and Bars - Assignment 2
main.cpp
- Committer:
- conehead
- Date:
- 2017-10-01
- Revision:
- 0:690b6f38fac1
File content as of revision 0:690b6f38fac1:
// 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); }