Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Motor.cpp
- Committer:
- racedom
- Date:
- 2021-12-06
- Revision:
- 0:b5d1c04a1e24
File content as of revision 0:b5d1c04a1e24:
#include "Motor.h"
#include "mbed.h"
Motor :: Motor(PinName pin1, PinName pin2) : A_pin(pin1),P_pin(pin2)
{
} // Deklaracija klase "Motor"
int Motor::Control () // Deklaracija funkcije "Control"
{
float Analog; // Funkcija prima vrijednost sa pina i pretvara u "PWM"
float PWM; // u rasponu od 900 us do 2100 us
Analog = A_pin;
PWM = 1200*Analog + 900;
return int(PWM); // Vraća se "PWM signal" tipa integer
}