help / Mbed 2 deprecated Info_2_TD

Dependencies:   mbed TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Exercice_7.cpp Source File

Exercice_7.cpp

00001 /*//Sawtooth waveform on DAC output to view on oscilloscope
00002  
00003 #include "mbed.h" 
00004 AnalogOut Aout(p18);
00005 AnalogIn pot(p20); 
00006 float i,x; 
00007 int main() { 
00008   while(1)  
00009   { 
00010     x=pot.read();
00011     for (i=0;i<1;i=i+0.01) 
00012     { 
00013       Aout.write(i*x);  
00014       wait(0.001);  
00015     } 
00016     for (i=1;i>0;i=i-0.01) 
00017     { 
00018       Aout.write(i*x);  
00019       wait(0.001);  
00020     } 
00021   } 
00022 } */