Show Posts
|
|
Pages: 1 [2] 3 4 ... 66
|
|
17
|
Using Arduino / Programming Questions / Re: How to make global variables accessible to libraries/classes?
|
on: May 10, 2013, 06:57:45 am
|
since the Arduino IDE doesn't allow me to define classes in the sketch
Now I am puzzled. What gave you this idea? The IDE doesn't enforce syntax, and the compiler is a C++ compiler. It would help to understand the current organization of the code a little better. Where are the globals declared in your big pile of code? And where are they defined? Can you post the code, piecemeal if needed, in code tags, please? -br
|
|
|
|
|
18
|
Using Arduino / Programming Questions / Re: Variable scope and RAM
|
on: May 09, 2013, 08:16:22 pm
|
|
Yes, because C locals live on the stack.
Once the procedure defining a local variable returns, the location on the stack reserved for that local is released with the rest of the stack frame to become free stack space (or more properly free space between the stack and the malloc heap).
-br
|
|
|
|
|
19
|
Using Arduino / Programming Questions / Re: How to reset the values in a char pointer array
|
on: May 09, 2013, 07:07:27 pm
|
it won't run the rest of the code to save the file, like it does the first time you run it So, what happens instead?
You need to go on the attack and instrument your program to tell you where it's screwing up. Sprinkle Serial.print() statements near where you think it's leaving the tracks. Log a word to say where you are, or an important value. Soon you will find some output that is not what you expect, something wrong the second time. It will lead you to your bug.
It may not be doing the right thing the second time around, but it is doing something. Figure out what that wrong thing is, and you'll be on the way to making it work.
Good luck with your project.
-br
PS: It wouldn't hurt to re-terminate your input arrays every time you add a a character to them.
|
|
|
|
|
20
|
Using Arduino / Programming Questions / Re: How to reset the values in a char pointer array
|
on: May 09, 2013, 06:56:06 pm
|
the problem is when you run through it again it doesn't work
What does "it doesn't work" mean? What does it do that you don't expect, or not do that you do expect, when you clear the arrays using memset or setting the zeroeth element to zero? "It doesn't work" is the world's worst bug report, because it tells us nothing. -br
|
|
|
|
|
21
|
Using Arduino / Programming Questions / Re: How to reset the values in a char pointer array
|
on: May 09, 2013, 06:47:26 pm
|
This is a very creative way to terminate a char array: strcpy(money+money_index, ""); //converts to pointer array
But this would work the same and generate less object code: money[money_index] = 0;
Could you state your problem description more clearly, please? What are you trying to accomplish, and what seems to be going wrong? -br
|
|
|
|
|
27
|
Using Arduino / General Electronics / Re: Arduino Powers on With Power Applied to Input Pin
|
on: May 09, 2013, 06:37:53 am
|
I have all of the inputs running through 7805 voltage regulators to bring the power down to 5V.
This is quite creative, but it guarantees the inputs will have all the power you need to cook your arduino. Have you considered a more conventional approach to conditioning the inputs like opto-isolation or even a resistor divider? -br
|
|
|
|
|
28
|
Using Arduino / Networking, Protocols, and Devices / Re: PHP data transfer with official Wifi shield
|
on: May 08, 2013, 08:32:18 pm
|
I think I see a bug that may account for the problem you're seeing. It's this same line of code: String url = "http://my_website.com/update.php?ID=1&DATA=0";
The url that is sent in a get request is not supposed to include the http://mywebsite.com part. Just the url relative to the server. So, this might work better for you, and fix the String / char* thing at the same time: char *url = "/update.php?ID=1&DATA=0";
I wouldn't be surprised if you were getting an error in your error log before, and I bet this change would help. -br
|
|
|
|
|
30
|
Using Arduino / Networking, Protocols, and Devices / Re: PHP data transfer with official Wifi shield
|
on: May 08, 2013, 07:43:52 pm
|
You've already confirmed the script works, so echo must be okay: it shows up fine when I access the script from my browser
Is the arduino looking for any kind of a header on the returned data
Not until you write some code that says client.read(). There is no magic. You have to read every character of the response, starting with the headers. -br Edit: It might be worthwhile to check out the ethernet webclient example…
|
|
|
|
|