Steve Ravet
/
ticker_test5
short program to show a problem with spi and tickers
Diff: pattern.cpp
- Revision:
- 0:85d990bd01f4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pattern.cpp Wed Oct 20 04:32:32 2010 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" +#include "pattern.h" + + +DigitalOut led1(LED1); //rotate_leds +DigitalOut led2(LED2); //HSV2RGB +DigitalOut led3(LED3); +DigitalOut led4(LED4); +AnalogOut aout(p18); + +// pattern constructor. Turn off LEDs, initialize class variables. +pattern::pattern() +{ +} + + +// start up the pattern ticker. Keep track of rotation and throb counters and update +// the LEDs when necessary. +void pattern::start(void) +{ + update_ticker.attach_us(this,&pattern::update_isr,1000000/ISR_FREQ); +} + + + + +void pattern::update_isr() +{ + led4=1; + led4=0; + led4=1; + wait_us(2); + led4=0; +} + +