help with alarm code

i dont need the serial monitor, but, the problem its that until i dont open the serial monitor arduino wont post anything....

and sorry for my ignorance, but why would i need a debounce?? i just need to recognize the change of state on the pin, so if it bounce, until only post one msg its ok for me....

and for the twitter error for posting the same msg i think that using a counter and 5 different msgs in a switch sentence, and the variablechar msg[] should be declared as a pointer...

do u think this make any logic???, if so later this day i will post a program to do that...

also thanks for your help it really helps me a lot

Post all of your current code please.

Depending on how it is written the debounce stops multiple messages being sent to Twitter.

this is my code but i doesnt compile, i cant find the error...

#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

int LedState=LOW ;
// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("YOUR-TOKEN-HERE");

// Message to post
char* msg[20];
char str1[]="post one";
char str2[]="post two";
char str3[]="post three";
char str4[]="post four";
char str5[]="post five";
char str6[]="post six";

void setup()
{
  digitalWrite(2, HIGH);
  attachInterrupt(0, alarm, RISING);
  
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  
 

void loop()

 int count=0;
  if (ledState == HIGH)
  {
    LedState==LOW;
    
    Swtich (count)
    { case 1:
    msg =& str1;
    count++;
    break
    
    case 2:
    msg =& str2;
    count++;
    break
    
    case 3:
    msg =& str3;
    count++;
    break
    
    
    case 4:
    msg =& str4;
    count++;
    break
    
    case 5:
    msg =& str5;
    count++;
    break
    case 6:
    msg =& str6;
    count=0;
    break;
    }
     }
    
    
    
   Serial.println("connecting ...");
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }

  
  }



 void alarm()
 {
  ledState = HIGH;
   
 }

but i doesnt compile, i cant find the error...

And we can't see them...

char* msg[20];

This is an array of 20 pointers, not a pointer to 20 characters, or an array of 20 characters.

i used that because IDE told that that if i use
char* msg[]; then the zise its unknown,

still the error says that i need an initializer before if functions....

