Show Posts
Pages: 1 ... 40 41 [42] 43 44 ... 68
616  Using Arduino / Programming Questions / Re: RTCLib parsing on: December 09, 2012, 03:02:56 pm
An easier method to write all your 7 segments displays at once (assuming you want hours, minutes and seconds):
Code:
char time_str[7];
sprintf( time_str, "%02d%02d%02d", now.hour(), now.minute(), now.second() );

for (uint8_t i = 0; i < 6; i++ )
  matrix.writeDigitNum( i+1, time_str[i] - '0' ); //not sure if the first 7-seg is id 1 but whatever, modify if needed
617  Using Arduino / Project Guidance / Re: Another Nub in Trouble !! on: December 09, 2012, 01:55:31 pm
Hello and welcome aboard nub smiley

One thing at a time, learn how to use each parts separately, only then you will be able to mix them all together. I suggest you start by learning how to use your rotary encoder, if you have problems with this first part then post your code smiley

Edit: Yeah, what Vasquo said, but I like to start with the hardest part so that list is upside down for me smiley-wink
618  Using Arduino / General Electronics / Re: About to buy some resistors on: December 09, 2012, 01:08:52 pm
I finally bought a big pack on ebay too, it was much cheaper than buying separately on some electronic site... I paid less than 6€ (7.5$) for 1000 resistors (50 values, 20 of each) shipping included, I know I don't even need 5% of those now... but maybe in some years smiley-cool

ebay 230688889689
619  Using Arduino / General Electronics / Re: About to buy some resistors on: December 09, 2012, 08:01:35 am
Thank you all smiley-wink
620  Using Arduino / General Electronics / About to buy some resistors on: December 09, 2012, 07:24:33 am
Hello, I'm about to buy some resistors, I would like to know which values do you recommend that are good to have to make tests etc...

I know I need values between 50 - 500 ohms for example for LEDs, I also need 4.7k (or 10k?) ohms for pull ups for my DHT22/DS18B20 sensors..

But appart from those values, which ones are good to have ready? I probably don't need values like 1 ohm, or 10 M ohm, right? Please suggest common values for arduino projects.

Thanks smiley
621  Using Arduino / Programming Questions / Re: don't load the code on: December 09, 2012, 03:21:25 am
Hello, yes post all your code (as an attachment to your reply), and which Arduino model do you use?
622  Using Arduino / Programming Questions / Re: Converting floating point to a string, most efficient way? on: December 09, 2012, 03:14:55 am
Go in <arduino install folder>/hardware/tools/avr/avr/, here you have a lib folder: make a copy (or a zip) of it, as a backup.

Download the file I linked, open it, select all the files in it and drag and drop in that lib folder. It will ask you to replace files and folders, click Yes to All and it's ready, now you can use %f etc in sprintf and sscanf smiley
623  Using Arduino / Displays / Re: ITDB02 TFT LCD module is not sensing touch on: December 09, 2012, 01:44:32 am
I see your problem...sorry to tell you that, but you can't use the touch feature with the "ITDB02 Arduino shield v2.0" :



There is not enough pins on the Arduino UNO to enable both SD card reader and Touchscreen...

You should have purchased an Arduino Mega and the Mega shield smiley-sad

624  Using Arduino / Programming Questions / Re: Moving from one value to another on: December 09, 2012, 01:19:12 am
Hello and welcome smiley

I think you need to use a "swap" function:
Code:
void swap( int &a, int &b )
{
   int c = a;
   a = b;
   b = c;
}

...

if ( a > b )
{
  swap( a, b );
}

It will then be easier to handle a and b in a single for loop smiley
625  Using Arduino / Programming Questions / Re: 4x3 led grid array function? on: December 09, 2012, 12:50:41 am
Yes, it's possible with an array, but you could do something like that, instead of an array for each mode, have a single integer:

Code:
// the pins where each led is connected, in reverse order
const uint8_t LED_Pins[] = { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };

// set a mode using a single int
const uint16_t MODE_1 = 0b111101101111; // this is your example (middle LEDs OFF) in one line
 
void SetLEDArrayMode( uint16_t mode )
{
  for (uint8_t i = 0; i < 12; i++)
    digitalWrite( LED_Pins[i], bool( mode & (1 << i) ) );
}
 
void setup()
{
    SetLEDArrayMode( MODE_1 );
}

Note, the reverse order is because using this method, the bits are read in reverse order too. But if your modes are always "symmetrical", then the order of the pins array will have no importance.. smiley-cool
626  Using Arduino / Programming Questions / Re: How can I simplify this simple code? (Again...) on: December 08, 2012, 11:57:26 pm
Hello,

- you could use char arrays instead of the String class
- Serial buffer's size is 64 bytes only (for Arduino Mega, for some other boards it's 16 I believe)
- do not use delay() or blocking code such as your while loops, especially if the thing is a plane autopilot smiley

For non blocking Serial reads you can do something like that:
Code:
void loop()
{
  if ( Serial.available() > 0 )
  {
    static char input[64];
    static uint8_t i;
    char c = Serial.read();

    if ( c != '#' && i < 63)
      input[i++] = c;
    
    else
    {
      input[i] = '\0';
      i = 0;

      //process the input string here
      Serial.println( input );
    }
  }
}
627  Using Arduino / Displays / Re: ITDB02 TFT LCD module is not sensing touch on: December 08, 2012, 11:39:45 pm
Hello and welcome smiley,

Try with the UTFT and UTouch libraries:

http://www.henningkarlsen.com/electronics/library.php?id=51
http://www.henningkarlsen.com/electronics/library.php?id=55

You display model for UTFT will be ITDB28
628  Using Arduino / Programming Questions / Re: Converting floating point to a string, most efficient way? on: December 08, 2012, 11:28:04 pm
For enabling floats in sprintf (and sscanf) you can install this in \hardware\tools\avr\avr\lib (make a backup of that lib folder, and then extract and replace files): http://arduino.cc/forum/index.php?action=dlattach;topic=124809.0;attach=27144

Another option is to use dtostrf (I believe it's more efficient, and use much less memory than sprintf with FP enabled): http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html#ga060c998e77fb5fc0d3168b3ce8771d42
629  Using Arduino / Programming Questions / Re: Check if GPS is within a polygonal area on: December 08, 2012, 06:23:12 am
Shall I make a reference to you(the maker) or the original code in my code somewhere?

Absolutely not to me, I didn't make this function and I don't know who did (it's probably older than the first computer) smiley

Karma++ to guix.....

Thanks smiley-wink
630  Using Arduino / Programming Questions / Re: Check if GPS is within a polygonal area on: December 08, 2012, 04:57:34 am
Good smiley
Pages: 1 ... 40 41 [42] 43 44 ... 68