Show Posts
Pages: 1 ... 2248 2249 [2250] 2251 2252 ... 3072
33736  Using Arduino / Programming Questions / Re: Optimization on: July 10, 2011, 07:50:34 am
The random part, I changed it to better suit what I was looking for, and don't use randomSeed() at all now.
If what you were looking for was the same set of random numbers to be generated, you have definitely achieved that goal. If not, you want to call randomSeed(), once, at some point.

Oops. I guess I do use them... I could change that code to (ledArray[?], HIGH); but that seems to be just more typing to the same effect.
If you are not going to use the array, why define it? I don't see that it is all that useful with such a small number of elements. On the other hand, all the constant pin numbers, in the pinMode and digitalRead statements have go to go. What happens if you need to change a pin?

The function thing will rock if I get it working right.
Yes, it will.
33737  Using Arduino / Project Guidance / Re: help with usb host shield on: July 09, 2011, 09:42:01 pm
the codes i need are usb.cpp and usb.h, wiiremote.cpp and wiiremote.h so can someone please help me on how to upload those into the host shield.
The host shield manages the hardware side of things. The Arduino is where code is loaded. The header files and source code files go in a folder in the libraries directory, and the header files are referenced in the sketch.

Have you put the files in the right place?
33738  Using Arduino / Project Guidance / Re: Would love feedback on first solo code for project on: July 09, 2011, 09:38:57 pm
The first one "A" isn't averaging the temps any more and when I look at the serial Monitor, it shows the same temperature for every value.  It never changes.
Since you don't print the individual readings, how do you know where the problem is? The problem could be that the thermocouple reading never changes. Or, it could be something with the way that the average is computed. You need to determine whether it is a hardware problem (the thermocouple) or a software problem (running average computation). Only then can you hope to fix it.
33739  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino to Webserver on: July 09, 2011, 09:26:00 pm
aJsonObject* parse(FILE* stream); //Reads from a stream
aJsonObject* parse(FILE* stream,char** filter_values); //Read from a file, but only return values include in the char* array filter_values
aJsonObject* parse(char *value); //Reads from a string
There are three forms of the parse function, none of which match what you are trying to do.

So, what are you trying to do?

What is the first value in the parse() call supposed to represent?
33740  Using Arduino / Programming Questions / Re: Optimization on: July 09, 2011, 09:09:37 pm
// Name LED pins
int led1 = 3;
int led2 = 5;
int led3 = 6;
int led4 = 7;
int led5 = 8;
int led6 = 9;
int led7 = 10;
int led8 = 11;

// Setup LED pins for loops

int ledArray[] = {3, 5, 6, 7, 8, 9, 10, 11};

  // Define Outputs
  pinMode(3, OUTPUT); //PWM
  pinMode(5, OUTPUT); //PWM
  pinMode(6, OUTPUT); //PWM
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT); //PWM
  pinMode(10, OUTPUT); //PWM
  pinMode(11, OUTPUT); //PWM 
Name those pins, but don't use the names. OK. Whatever.

  } else if (switchPos5 == LOW) { // Check if in position 5
         // Random Light Show
The randomSeed() function should be called once, not every pass through loop.

However, I can't help but feel there has to be a way to clean up the code and make it shorter with better use some of C++'s internal functions.
Not really. You have an array of pin numbers that you never use, which could shorten the code a little bit. You could create some functions for each of the blocks of code (one for each switch), but that would reduce the amount of code. It would make it easier to read/maintain, though.
33741  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 09, 2011, 09:00:11 pm
For the switches, you are not enabling the internal pull-up resistors, which suggests that you (should) have external pull-up or pull-down resistors. Do you?

      while (digitalRead(but1)==0){
      }                                                           //Wait until button is released
Why would you want to wait for up to 10 milliseconds after the button is released to notice it?

I may have not debounced properly
There is a nice library that handles de-bouncing buttons. Why not use that library?
33742  Using Arduino / Programming Questions / Re: WiFly reading file on server x number of times instead of one time on: July 09, 2011, 08:53:27 pm
void loop() {
  if (client.available()) {
    char c =;

  if (!client.connected()) {
      ;  }

So, when loop gets called, you test for the presence of data from the client. If there is data, you read and print one character. When all the data has been extracted from the client, the client closes the connection, at which point you go into an infinite do-nothing loop, rather than looking for another client to connect. Why?
33743  Using Arduino / Programming Questions / Re: String, convert end to long on: July 09, 2011, 08:48:13 pm
Well, what do you suppose atoi stands for? Ascii to integer. What would you guess to be the function to convert ascii to long?
33744  Using Arduino / Programming Questions / Re: How to do i set up Communication on Xbee chips on: July 09, 2011, 08:45:45 pm
Posting a bunch of related questions in different threads is not the way to do it.

Don't you know how to use google? There are a bazillion examples of using XBees to communicate between Arduinos.

The first thing that you have to do is to configure the XBees using X-CTU. In order to do that, you need to know what kind you have. Since you didn't tell us, you're on your own.
33745  Using Arduino / Programming Questions / Re: Xbee Communication Sketch Example on: July 09, 2011, 08:37:40 pm
Each XBee transmits over-the-air whatever is sent to the serial port, using Serial,print(), Serial.println(), or Serial.write(). Each XBee puts on the serial port anything that it receives over-the-air, for the Arduino to get using

It hardly seems necessary to provide a sample application for such a trivial task.
33746  Using Arduino / Project Guidance / Re: Making an Arduino-based Vehicle Data Acquisition (DAQ) module on: July 09, 2011, 09:43:48 am
They do not have to be logged at the same frequency but that is easier I think.
I do, too.

And also, does buffering for longer mean more missed samples and a more uneven sampling process (i.e. you have to wait and not sample at all while you are writing to the sd card??)
Depends on how you do the buffering. If you use a array, and straight linear access, then, no data can be added to the buffer while the data is being written out.

If you use an array, as a ring buffer, then data can be added to/overwritten in one spot in the array while writing to the SD card occurs at another spot.

The key with a ring buffer is to (be able to) write (empty) faster than you can store (fill), so the insertion point never passes the processed point.
33747  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino to Webserver on: July 09, 2011, 08:59:06 am
The parse function wants some kind of pointer to something, and you are passing it a constant (int). The compiler is telling you you can't do that.

Do you have a link to the JSON library?
33748  Using Arduino / Programming Questions / Re: Fixing the randomSeed() function on: July 09, 2011, 08:53:07 am
I was having a problem with randomSeed()
It doesn't look to me like the problem is in randomSeed. The problem was in the value that you not supplied to the randomSeed function.

So, at the very least, the thread title is wrong.
33749  Using Arduino / Programming Questions / Re: creating a library on: July 09, 2011, 08:49:30 am
The message is pretty obvious. In the Move class, in the up() function, you reference servoL1, but servoL1 is not defined anywhere.

Seems to be that the servo to move should be an input to the up() function.
33750  Using Arduino / Networking, Protocols, and Devices / Re: Arduino with Byvac bv4512 lcd on: July 09, 2011, 07:50:36 am
Second, i found the library of byvac LCD, but now, i don't know how to
Isn't there an example folder? Almost all libraries ship with an example folder that shows how to use it. If there is hardware involved, the example or online documentation will describe how to connect it.

First i plugged my lcd to COM/IIC to connector on sensor shield (with respect of SDA & SCL)
No, first you should worry about getting the LCD to work as the only thing connected to the Mega.
Pages: 1 ... 2248 2249 [2250] 2251 2252 ... 3072