ga

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 Serial pc(USBTX, USBRX);
00003 PwmOut pwm1(p21);
00004 PwmOut pwm2(p22);
00005 int main(){
00006     while(1)
00007     int y=600;
00008     int x=500;
00009     int f;
00010     if(x-y>0){
00011     for(f = 1000;f < 3000;f+=10);
00012     pwm1.pulsewidth_us(f);
00013     }else if(x-y<0){
00014         for(f = 1000;f <2000;f+=10);
00015         pwm2.pulsewidth_us(f);
00016     }
00017     }
00018