Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #45 on: March 14, 2013, 04:02:00 pm » |
I think I am too. Perhaps we could have a code update.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
0
Offline
Sr. Member
Karma: 1
Posts: 333
UNO
|
 |
« Reply #46 on: March 14, 2013, 04:05:20 pm » |
*msg =& str1; The type of "*msg" is "char", but you're trying to assign an address to it. That's why the compiler is upset. i understand that but, how can assing the variable and not the address??
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #47 on: March 14, 2013, 04:09:50 pm » |
Why don't you post the current code?
"*msg" is what "msg" points to, which is a "char"; you cannot assign an address (another pointer) to a "char"
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
0
Offline
Sr. Member
Karma: 1
Posts: 333
UNO
|
 |
« Reply #48 on: March 14, 2013, 04:11:39 pm » |
this is the code so #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; }
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #49 on: March 14, 2013, 04:17:58 pm » |
char* msg[26]; What's that? Swtich (count) Up to a point, people will be willing to help, but if you start just posting garbage that has been pointed out before, they'll get bored and drift away.
|
|
|
|
« Last Edit: March 14, 2013, 04:23:24 pm by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
0
Offline
Sr. Member
Karma: 1
Posts: 333
UNO
|
 |
« Reply #50 on: March 14, 2013, 04:27:43 pm » |
sorry for that i dindt save the last code mods... #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=0; 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; } this is still bad assigned pointer, but i dont know how to assing a char pointer to a char variable, sorry for that
|
|
|
|
« Last Edit: March 14, 2013, 04:29:39 pm by copachino »
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #51 on: March 14, 2013, 04:30:39 pm » |
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
0
Offline
Sr. Member
Karma: 1
Posts: 333
UNO
|
 |
« Reply #52 on: March 14, 2013, 04:32:29 pm » |
ok that really helps me out, now there its only one error SimplePost.ino: In function 'void loop()': SimplePost:84: error: invalid conversion from 'char' to 'const char*' SimplePost:84: error: initializing argument 1 of 'bool Twitter::post(const char*)'
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #53 on: March 14, 2013, 04:33:43 pm » |
I don't have the Twitter library (nor do I intend getting it), so that one's up to you. Enough clues have already been provided (see reply #47)
|
|
|
|
« Last Edit: March 14, 2013, 04:43:13 pm by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #54 on: March 14, 2013, 06:21:09 pm » |
if (LedState == HIGH) { LedState==LOW;
Time to start reading a basic C tutorial. Don't just thrash around posting whatever comes into your head. Do some simple programs first. Get the hang of it. Trying to do Twitter in your first code is ridiculous.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #55 on: March 14, 2013, 06:22:52 pm » |
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; } }
And read up on using arrays. Won't you get bored copying and pasting when you end up with 100 messages?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 1
Posts: 333
UNO
|
 |
« Reply #56 on: March 14, 2013, 06:31:20 pm » |
if (LedState == HIGH) { LedState==LOW;
Time to start reading a basic C tutorial. Don't just thrash around posting whatever comes into your head. Do some simple programs first. Get the hang of it. Trying to do Twitter in your first code is ridiculous. nick its not my first code, but i did have pratice for long so im kind stck here, that if sentence was proposed by someone on tne debounce thing, so im not used to that i ust leave it that way.....
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 1
Posts: 333
UNO
|
 |
« Reply #57 on: March 14, 2013, 06:59:28 pm » |
so finaly have manage to get it work this its the code #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=0; 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; }
|
|
|
|
|
Logged
|
|
|
|
|
|