Show Posts
Pages: 1 ... 14 15 [16] 17 18 ... 283
226  Using Arduino / Programming Questions / Re: Waiting for Button Presses and Updating an Array on: July 22, 2014, 04:09:32 pm

I've changed my array and YesNo variables to boolean type. After adding in the printArray function I'm still getting an error very similar to the last one:
call of overloaded 'print(char* (&)(const char*,int))' is ambiguous

I am sorry I am not providing more informative questions. I have more or less hit a brick wall and am having a huge mental block at the moment.
Please post your new program.
227  Using Arduino / Programming Questions / Re: Waiting for Button Presses and Updating an Array on: July 22, 2014, 12:48:16 pm
Whatever else may be wrong, this for loop
 for (channelCycle = 1; channelCycle <= 12; channelCycle++){
has the wrong boundaries.  The channelUsage array is defined as having 12 elements which are indexed from 0 to 11, not 1 to 12, so this
channelUsage[channelCycle] = YesNo;
will write outside the array memory after which all bets are off.

Incidentally, by declaring the array as an int you are wasting space.  Declare it as of type byte or better still use 12 bits of a single int to hold the switch states.
228  Using Arduino / Programming Questions / Re: Reading the value of a sensor every X millis (best practise?) on: July 22, 2014, 07:14:27 am
In the 'blink without delay' code, the main action is defined into the IF branch and we don't have any ELSE branch
That's because an else is not needed.  The logic is not to turn the LED on or off at the right time OR do something else, it is to to turn the LED on or off at the right time then ALWAYS do something else.  Having said that, there could also be conditions on whether the something else happens, but that is independent of turning the LED on or off or leaving it in its current state.
229  Using Arduino / Programming Questions / Re: Servo Code Double Check on: July 21, 2014, 03:05:35 pm
Try the servo sweep program.  If the servo works with that then it is OK.

Did we establish how the servo is powered ?  From the Arduino 5V and GND pins or from the external supply ?
230  Using Arduino / Programming Questions / Re: what happens with output after if state isn't true? on: July 21, 2014, 02:01:53 pm
Once you have turned a pin HIGH or LOW with digitalWrite() it stays in that state until you explicitly change it.
231  Using Arduino / Programming Questions / Re: aduino uno+ethernet+gsm on: July 21, 2014, 05:45:06 am
How about starting with the example Ethernet programs and writing to Serial ?  Then you can move on to sending an SMS once you know that you are receiving the correct data to send.
232  Using Arduino / Programming Questions / Re: Servo Code Double Check on: July 21, 2014, 04:53:36 am
but it is better to use a pull-up resistor
Why ?

and the internal one is easiest.
Agreed wholeheartedly
233  Using Arduino / Programming Questions / Re: RPM measurement without attachInterrupt? on: July 21, 2014, 04:47:58 am
millis() - startTime >= setTime
That line of code is checking whether the required period of time (setTime) has passed between now (millis()) and the start time of the activity (startTime).  If so, then it is time to do something because the period has elapsed.  If not then go and do something else, such as reading a sensor or switch, and check again if the period has elapsed next time through loop().  Unlike using the delay() function the program does not stop whilst the period of time passes..
234  Using Arduino / Programming Questions / Re: reset static variable on: July 20, 2014, 04:41:49 pm
I don't understand what the OP wants to do either, but is there some confusion between static and const going on here ?
235  Using Arduino / Programming Questions / Re: Can't get a loop to work. on: July 20, 2014, 02:23:12 am
        while (lastPosition == currentPosition)
          currentPosition = analogRead(sensorPin);
          lastPosition = currentPosition
Note, however, that this relies on the pot returning exactly the same value all the time when stationary which is unlikely.  It would be better to build in a check to see of the pot value has changed and by how much.
        while (abs(lastPosition - currentPosition) < 20)
236  Using Arduino / Programming Questions / Re: Multiple Inputs on: July 19, 2014, 04:05:03 pm
Can you please explain more clearly what you want to do ?

Is switch 1 held on and then you wait for switch 2 or can switch 1 be pressed and released and switch 2 pressed within a time limit ?  If the latter, then if switch 2 is not pressed within the time period should the system forget the switch 1 press and start waiting for it again ?
237  Using Arduino / Programming Questions / Re: Self Balancing sketch runs only when usb is connected on: July 19, 2014, 07:31:37 am
Wow, the soldering on those motor connections is awful !
238  Using Arduino / Programming Questions / Re: cozir library not finding .h file on: July 19, 2014, 05:07:34 am
I have installed the cozir library 1.0.3 for the cozir co2 module in Arduino 1.0.5 on ubuntu.
Where exactly is the file installed ?
#include "cozir.h"
the header file should be in the same directory as you program.
Compare that with
#include <SoftwareSerial.h>
which indicates that the header file is in the libraries folder.
239  Using Arduino / Programming Questions / Re: Run loop one time? on: July 19, 2014, 01:44:12 am
would that mean I should just move where I have the notes being played? Or would I need some IF THEN statements?
You need some logic to detect that the PIR state has changed and that it is now HIGH and was previously LOW
currentVal = digitalRead(IRpin);
if (currentVal == HIGH  && previousVal == LOW)
  // the PIR has been triggered so do something
previousVal = currentVal;
240  Using Arduino / Programming Questions / Re: MATHS PROBLEM!!! on: July 18, 2014, 05:37:16 am
As you can see Irms is a value I read off from a device
Actually I can't see that.  Please post your whole program.
Pages: 1 ... 14 15 [16] 17 18 ... 283