Show Posts
Pages: 1 ... 40 41 [42] 43 44 ... 66
616  Using Arduino / Displays / Re: SSD1289 : question about the RD pin on: December 05, 2012, 08:02:48 pm
Ok I ask this because if they haven't connected it to a useable pin when designing that shield, that's probably for a good reason no?
617  Using Arduino / Displays / SSD1289 : question about the RD pin on: December 05, 2012, 05:51:25 pm
Hello, I have Sainsmart's 3.2" TFT display and adapter shield for Arduino Mega

I need to read data from GDDRAM, (to retrieve pixel color), in order to do that, I need to use the RD (Data Read) pin..which unfortunately isn't useable, look this picture:




The white line is the RD pin, and it's connected to Arduino's 3.3V through a 10k ohm resistor (I think it's a resistor)...

1) Any reason for it being connected to 3.3V? My guess is that it's connected here so the pin is always HIGH..am I right? (but then, why it's not connected to 5V?)

2) Can I use this RD pin if I solder a wire from it to an unused Arduino pin (such as D42 for example) ?


I hope someone can answer this!

Thanks in advance smiley
618  Using Arduino / General Electronics / Re: Superglue instead of solder? on: December 05, 2012, 05:27:25 pm
I used superglue few years ago to "solder" a wire to an (low voltage) interrupter...The interrupter had a long leg so I have surrounded it by 2 or 3 turns of wire to make sure it has good contact...

Not recommended, but it worked anyway smiley
619  International / Français / Re: librairie UTFT et MEGA on: December 05, 2012, 12:27:13 pm
Bonjour, retélécharge la UTFT sur le lien que tu as mis, on dirais que tu utilise une version modifiée ou une ancienne version.
620  Using Arduino / Programming Questions / [Solved] How to calculate a color based on 2 other colors on: December 04, 2012, 08:43:57 pm
Hello all, not sure if it's the right place to post this but anyway smiley

I would like to know how to calculate a color that my display should show when combining the background and foreground colors..

Not sure how to describe, but say I have an foreground RGB value that is white, and a background RGB value that is black. I would like to add some transparency to the foreground color, so it should display a grey on the black background.

How to do this (for any foreground/background combination) ? There must be some algorithms but I don't find, or don't know what to search for.

An example, in Paint.NET I make a red background, and then I place a yellow pixel with an alpha value of 200. Then use the color picker tool to retrieve the color of the pixel I've just placed:
Code:
          R    G    B      A
Red:     255,   0,   0    255
Yellow:  220, 216,   0    200

Result:  227, 169,   0    255

I can't find the calculation required to obtain this RGB result.

Thanks for any help smiley

Edit: I've found the answer!..

R = 227 = ( (200/255) * 220 ) + ( (1 - (200/255)) * 255 )
G = 169 = ( (200/255) * 216 ) + ( (1 - (200/255)) * 0 )
B = 0 = ( (200/255) * 0 ) + ( (1 - (200/255)) * 0 ) ... smiley
621  Using Arduino / Programming Questions / Re: Arduino Printing to LCD from Serial Port on: December 03, 2012, 10:18:14 am
Hello and welcome smiley

Show your code and we might be able to help smiley
622  Using Arduino / Programming Questions / Re: WiFly and Pachube sprinf question on: December 03, 2012, 08:45:15 am
And here you can see all the formatting parameters: http://www.cplusplus.com/reference/cstdio/printf/
623  Using Arduino / Programming Questions / Re: no matching function for call to 'Serial_::write(byte [2],int)' on: December 02, 2012, 01:16:50 pm
Hello and welcome,

Try replace:

Code:
byte id[2];
id[0] = readChar();
id[1] = readChar();
...
Serial.write(id, 2);
Serial.println();

by:

Code:
char id[3];
id[0] = readChar();
id[1] = readChar();
id[2] = '\0';
...
Serial.println(id);
624  Using Arduino / Programming Questions / Re: Serial problem with accentized characters on: December 02, 2012, 11:00:40 am
Argh! I've just noticed that IDE setting

