Show Posts
Pages: 1 ... 8 9 [10] 11 12 ... 231
136  Using Arduino / Programming Questions / Re: How to properly use an if statment on: March 27, 2014, 02:38:35 am
casemod == state machine?

casemod == OP
137  Using Arduino / Programming Questions / Re: How to manipulate IPAddress variables / convert to string. on: March 27, 2014, 02:32:06 am
What type of variable is IPAddress in your program ?
138  Using Arduino / Programming Questions / Re: Formatting with snprintf? on: March 27, 2014, 02:21:52 am
Your problem is that the Arduino IDE does not support floating point output when using snprintf() because support for it has been removed to save space, hence the ? in your output.

There are tricks you can play such as splitting your floating point number into 3 parts, integer part, decimal point and decimal part, turning the latter into an integer and then outputting the 3 parts as you have done with the speed.

It is also possible to reinstate support for floating point output but that will have implications on program size.
139  Community / Gigs and Collaborations / Re: Need help programming a photocell/relay shield on: March 27, 2014, 02:07:07 am
COM = Common. 
It is the connection that is switched between the Normally Open and Normally Closed connections
140  Using Arduino / Programming Questions / Re: DELAY on: March 26, 2014, 05:00:50 pm
If the button pin is tied to 5V as you say then the LED will immediately turn on and appear to stay on because
Code:
buttonState = digitalRead(buttonPin);
will return HIGH.  Only when you press the button for more than 5 seconds will it turn off because
Code:
buttonState = digitalRead(buttonPin);
will return LOW.
141  Using Arduino / Programming Questions / Re: Servo motor doesn't respond to code. on: March 26, 2014, 03:55:12 pm
Quote
the servo motor doesn't work as it should
What does it do ?
142  Using Arduino / Programming Questions / Re: For-loop inside if statement - possible? on: March 26, 2014, 01:38:28 pm
Quote
Is there a different syntax compared to c++?
The Arduino IDE uses C++
143  Using Arduino / Programming Questions / Re: Clear LCD once in loop on: March 26, 2014, 01:37:24 pm
Code:
if(number > 10 && alreadyCleared == false)
{
  //clear lcd once and keep printing the rest of the numbers
  lcd.clear();
  alreadyCleared = true;
}
Obviously you need to declare alreadyCleared as a boolean and set it to false before this code.
144  Using Arduino / Programming Questions / Re: problems with interrupt routine on: March 26, 2014, 01:19:41 pm
It works for me on a UNO.

In your code
Code:
  // read the input on analog pin 0:
  int sensorValue = analogRead(A5);
Which is right, the comment or the code ?
145  Using Arduino / Programming Questions / Re: For-loop inside if statement - possible? on: March 26, 2014, 01:00:16 pm
Put the if inside the for loop, not the other way round
Code:
boolean matched = true;
for(int i = 0; i < 4; i++)
{
  if (creditCard[i] != UniqueID[i])
  {
    matched = false;
  }
}
if (matched)
{
  //do stuff for a match
}
else
{
  //do stuff for a mismatch
}
You could also use a 2 dimensional array to hold several valid IDs and use 2 nested for loops.  One for the ID and one for each element of the current ID.
146  Using Arduino / Programming Questions / Re: No matching call for WirelessController... on: March 26, 2014, 12:00:25 pm
If the author is happy with how it works then who are we to argue ?

However, the error message that you got said
Quote
no matching function for call to 'WirelessController::WirelessController(long unsigned int [3], int [1], int [2], int [2], int [2], int, int, int, int, int, int, int)'
so if you call the constructor again with the same number and type of parameters you will surely get the same error.  Is recording the signal again likely to produce a different number or type of parameters ?
147  Using Arduino / Programming Questions / Re: any code for arduino to stop servomotor ? on: March 26, 2014, 11:22:53 am
Try the sweep example from the servo library.  Does that work ?
148  Using Arduino / Programming Questions / Re: No matching call for WirelessController... on: March 26, 2014, 11:18:57 am
The constructor for the WirelessController library, taken from WirelessController.h is as follows
Code:
// Constructor for the class. Receives all of the data describing
// the protocol we want to send and/or receive
WirelessController( unsigned long *marks_duration,
int *message_code_start,
int *message_code_one,
int *message_code_zero,
int *message_code_end,
byte number_of_marks,
byte number_of_marks_start,
byte number_of_marks_bit,
byte number_of_marks_end,
byte mark_tolerance,
byte encoding_type,
byte input_type,
int number_of_bits);
As you will see there are 13 parameters.

Contrast that with your code, which I assume is from one of the examples
Code:
WirelessController homeeasy = WirelessController(mark_duration_294, message_code_start_294,
                               message_code_one_294, message_code_zero_294, message_code_end_294,
                               3, 1, 2 ,2 ,30, ENCODING_PULSE_WIDTH, 28 );
There are only 12 parameters being passed.
149  Using Arduino / Programming Questions / Re: No matching call for WirelessController... on: March 26, 2014, 10:58:09 am
Code:
unsigned long mark_duration_294[3]  = {331, 943, 4800};
int message_code_start_294[1]       = {-1};
int message_code_one_294[2]         = {2, -1};
int message_code_zero_294[2]        = {1, -2};
int message_code_end_294[2]         = {1, -3};
WirelessController homeeasy = WirelessController(mark_duration_294, message_code_start_294,
                               message_code_one_294, message_code_zero_294, message_code_end_294,
                               3, 1, 2 ,2 ,30, ENCODING_PULSE_WIDTH, 28 );
You are passing the names of arrays to the WirelessController library but the error message seems to indicate that is not what it expects.

Do you have a link to the library ?
Did you write this code yourself or is it taken from an example supplied with the library ?
150  Using Arduino / Programming Questions / Re: any code for arduino to stop servomotor ? on: March 26, 2014, 10:52:16 am
How are you powering the servo ?  The Arduino digital pins cannot supply enough current for standard size servos.
Pages: 1 ... 8 9 [10] 11 12 ... 231