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.
Dependencies: mbed BufferedSerial
Fork of FRDM_wahadlo_torsyjne by
Diff: main.cpp
- Revision:
- 6:9414a292d7f2
- Parent:
- 5:1e2e73ac4bed
- Child:
- 7:4720c7891ba4
- Child:
- 8:434d613f0929
--- a/main.cpp	Tue Jun 10 09:56:35 2014 +0000
+++ b/main.cpp	Tue Jun 10 10:02:09 2014 +0000
@@ -1,6 +1,6 @@
 #include "mbed.h"
 
-int motor_period = 300;         //deklaracja zmiennych
+int motor_PWM_period_us = 300;         //deklaracja zmiennych
 
 DigitalOut direction(PTC7);     //wyjście PTC7 jako kierunek obrotów
 DigitalOut myled(LED_GREEN);    //dioda zielona jako wizualizacja PWM
@@ -16,7 +16,7 @@
 
 int main() {
     
-    motor.period_us(motor_period);
+    motor.period_us(motor_PWM_period_us);
     motor = 0.5f;               //wypełnienie zawsze 50%
     pc.baud(115200);
 
@@ -24,7 +24,7 @@
     int SWITCH_DIR = 120;
     
     while (true) {        
-        wait_ms(SWITCH_DIR);
+        wait_us(motor_PWM_period_us);
         pc.printf("%.4f\n", get_voltage_in(ain0));        
         
 //        pc.printf("a1:%d\n",ain1.read_u16());
    