Code:
preproc.substitute_unicode=true

I've changed it to false and now I don't need to use my function anymore! Oh well, at least I tried smiley

This setting should appear in the Preferences window...
625  Using Arduino / Programming Questions / Re: Serial problem with accentized characters on: December 01, 2012, 01:16:34 am
Ok there I fixed it, might be useful for someone else so I post it smiley

Code:
const uint8_t WINDOWS_1252 = 0;

int8_t SerialInputToCharSet( const char *src, char *dest, const size_t num = 128, const uint8_t charset = WINDOWS_1252);
int8_t SerialInputToCharSet( const char *src, char *dest, const size_t num, const uint8_t charset )
{
  uint8_t
    len = strlen( src );
  
  if ( len > num )
  {
    return -1;
  }
  
  uint8_t
    i = 0,
    j = 0,
    n = 0,
    c = 0;
    
  char
    tmp[num];

  switch ( charset )
  {
    case WINDOWS_1252 :
    {
      while ( i < len && j < num - 2 )
      {
        c = (uint8_t)src[i++];
        
        switch ( c )
        {
          case 0 ... 127 :
          {
            tmp[j++] = c;
            break;
          }
          case 128 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x82;
            tmp[j++] = 0xAC;
            n++;
            break;
          }
          case 130 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = 0x9A;
            n++;
            break;
          }
          case 131 :
          {
            tmp[j++] = 0xC6;
            tmp[j++] = 0x92;
            n++;
            break;
          }
          case 132 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = 0x9E;
            n++;
            break;
          }
          case 133 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = 0xA6;
            n++;
            break;
          }
          case 134 ... 135 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = c + 0x1A;
            n++;
            break;
          }
          case 136 :
          {
            tmp[j++] = 0xCB;
            tmp[j++] = 0x86;
            n++;
            break;
          }
          case 137 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = 0xB0;
            n++;
            break;
          }
          case 138 :
          {
            tmp[j++] = 0xC5;
            tmp[j++] = 0xA0;
            n++;
            break;
          }
          case 139 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = 0xB9;
            n++;
            break;
          }
          case 140 :
          {
            tmp[j++] = 0xC5;
            tmp[j++] = 0x92;
            n++;
            break;
          }
          case 142 :
          {
            tmp[j++] = 0xC5;
            tmp[j++] = 0xBD;
            n++;
            break;
          }
          case 145 ... 146 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = c + 0x7;
            n++;
            break;
          }
          case 147 ... 148 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = c + 0x9;
            n++;
            break;
          }
          case 149 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = 0xA2;
            n++;
            break;
          }
          case 150 ... 151 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = c - 0x3;
            n++;
            break;
          }
          case 152 :
          {
            tmp[j++] = 0xCB;
            tmp[j++] = 0x9C;
            n++;
            break;
          }
          case 153 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x84;
            tmp[j++] = 0xA2;
            n++;
            break;
          }
          case 154 :
          {
            tmp[j++] = 0xC5;
            tmp[j++] = 0xA1;
            n++;
            break;
          }
          case 155 :
          {
            tmp[j++] = 0xE2;
            tmp[j++] = 0x80;
            tmp[j++] = 0xBA;
            n++;
            break;
          }
          case 156 :
          {
            tmp[j++] = 0xC5;
            tmp[j++] = 0x93;
            n++;
            break;
          }
          case 158 :
          {
            tmp[j++] = 0xC5;
            tmp[j++] = 0xBE;
            n++;
            break;
          }
          case 159 :
          {
            tmp[j++] = 0xC5;
            tmp[j++] = 0xB8;
            n++;
            break;
          }
          case 160 ... 191 :
          {
            tmp[j++] = 0xC2;
            tmp[j++] = c;
            n++;
            break;
          }
          case 192 ... 255 :
          {
            tmp[j++] = 0xC3;
            tmp[j++] = c - 0x40;
            n++;
            break;
          }
          default :
          {
            tmp[j++] = '?';
            n++;
            break;
          }
        }
      }
    }
  }
  
  tmp[j] = '\0';
  strcpy( dest, tmp );
  return n;
}