also doesnot allow me to use the normal { on the start of the void loop()..... so im not sure where its my mistake... maybe i have many of then

still the error says that i need an initializer before if functions....

There is a big difference between

char *msg[20];

and

char msg[20];

The first is an array of 20 uninitialized pointers to characters. The second is an array of 20 characters.

Which do you need? I'm guessing that 20 uninitialized pointers are useless.

yes, but i need an array with pointer, so in the switch case depending on the counter, the pointer msg will be referenced to the array with the message

char* msg its the pointer i need..

its the pointer i need..

What does that point to? Without making it point somewhere, you can't store data at the pointed to location.

char* msg

Except msg doesn't point to anything. If it was written like this:

 char msg[20]

msg now points to a char that has 19 additional slots available for use.

ok, i have made some crrections but, still IDE says expected initializer before 'if'

[quote]
  [#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

int LedState=LOW ;
// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("YOUR-TOKEN-HERE");

// Message to post
char* msg[26];
char str1[]="post one";
char str2[]="post two";
char str3[]="post three";
char str4[]="post four";
char str5[]="post five";
char str6[]="post six";

void setup()
{
  digitalWrite(2, HIGH);
  attachInterrupt(0, alarm, RISING);
  
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  
 

void loop()

 
  if (ledState == HIGH)
  {
    LedState==LOW;
    
    Swtich (count)
    { case 1:
    msg =& str1;
    count++;
    break
    
    case 2:
    msg =& str2;
    count++;
    break
    
    case 3:
    msg =& str3;
    count++;
    break
    
    
    case 4:
    msg =& str4;
    count++;
    break
    
    case 5:
    msg =& str5;
    count++;
    break
    case 6:
    msg =& str6;
    count=0;
    break;
    }
     }
    
    
    
   Serial.println("connecting ...");
  if (twitter.post(*msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }

  
  



 void alarm()
 {
  ledState = HIGH;
   
 }
char* msg[26];

This is STILL wrong.

void setup()
{
  digitalWrite(2, HIGH);
  attachInterrupt(0, alarm, RISING);
  
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  
 

void loop()

Curly braces are NOT optional and not wherever the heck you feel like putting them.

The compiler is right. You DO have stuff before the if statement that doesn't belong there.

y see that mistake sorry if i didnt see it.....

and if i just call msg as an char pointer and not an array????

like char *msg;

still the compiler says im wrong in the if funtion

#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

int LedState=LOW ;
// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("YOUR-TOKEN-HERE");

// Message to post
char* msg[26];
char str1[]="post one";
char str2[]="post two";
char str3[]="post three";
char str4[]="post four";
char str5[]="post five";
char str6[]="post six";

void setup()
{
  digitalWrite(2, HIGH);
  attachInterrupt(0, alarm, RISING);
  
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  
  }

void loop()

 
  if (ledState == HIGH)
  {
    LedState==LOW;
    
    Swtich (count)
    { case 1:
    msg =& str1;
    count++;
    break
    
    case 2:
    msg =& str2;
    count++;
    break
    
    case 3:
    msg =& str3;
    count++;
    break
    
    
    case 4:
    msg =& str4;
    count++;
    break
    
    case 5:
    msg =& str5;
    count++;
    break
    case 6:
    msg =& str6;
    count=0;
    break;
    }
     }
    
    
    
   Serial.println("connecting ...");
  if (twitter.post(*msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }

  
  



 void alarm()
 {
  ledState = HIGH;
   
 }

What do you see as the first thing after "void loop ()"?
What do all correct sketches have that you do not?

Note also that LedState is not the same as ledState.
That may be important.

Also, "switch" needs to be spelled correctly, and not capitalised.

the void loop need to have an open brace.....

now that problem has clear, and the main problem now its that im using and incorrect call of the pointers

Really?

There was a comment earlier about braces being in the right places, and matching.

This is also important.

yes now the main problem its the pointer

#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>
int count;
int LedState=LOW ;
// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("YOUR-TOKEN-HERE");

// Message to post
char msg;
char str1[]="post one";
char str2[]="post two";
char str3[]="post three";
char str4[]="post four";
char str5[]="post five";
char str6[]="post six";

void setup()
{
  digitalWrite(2, HIGH);
  attachInterrupt(0, alarm, RISING);
  
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  
 }

void loop()

 {
  if (LedState == HIGH)
  {
    LedState==LOW;
    
    switch (count)
    { case 1:
    *msg =& str1;
    count++;
    break;
    
    case 2:
    msg =& str2;
    count++;
    break;
    
    case 3:
    msg =& str3;
    count++;
    break;
    
    
    case 4:
    msg =& str4;
    count++;
    break;
    
    case 5:
    msg =& str5;
    count++;
    break;
    case 6:
    msg =& str6;
    count=0;
    break;
    }
     }
    
    
    
   Serial.println("connecting ...");
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }

  
  }



 void alarm()
 {
  LedState = HIGH;
   
 }

yes now the main problem its the pointer

Don't hold back - feel free to share.

AWOL:

yes now the main problem its the pointer

Don't hold back - feel free to share.

this are tyhe errors the compilers shows

SimplePost.ino: In function 'void loop()':
SimplePost:50: error: invalid type argument of 'unary *'
SimplePost:55: error: invalid conversion from 'char (*)[9]' to 'char'
SimplePost:60: error: invalid conversion from 'char (*)[11]' to 'char'
SimplePost:66: error: invalid conversion from 'char (*)[10]' to 'char'
SimplePost:71: error: invalid conversion from 'char (*)[10]' to 'char'
SimplePost:75: error: invalid conversion from 'char (*)[9]' to 'char'
SimplePost:84: error: invalid conversion from 'char' to 'const char*'
SimplePost:84: error: initializing argument 1 of 'bool Twitter::post(const char*)'

"msg"" is a "char", not a "char" pointer.

you mean something like this???

char* msg;