AndrewMascolo / CountUpDownTimer

MIT License
28 stars 20 forks source link

Timer stopping after a few milliseconds #4

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi, I was having an issue where the counter would stop after a few milliseconds , thinking it was something i did ,so i've stripped everything out into a new sketch and copied the demo code and i'm seeing the same problem.

The idea is that when a menu is selected ,the timer should start counting up , displaying the value all the while . It's about as simple as that. For this purpose I have stripped all code out and to all intents and purposes am just running your demo code , with a few libraries added as am using the following hardware..

Arduino duo RS-232 shield 1.8" tft with joystick and SD card

I am expecting for this counter to just count upwards with no need for anything to be held high etc. is this the case? The intent is to reset the counter by mapping it to the joystick .

Very Short video of whats happening --> https://dl.dropboxusercontent.com/u/2176316/20160110_220703.mp4

Thanks in advance ..Tim

code ... i have removed the opening '<' on include files so you can see which libraries are used

include Adafruit_GFX.h> // Core graphics library

include Adafruit_ST7735.h> // Hardware-specific library

include SPI.h>

include SoftwareSerial.h>

SoftwareSerial mySerial = SoftwareSerial(2, 3);

include CountUpDownTimer.h>

CountUpDownTimer T(UP);

// For the breakout, you can use any 2 or 3 pins // These pins will also work for the 1.8" TFT shield

define TFT_CS 10

define TFT_RST 9 // you can also connect this to the Arduino reset

// in which case, set this #define pin to 0!

define TFT_DC 8

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

void setup() {

mySerial.begin(9600); // initialize the serial communications: tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab tft.setRotation (1); //set orientation of the screen tft.fillScreen(ST7735_BLACK);// fill screen black to start

T.StartTimer(); }

void loop() { T.Timer(); // run the timer tft.setCursor(2, 10); tft.setTextSize(2); tft.setTextColor(ST7735_GREEN, ST7735_BLACK);

if (T.TimeHasChanged() ) // this prevents the time from being constantly shown. { tft.print(T.ShowHours()); tft.print(":"); tft.print(T.ShowMinutes()); tft.print(":"); tft.print(T.ShowSeconds()); tft.print(":"); tft.print(T.ShowMilliSeconds()); tft.print(":"); tft.println(T.ShowMicroSeconds()); } }

AndrewMascolo commented 8 years ago

Sorry about that. I found the issue and I will post the fix soon. The problem was a missing operator ( ! ) in the TimeCheck function. All you need to do is change _type to !_type. Save it and it should work.

Sent from my iPhone

Sent from my iPhone

On Jan 10, 2016, at 5:26 PM, o0timbo0o notifications@github.com wrote:

Seems the include files were removed , to show , i have removed the opening '<'

include Adafruit_GFX.h> // Core graphics library

include Adafruit_ST7735.h> // Hardware-specific library

include SPI.h>

include SoftwareSerial.h>

SoftwareSerial mySerial = SoftwareSerial(2, 3);

include CountUpDownTimer.h>

CountUpDownTimer T(UP);

// For the breakout, you can use any 2 or 3 pins // These pins will also work for the 1.8" TFT shield

define TFT_CS 10

define TFT_RST 9 // you can also connect this to the Arduino reset

// in which case, set this #define pin to 0!

define TFT_DC 8

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

void setup() {

mySerial.begin(9600); // initialize the serial communications: tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab tft.setRotation (1); //set orientation of the screen tft.fillScreen(ST7735_BLACK);// fill screen black to start

T.StartTimer(); }

void loop() { T.Timer(); // run the timer tft.setCursor(2, 10); tft.setTextSize(2); tft.setTextColor(ST7735_GREEN, ST7735_BLACK);

if (T.TimeHasChanged() ) // this prevents the time from being constantly shown. { tft.print(T.ShowHours()); tft.print(":"); tft.print(T.ShowMinutes()); tft.print(":"); tft.print(T.ShowSeconds()); tft.print(":"); tft.print(T.ShowMilliSeconds()); tft.print(":"); tft.println(T.ShowMicroSeconds()); } }

— Reply to this email directly or view it on GitHub.

ghost commented 8 years ago

Thanks for the fast response !! , fixed it my end , works great . Thank you !