hi

Dependencies:   mbed Servo

main.cpp

Committer:
injokim
Date:
2018-12-09
Revision:
0:b9dc28a0bfcc

File content as of revision 0:b9dc28a0bfcc:


//------------------------------------
// Hyperterminal configuration
// 9600 bauds, 8-bit data, no parity
//------------------------------------

#include "header.h"

PwmOut      mypwm(A1);

int main() 
{ 
    int i;
    
   //DC motor PWM set
    mypwm.period_ms(10);
    mypwm.pulsewidth_ms(1);
    
    //Set Wifi
    wifi_init();
  
    while(1)
    {
       i= Laser();
       Laser_servo(i);
       
       Hall_sensor();
       Run_DC(i);
       
       if(i==1)
       {
           wifi_print();
           wait(0.05);
        }
    }
}


void Run_DC(int i)
{
    if(i==1)
    {
        mypwm.write(0.5); //  slow
        wait(0.01);
    }
    
    else
    {  
        mypwm.write(0.1); // fast
        wait(0.01);
    }
}