test

Dependencies:   mbed

Revision:
2:549286fb28d4
Parent:
1:ceefb922cff9
Child:
3:63e99a7361ec
diff -r ceefb922cff9 -r 549286fb28d4 main.cpp
--- a/main.cpp	Mon Dec 10 14:34:16 2018 +0000
+++ b/main.cpp	Tue Dec 11 07:20:30 2018 +0000
@@ -17,7 +17,7 @@
 Timer timerProgram;
 
 //nastavitev pwm signalov
-PwmOut pwm1 (p21);            //
+PwmOut pwm1 (p21);            
 PwmOut pwm2(p22);
 
 //dodano za merjenje toka in napetosti
@@ -97,14 +97,16 @@
         else if(start2 == 0)
         {
             myled_green  = ON;
+            PwmOut pwm1 (p21);            
+            PwmOut pwm2(p22);
             printf ("\r\n");
             printf ("<------- \r\n");
             
             //merjenjeTokaInNapetosti();
             
             //nastavitev pwm period
-            pwm1.period_ms(100);
-            pwm2.period_ms(100);
+            pwm1.period(0.001f);
+            pwm2.period(0.001f);
             
             pwm1=0;
             pwm2=0;
@@ -120,18 +122,18 @@
             //izvajanje krmilja
             printf ("PWM set \r\n");
             
-            pwm1.pulsewidth_ms(20);
+            pwm1.write(0.2f);
             
             printf("pwm1 read: %f\n\r",pwm1.read()); 
             printf("pwm2 read: %f\n\r",pwm2.read()); 
             wait(0.1);
             
             printf ("PWM set \r\n");
-            pwm1.pulsewidth_ms(60);
+            pwm1.write(0.6f);
             
             printf("pwm1 read: %f\n\r",pwm1.read()); 
             printf("pwm2 read: %f\n\r",pwm2.read()); 
-            wait(0.2);
+            wait(0.1);
             printf ("PWM off \r\n");
             pwm1 = 0;
             pwm2 = 0;