Programing in C++

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 "cse360.h"
00003 #include "lab.h"
00004 
00005 PwmOut mypwm(PWM_OUT);
00006 
00007 DigitalOut myled(LED1);
00008 
00009 
00010 void gotoExample() {
00011 print1:
00012     printf("VALUE=1\n");
00013 print2:
00014     printf("VALUE=2\n");
00015 print3:
00016     printf("VALUE=3\n");
00017     
00018     goto print2;
00019 }
00020 
00021 
00022 int main() {
00023     
00024     mypwm.period_ms(10);
00025     mypwm.pulsewidth_ms(1);
00026   
00027     // printf("rollnum: %d\n", cse360::rollnum);
00028     for(int i=0;i<10;i++) {
00029         printf("i=%d\n",i);
00030     }
00031 
00032     printf("pwm set to %.2f %%\n", mypwm.read() * 100);
00033     
00034     while(1) {
00035         myled = !myled;
00036         wait(1);
00037     }
00038 }