slave2
Dependencies: PinDetect dsp mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:7ee25b048596
- Child:
- 1:caeb5792f292
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Apr 24 17:37:33 2016 +0000 @@ -0,0 +1,47 @@ +#include "mbed.h" +#include "PinDetect.h" +#include "rtos.h" + +DigitalOut myled(LED1); +DigitalOut myled2(LED2); +DigitalOut myled4(LED4); +AnalogOut outfunction(p18); +DigitalOut masterSignalOut(p26); +InterruptIn trigger(p25); +int counter; + +Timer ti; + +void analogScope(void const *args){ + counter = 0; + myled = 0; + while(1){ + //outfunction = (ti.read_us()%1000)*0.001; + //myled= (((ti.read_ms())>>10)%1); + outfunction = (counter%10)*0.1; + counter++; + myled = !myled; + } +} +void sendinterrupt(void){ + masterSignalOut = 1; +} +void interruptrecv(void){ + ti.reset(); + myled4 = !myled4; + counter = 0; + masterSignalOut = 0; +} +int main() { + ti.reset(); + myled2 = 0; + myled4 = 0; + masterSignalOut = 0; + Thread threadanalog(analogScope); + threadanalog.set_priority(osPriorityLow); + trigger.rise(&interruptrecv); + while(1) { + myled2 = !myled2; + Thread::wait(10000); + } +}