Show Posts
Pages: 1 2 3 [4] 5 6 ... 233
46  Using Arduino / Programming Questions / Re: CMUCAM4 Color test in Arduino on: April 11, 2014, 10:33:38 am
Have you tried searching this form for CMUCAM4 ?

I also found this on the Web with just a few clicks
http://www.cmucam.org/docs/cmucam4/arduino_api/class_c_m_ucam4.html
47  Using Arduino / Programming Questions / Re: Read analog pin on: April 11, 2014, 08:23:19 am
Are you sure that the socket that you indicate in your picture is pin A1 ?
48  Using Arduino / Programming Questions / Re: Read analog pin on: April 11, 2014, 07:01:10 am
Have you taken note of what I wrote in reply #3 ?
49  Using Arduino / Programming Questions / Re: Read analog pin on: April 11, 2014, 06:40:13 am
In order for analogRead() to work it needs to have a voltage to measure against.  This is provided by having a common GND connection between the Arduino and the device being measured.  Your drawing does not show such a common GND connection.  Have you missed it from the drawing or does it not exist ?
50  Using Arduino / Programming Questions / Re: Parsing large strings on: April 10, 2014, 06:46:30 am
Quote
I am attempting to put in a sample string to get my parsing right.
You are not using a string you are using a String.  Not the same thing at all, but that does not seem to be the problem judging by the error message which seems to indicate that the problem lies with the underlying  Java code behind the IDE.

It looks like you are going to have to take steps to reduce the size of the string.   For instance does it need to be a full blown HTML table complete with details of background colours etc which will be irrelevant to the Arduino ?
51  Using Arduino / Programming Questions / Re: if else commands on: April 10, 2014, 04:36:33 am
Unconventional but possibly workable....

Not the solution to your problem, but why are you using digital pins to provide the 5V to the sensors ?  Why not just connect them to 5V ?

Quote
The note produced isn't in the program, but is close to the average of all of the notes
That does not make sense.  To quote from the tone() function reference page
Quote
Only one tone can be generated at a time. If a tone is already playing on a different pin, the call to tone() will have no effect. If the tone is playing on the same pin, the call will set its frequency.

Can I suggest that you add a Serial.print() just before each tone() and noTone() so that you can track which sections of the program are being activated ?

Personally I prefer to use braces to hold blocks of code in if/else even if only one line of code is to be executed, like this
Code:
  if (val_1 < threshold)     // if a value drops below the threshold
  {
    tone (speaker, Note_C);
  } // a note is played
  else
  {
    noTone (speaker);                     
  }
I find it much easier to visualise what is going on and if later I add other lines of code, such as I suggested above, there is no confusion as to which code will be executed.
52  Using Arduino / Programming Questions / Re: State variables and millis help. on: April 10, 2014, 02:52:32 am
currentMillis or an equivalent name for me too for the reasons that Robin has outlined.  Apart from anything else, using a meaningful name makes the program more readable as in
Code:
if (currentMillis - startMillis >= interval)
but as in many things it is a matter of personal preference.
53  Using Arduino / Programming Questions / Re: if else commands on: April 10, 2014, 02:38:54 am
What sort of sensors are you using and how are they wired ?
What range of values do you get from your analogRead() inputs ?

Once you have got this working investigate the use of arrays and cut the length of the program by about 80%
54  Using Arduino / Programming Questions / Re: Getting steppermotor to work with my present program. on: April 10, 2014, 12:55:37 am
Posting your code in quote tags rather than code tags has screwed it up, turned much of it into italics and put a couple of smileys in it along the way

Please repost it in code tags in order to make it readable.
55  Using Arduino / Programming Questions / Re: Simple question on arrays on: April 09, 2014, 03:55:04 pm
The stfump declared in printTemp()
Code:
  Serial.print(stemp);
  double stfump = (stemp / 2) ;
  Serial.print("\n");
is not the same variable as the stfump declared in loop()
Code:
void loop(void) {
  float reading[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  float summer = 0;
  float stfump = 0;
The latter one will not be updated by the printTemp() function so will always have a value of zero.
So
Code:
    reading[i] = stfump;
will always store zero in the array.
56  Using Arduino / Programming Questions / Re: Im not man enouh to solve a compiling error for a LCD with I2C on: April 09, 2014, 11:49:46 am
Quote
This LCD works with another very simple program
Can you please post an example of a simple program that works ?
57  Using Arduino / Programming Questions / Re: Repeating code until condition is true on: April 09, 2014, 07:35:44 am
Glad to see that you have got it working.  As you have not posted your code I can't see exactly what you have done but are 2 tests necessary ?
Code:
digitalRead(led_bottom)
is going to return either HIGH or LOW, so if it is not HIGH it must be LOW and vice versa.  Hence only one test is needed.
58  Using Arduino / Programming Questions / Re: Analog sensor update more often. on: April 09, 2014, 01:04:25 am
Quote
I need the mpx data more regularly.
Then don't use delay().
Look at the BlinkWithoutDelay example in the IDE.  It uses the principle of checking whether a timing period has elapsed each time through loop().  If so it takes the appropriate action.  If not it can do other things such as reading inputs.
59  Using Arduino / Programming Questions / Re: Liquid Crystal Clashing with Interrupts on: April 08, 2014, 03:08:24 pm
More confusion on the serial front.
You are not using SoftwareSerial in the program you posted you are using the Wire library, but I know what you mean.

I don't understand why Hardware Serial is not interfering with interrupts 2 and 3 on pins 0 and 1 respectively.
60  Using Arduino / Programming Questions / Re: Liquid Crystal Clashing with Interrupts on: April 08, 2014, 02:13:17 pm
There are 2 types of serial communication mixed together in this discussion.

1.  Hardware Serial.  Used by Serial.print(), Serial.read() and other methods of the serial library,  Communication is via pins 0 and 1 on the Arduino.  These pins are also used when uploading a program to the Arduino.

2.  Serial communication using the Wire library.  This uses pins 2 and 3 on the Leonardo and is not used for Serial.print() etc

As you are using a Leonardo that implies to me that if you want to use the Wire library and Hardware Serial you cannot use interrupts 0 to 3 because all 4 interrupt pins are being used for other purposes.  If you can do without Hardware Serial for debugging output or user input then you should be able to use interrupts 2 and 3 as well as interrupt 4 on pin 7.
Pages: 1 2 3 [4] 5 6 ... 233