
Use a PWM to simulate a DAC (needs additional filter)
main.cpp
- Committer:
- noutram
- Date:
- 2017-10-10
- Revision:
- 0:5d9c5cd32f43
File content as of revision 0:5d9c5cd32f43:
#include "mbed.h" DigitalOut led1(LED1); DigitalOut pin(D7); PwmOut pwm(D6); // main() runs in its own thread in the OS int main() { pwm.period_us(10); // 1 second period pwm = 0.5f; // 50% duty cycle, relative to period while (true) { led1 = !led1; pin = !pin; wait(0.5); } }