Show Posts
Pages: 1 ... 38 39 [40] 41 42 ... 253
586  Using Arduino / Displays / Re: displaying time on LCD on: June 17, 2014, 04:21:32 pm
Yea, use the millis() or micros() function.

unsigned long prevTime = millis(); // current time in milliseconds

/* some function or code segment */

Serial.println( millis() - prevTime ); // time difference
587  Using Arduino / Project Guidance / Re: Need help with 4x4 Keypad Matrix on: June 17, 2014, 03:58:45 pm
CrossRoads, What does that keypad do or control?
588  Using Arduino / Displays / Re: displaying time on LCD on: June 17, 2014, 03:20:44 pm
Serial.print takes time to display, and since you have multiple of them your code is going to slow down a bit.

You can condense a lot the Serial.prints with the sprintf or sprintf_P functions.
589  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 17, 2014, 02:37:06 pm
No a FOR loop to cycle through the array and change the cursor position.

Quote
If Strings are used properly they are safe.
There is an issue with the free() function, and the arduino does not have a way to clean the memory fragments the Strings make.
590  Using Arduino / Displays / Re: showing time in arduino on: June 17, 2014, 02:23:42 pm
Quote
record var[5000];
How much RAM do you think the Arduino has?
591  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 17, 2014, 02:16:47 pm
Use a pointer or a simple FOR loop.
592  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 17, 2014, 02:06:18 pm
NO, stay away from Strings, use C strings(char array) instead.
593  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 17, 2014, 01:27:28 pm
Its flickering because its printing 1 and 0 in the same spot very fast.
594  Using Arduino / Project Guidance / Re: For those who are good at programming! on: June 17, 2014, 01:19:13 pm
So you need a variable to hold a value between 0 and 180, and you need two buttons to increment and decrement that variable.
That's simple, but were not going to write the code for you.
595  Using Arduino / Project Guidance / Re: [Help] Creating a menu for non touch TFT Screen on: June 17, 2014, 11:07:22 am
Rising is the transition from low to high, and falling is high to low.
AttachInterrupt Look that the pins used for the interrupts, because there are only so many per board type, and the pins a very specific.
596  Using Arduino / Project Guidance / Re: [Help] Creating a menu for non touch TFT Screen on: June 17, 2014, 10:59:29 am
Where is the button that you want to use the switch the screens?

For the button I would use an interrupt routine that looks for the button state as either "rising" or "falling"  (depending on how the button is wired). Then in the interrupt function, you would increment a counter.

For the switch statements, you could have: ( you might not need the while loop)
switch( counter % 2 )
{
  case 0:
     /* Voltage stuff */
     break;

  case 1:
     /* Current stuff */
     break;
}
597  Using Arduino / Project Guidance / Re: [Help] Creating a menu for non touch TFT Screen on: June 17, 2014, 10:23:33 am
Quote
if (xPos >= 150) {
    xPos = 0;
    TFTscreen.noStroke();
    TFTscreen.fill(250,200,200);
    TFTscreen.rect(11,0,150,118);
      }
  else {

    xPos++;
  }

Why are you constantly redrawing the lines? Only when you get a new value should the line change.

When you use the case statement, your "graphs" should be within a while loop, this way only the things related to that graph should be running and not everything. You could also use an Interrupt on the button to change the case.

On second thought, how many screens are you switching between, you might not even need case statement, just an IF/ELSE statement.
598  Using Arduino / Project Guidance / Re: [Help] Creating a menu for non touch TFT Screen on: June 17, 2014, 09:56:23 am
Post your code as either an attachment (.ino file) or in code tags( of which can be found above the smiley faces as the # button)
599  Using Arduino / Project Guidance / Re: Want to read two serial ports on demand on: June 17, 2014, 09:01:15 am
Quote
Serial.begin(2400);  // start serial to PC
Why so slow? Bump it up to 115200, its better.

Quote
But only one reader works at one time.
Of course, the arduino cannot multi-thread, it can only do things one after the other. You can give the appearance of multi-threading by switching between everything very fast, and instead of using FOR loops to cycle through and collect the data, you should use IF statements and keep track of their individual counts.
600  Using Arduino / Project Guidance / Re: [Help] Creating a menu for non touch TFT Screen on: June 17, 2014, 08:45:04 am
You can make a simple menu with case statements. just make sure you only run the things you need to per screen otherwise it will slow down your processing time.

If you need to monitor both diagrams with real time values, you can make your variables volatile, but again it may slow things down if you have too many things running.
Pages: 1 ... 38 39 [40] 41 42 ... 253