Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mbed.h"
- AnalogOut Aout(p18); //create an analog output on pin 18
- int main() {
- while(1) {
- Aout=0; // 0*3.3V = 0V
- wait(0.0001);
- Aout=0.1; // 0.1*3.3V = 0.33V
- wait(0.0001);
- Aout=0.2; // 0.2*3.3V = 0.66V
- wait(0.0001);
- Aout=0.3; // 0.3*3.3V = 0.99V
- wait(0.0001);
- Aout=0.4; // 0.4*3.3V = 1.32V
- wait(0.0001);
- Aout=0.5; // 0.5*3.3V = 1.65V
- wait(0.0001);
- Aout=0.6; // 0.6*3.3V = 1.98V
- wait(0.0001);
- Aout=0.7; // 0.7*3.3V = 2.31V
- wait(0.0001);
- Aout=0.8; // 0.8*3.3V = 2.64V
- wait(0.0001);
- Aout=0.9; // 0.9*3.3V = 2.97V
- wait(0.0001);
- }
- }
Add Comment
Please, Sign In to add comment