Kian Sek Tee / Mbed 2 deprecated sin_test

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3
00004 AnalogOut signal(p18);
00005 
00006 float ff;
00007 float pi;
00008 float theta;
00009 
00010 
00011 int main() {
00012     pi = 3.142;
00013 
00014     while (1) {
00015         theta=0;
00016          for( int i=0; i < 63; i++ ) {
00017             theta+=0.1;
00018             ff = 0.5*sin(theta)+0.5;
00019             signal=ff;
00020             lcd.locate (0,0);
00021             lcd.printf("%.2f", ff);
00022             wait(0.001);
00023         }
00024     }
00025 }