2727#define Sample12ClockWithContinuouslyControlledMotor
2828//#define Sample13SimplifiedDevelopment
2929
30+ using System ;
31+ using System . Diagnostics ;
3032using System . Threading ;
3133
3234namespace AbstractIO . Netduino3 . Samples
@@ -43,7 +45,7 @@ public static class Netduino3SamplesMain
4345 public static void Main ( )
4446 {
4547
46- AbstractIO . AdafruitMotorShieldV2 . AdafruitMotorShieldV2 shield ;
48+ // AbstractIO.AdafruitMotorShieldV2.AdafruitMotorShieldV2 shield;
4749
4850
4951#if Sample01SimpleBlinker
@@ -414,7 +416,7 @@ public static void Main()
414416 // So the relation of pulse detection to minutes is 1/14/22 and thus the turnaround time of the detecting
415417 // worm is 3600 s / 14 / 22 ≈ 11,69 seconds (rounded).
416418
417- shield = new AdafruitMotorShieldV2 . AdafruitMotorShieldV2 ( ) ;
419+ var shield = new AdafruitMotorShieldV2 . AdafruitMotorShieldV2 ( ) ;
418420
419421 // Let a lamp blink in one-second-intervals:
420422 // Start a blinking seconds lamp calmly going on in one second and off again in the next:
@@ -564,7 +566,24 @@ public static void Main()
564566 Thread . Sleep ( Timeout . Infinite ) ;
565567
566568#else
567- #error Please uncomment exactly one of the samples.
569+ //#error Please uncomment exactly one of the samples.
570+
571+ var startTime = DateTime . UtcNow ;
572+ int periods = 0 ;
573+
574+ var timer = new Timer (
575+ ( state ) =>
576+ {
577+ periods ++ ;
578+ double s = DateTime . UtcNow . Subtract ( startTime ) . TotalSeconds ;
579+ double p = periods ;
580+ Debug . WriteLine ( p . ToString ( ) + " | " + s . ToString ( ) + " | " + ( ( p - s ) / s ) . ToString ( ) ) ;
581+ } ,
582+ null ,
583+ 1000 ,
584+ 1000 ) ;
585+
586+ System . Threading . Thread . Sleep ( Timeout . Infinite ) ;
568587#endif
569588 }
570589 }
0 commit comments