void setup ()
{
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  if ( Serial.available() > 0 )
  {
    static char input[64];
    static uint8_t i;
    char c = Serial.read();

    if ( c != '\r' && i < 64-1)
      input[i++] = c;

    else
    {
      input[i] = '\0';
      i = 0;
      
      char s[256];
      sprintf( s, "In:  <%s>\n", input);
      int8_t n = SerialInputToCharSet( input, input );
      sprintf( s, "%sOut: <%s>\n%d character(s) converted!\n", s, input, n);
      Serial.print( s );
      
      if ( !strcmp( input, "€" )
        || !strcmp( input, "§" )
        || !strcmp( input, "abc" )
        || !strcmp( input, "olé" )
        || !strcmp( input, "h€lloéèàùlol" ) )
      {
        Serial.print( "strcmp: OK!\n\n" );
      }
      else
      {
        Serial.print( "strcmp: FAIL!\n\n" );
      }
    }
  }
}
626  Using Arduino / Programming Questions / Re: Data Type Conversion on: December 01, 2012, 12:44:20 am
Hello and welcome,

Try with type casting, like this:
Code:
char buffer[6];//time returns 6 char
sprintf(buffer, "%d:%d", RTC.hour, RTC.minute);

LCDA.DisplayString(0,0, (unsigned char*) buffer, 16);

It might be a better solution to modify the DisplayString function instead, or make an overloaded copy smiley
627  Using Arduino / Programming Questions / Re: HELP on: November 30, 2012, 10:46:05 pm
Hello and welcome,

That condition (once fixed by adding () smiley ) will never be true because your function doesn't return anything.

You have to do something like this:
Code:
if( FLOW() == 2 )
{
  //do something when FLOW() returns 2
}

...

int FLOW()
{
  if (digitalRead(buttonPin))
  {
    return 1;
  }

  else if (digitalRead(buttonPin2))
  {
    return 2;
  }

  return 0;
}

Also don't double post, click the Remove button near your posts in the other topic, write a clear topic title not just "HELP"... and use code tags (the '#' button) around your code smiley
628  Using Arduino / General Electronics / Re: Relay wiring help/confirmation? on: November 30, 2012, 08:14:49 am
Yes tkbyd is right smiley

Sorry if that wasn't clear, the square-round things are standard wall-sockets (of France)...the one at the top is the one in the wall, the 2 other on the right are to connect devices that will be controlled by the relays smiley
629  International / Français / Re: [Projet en cours] Enlightened Domotics Alarm Monitoring System(EDAMS) on: November 30, 2012, 12:59:40 am
C'est pas mal du tout, je n'utilise pas Linux et je n'ai aucune raison d'utiliser ce programme... mais ça à l'air bien pratique smiley

Bonne chance pour la suite smiley
630  Using Arduino / Programming Questions / Re: Logging multiple temp sensors question ( multiple values and sprintf() ) on: November 29, 2012, 10:31:51 am
But you must NOT use my loop smiley you must just follow the "shape", your code must look like this:
Code:
char buf[128] = "\0"; // IMPORTANT

for (sensor=0;sensor<MAX_DS1820_SENSORS;sensor++)
{
    // rest of your code here
    //...

    Fract = Tc_100 % 100;

    sprintf(buf, "%s%c%d.%d,", buf, SignBit ? '-' : '+', Whole, Fract < 10 ? 0 : Fract); //modified sprintf
}

sprintf(buf, "%s%s", buf, "11/12/13-12:34:56");
Serial.print(buf); // this moved outside of the loop
Pages: 1 ... 40 41 [42] 43 44 ... 66