Make 2171 Great Again

Dependencies:   mbed

Revision:
1:f1d2d02d724d
Parent:
0:d229bc2fa375
--- a/main.cpp	Mon Dec 02 23:29:32 2019 +0000
+++ b/main.cpp	Wed Dec 04 02:36:34 2019 +0000
@@ -33,8 +33,8 @@
         DAC->DHR12R1 = (ADC1->DR);                       //   set ADC value to DAC
         
         //set reference
-        if (Lcount == 250) {            U_ref = 1.0f; ref_trig = 1;}
-        if (Lcount == 500) {Lcount = 0, U_ref = 0.5f; ref_trig = 0;}
+        if (Lcount == 250) {            U_ref = 0.050f; ref_trig = 1;}   //50 mA
+        if (Lcount == 500) {Lcount = 0, U_ref = 0.025f; ref_trig = 0;}   //25 mA
         Lcount++;
         
         
@@ -51,8 +51,8 @@
 
         // Bang-bang controller is written below. Replace this with your PI controller.
         
-        if (U > 4096*0.5f) { Y = 0.1f*1440.0f; }   // ADC readings scaled correctly
-        if (U < 4096*0.2f) { Y = 0.9f*1440.0f; }
+        if (U > 4096*0.4f) { Y = 0.3f*1440.0f; }   // ADC readings scaled correctly
+        if (U < 4096*0.2f) { Y = 0.7f*1440.0f; }
         
         
         // end controller