Show Posts
Pages: 1 ... 1889 1890 [1891] 1892 1893 ... 3293
28351  Using Arduino / Interfacing w/ Software on the Computer / Re: More MATLAB Trouble on: March 29, 2012, 04:56:31 pm
nt index = 0;
its initial value is 0 not garbage I am switching from 0 to 1 thats what is written in there.
Where? Here?
int index,i = 0;
That is creating two variables, index and i, and assigning i an initial value of 0. index does NOT get assigned an initial value.

I think it is setting the character array to null so no garbage is in it.
No. It is assigning only pressure[0] a value.

Comma does NOT mean "do this to all these variables...".
28352  Using Arduino / Programming Questions / Re: TVout library with EasyVR Shield on: March 29, 2012, 04:52:00 pm
  SoftwareSerial port(12,13);
  NewSoftSerial port(12,13);
What pins do the EasyVR and TVout libraries use?
28353  Using Arduino / Programming Questions / Re: SD Card and Ethernet lead to avrdude: stk500_recv(): programmer is not respondin on: March 29, 2012, 04:48:00 pm
Here is my code, I would take a guess that it is probably not very efficient
Efficient isn't really the issue.

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include "Dns.h"
#include <Wire.h>
#include <Ports.h>
#include <PortsSHT21.h>
#include <SHT2x.h>
#include <Time.h>
#include <SD.h>
Each of these gobbles memory. Some more (I was going to say worse, but that's not fair. They only take what they need) than others.

Serial.println("Failed to configure Ethernet using DHCP");
You could move this string into PROGMEM, using the F() macro:
Serial.println(F("Failed to configure Ethernet using DHCP"));
That saves some SRAM.

Serial.println("DNS resolve...");
Serial.print("DNS fail...");
        Serial.println("DNS resolve...");
Serial.print("Seconds since Jan 1 1900 = " );
Serial.print("Unix time = ");
Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT)
        Serial.println("This is the s ");
More stuff that could be moved.
28354  Using Arduino / Programming Questions / Re: Reading State on: March 29, 2012, 04:24:20 pm
How do you use a global variable?
Just like a local variable. In your sketch, LEDPin is a global variable.

int currState;
int prevState = HIGH;

void loop()
   currState = digitalRead(temt6000Pin);
   if(currState != prevState) // a transition occurred

28355  Using Arduino / Storage / Re: Saving files to SD card with time stamp on: March 29, 2012, 04:17:48 pm
However, the time library returns integers
Which are easily converted to strings in a number of ways. sprintf() is probably the easiest.

28356  Using Arduino / Interfacing w/ Software on the Computer / Re: More MATLAB Trouble on: March 29, 2012, 04:05:23 pm
servo[0], pwm[0], pressure[0] = '\0';
Tell me what you think this is doing?

int index
The variable index is a local variable, with no initial value. So, it contains some random garbage.

       switch (index){
So, you want to switch based on random garbage?

   if(aChar == ',')
        if (aChar == '\n')
         x = 1;
So, under what circumstances is the value in aChar going to morph from a command to a carriage return?

28357  Using Arduino / Programming Questions / Re: Reading State on: March 29, 2012, 03:46:27 pm
I'm trying to have a variable add one to the counter every time there is a state change from 0 to 1.
The only way to detect a state change is to keep track of the previous state. That requires a global or static variable, which you do not have.

I tried nested if...else statements but that had no success. I figured that a switch case would be better with an if statement built-in but it seems to ignore the if statement.
Your not even barking in the right forest, let alone the right tree.

  Any suggestions?
There's one up top.
28358  Using Arduino / Programming Questions / Re: FloatToString.h on: March 29, 2012, 03:40:38 pm
another question: why is this a ".h" file anyway? I thought header files are meant to be for pre-declarations, whereas this file is just code ?
The preprocessor doesn't care what type of file you try to include. You could include a .cpp file or a .jpeg file if you wanted to. By convention, though, only .h files are #included.

Typically, a header file contains declarations only, but there isn't anything to preclude having executable code in the header file.

Partly for my education, partly because it stands out as an annoying exception - none of my other function calls require me to include anything.
What other function calls are you referring to? You should see some of the files I create for work. Some of them have 40 or 50 other header files included. Don't complain about having to include one lousy file...

I did try cut and paste recently but I get this error:  'FloatToString' was not declared in this scope??
So, we'd need to see how you did it. Generally, all ino files are merged for compilation as a single file. so the function should be in scope.

could you provide a pointer to info about that call please?
Sure, but so can google, so, I'll defer.
28359  Using Arduino / Programming Questions / Re: Send command for RC Car on: March 29, 2012, 03:33:48 pm
But nothing appear in serial monitor of receiver, where is my mistake?
I don't know. So, add some more Serial.print() statements to the receiver.

Do the transmit and receive lights on the XBee shields blink appropriately?

The protocol we defined was <. letter, value, >. How is rduino! supposed to be converted to a value?
28360  Using Arduino / Programming Questions / Re: Can anyone help me fading 6 leds? on: March 29, 2012, 03:29:28 pm
On each pass through loop(), UpdateLedColours() gets called. That function increments a variable, phase, by 1. When phase get to 256, it is reset to 0, and zone is incremented.

Your code additions look fine. If the LEDs don't behave as you want, simply swap the code in case n with the code in case m, until the zone actions look right.
28361  Using Arduino / Programming Questions / Re: Store a value on: March 29, 2012, 03:10:15 pm
As I understand it, the Flash memory and EEPROM are completely separate entities. So anything you store in EEPROM will stay there until you clear it or overwrite it.

can you tell me how then?
The time between when you were told that it was possible, and given a big clue, and the time you asked this was insufficient for you to have done any real research, so, no.
28362  Using Arduino / Programming Questions / Re: First Steps on: March 29, 2012, 03:07:41 pm
and where i can find out the pin number of the switch?
Follow the wire from the switch to the Arduino? Which pin does the wire go into?
28363  Using Arduino / Programming Questions / Re: Send command for RC Car on: March 29, 2012, 03:02:07 pm
can you explain this line:     
inData is an array. It can hold 80 elements, in positions 0 to 79. If the position to insert the value in the array, stored in index, is less than 79 (should really be 78), then add the character at that position in the array. Then, increment the position to insert (the index++ part), and then insert a NULL at that position.
28364  Using Arduino / Programming Questions / Re: Store a value on: March 29, 2012, 02:56:37 pm
Is it possible to store a value so that it would be remembered after a powerloss?
Sure. That's why there is an EEPROM on board.
28365  Using Arduino / Programming Questions / Re: displaying temperature on 2 7 led displays. on: March 29, 2012, 02:53:57 pm
if you can help me i will be grateful
I'm sure you would. But, you would not have learned anything. I've given you enough clues for you to try something. Put some effort into piecing together a new sketch, and we'll help you over the rough spots.

We won't do it for you, unless you post in Gigs and Collaborations, with an enticing enough offer of money or ???
Pages: 1 ... 1889 1890 [1891] 1892 1893 ... 3293