ok

main.cpp

Committer:
thevic16
Date:
2021-07-01
Revision:
0:f9baa136dbc3

File content as of revision 0:f9baa136dbc3:

/* mbed Microcontroller Library
 * Copyright (c) 2019 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 */

#include "mbed.h"
#include "platform/mbed_thread.h"



DigitalOut direccion(D2);
PwmOut PWM_velocidad(D3);


//Interfaces para USER_BUTTON
//DigitalIn userButton(USER_BUTTON);
//bool buttonDown = false;

int main()
{
    
    direccion = 0; // En direccion de las manecillas del reloj.
    
    float valor_velocidad = 0; //representa un 0%
    
    PWM_velocidad.period(0.0001f); //Declaramos el periodo
    PWM_velocidad.write(1.0f);
    
    
    thread_sleep_for(5000); 
    
    PWM_velocidad.write(0.0f);
    
    
    /* 
    if (userButton) {  // button is pressed
     if  (!buttonDown) {  // a new button press
     
      //valor_velocidad = valor_velocidad + 0.004; //Representa un aumento de un 10%.
      //PWM_velocidad.write(valor_velocidad);
      
      buttonDown = true;     // record that the button is now down so we don't count one press lots of times
      thread_sleep_for(10);             // ignore anything for 10ms, a very basic way to de-bounce the button. 
     } 
     
   } else { // button isn't pressed
    buttonDown = false;
   }
   */
    
}