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.
Diff: Motor.cpp
- Revision:
- 0:b5d1c04a1e24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor.cpp Mon Dec 06 11:39:00 2021 +0000
@@ -0,0 +1,15 @@
+#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
+}
\ No newline at end of file