Search the Community
Showing results for tags 'millis'.
-
I've written a 7-segment refresh routine that runs every 2 millis at the beginning of loop(). It starts this way: void loop() { CURmillis = millis(); if ((CURmillis - PREVmillis) > 1) { // 2ms refresh period = 71 Hz per segment digitalWrite(18,HIGH); PREVmillis = CURmillis; // Turn the current segment OFF while making changes - prevents ghosting digitalWrite(SEGARRAY[SEGCOUNT], SEGOFF); The digitalWrite to pin 18 has been added so I can measure how long the refresh routine takes to run. Pin 18 is turned off as the last instruction in loop(). S
-
Hello, i have some strange problem while using Energia on my Stellaris Launchpad. On reference sites is written that millis overflows after approximately 50 days, but mine wont last longer then 53 seconds. Here is the code used just for displaying int blueL = 40; int blueState = 0; unsigned long time; unsigned long test_time; void setup() { Serial.begin(9600); pinMode(blueL,OUTPUT); time = millis(); } void loop() { if (millis() - time > 1000) { digitalWrite(blueL,blueState); blueState = !blueState; time = millis(); } test_time = millis(); Serial.print("curren
-
Hello is there a similar library in energia ? http://playground.arduino.cc/Code/SimpleTimer or how can i execute a piece of code for X seconds. Thanks sirri