Show Posts
Pages: [1] 2 3 ... 285
1  Using Arduino / Programming Questions / Re: Comparing Values on: Today at 09:21:11 am
Hmmm.., indeed, but I won't commit the sin of revising my original post and making a nonsense of your comment
2  Using Arduino / Programming Questions / Re: beginner doubt about variables on: Today at 09:17:01 am
Quote
If you want to exchange the value of two variables you need to use a third variable to temporarily hold one of the values.
I seem to remember that there are ways of doing it without a third variable.
[Google]
Code:
   a = a + b;
   b = a - b;
   a = a - b;
[/Google]
3  Using Arduino / Programming Questions / Re: code in code on: Today at 09:08:29 am
Quote
this is not where i am looking for for this project.
Perhaps you could explain what the project is.  Are you looking to enter arbitrary code in the Serial monitor and have it executed by the Arduino or are there only a limited number of programs that you want to run ?

You seem to have described a solution that you are looking for and found that it is impossible to implement, but if you describe what you are trying to do then there may be a different way to achieve it.
4  Using Arduino / Programming Questions / Re: Individual servo control using flex sensor readings on: Today at 07:25:22 am
Code:
byte ServoAngle1 = Serial.read();
byte ServoAngle2 = Serial.read();
byte ServoAngle3 = Serial.read();
byte ServoAngle4 = Serial.read();
byte ServoAngle5 = Serial.read();
Two or more variables with the same name apart from a numerical suffix should always suggest that use of arrays would be appropriate.
5  Using Arduino / Programming Questions / Re: Comparing Values on: Today at 07:12:39 am
However you write I would get rid of the 'magic' numbers in the code and make them global constants with meaningful names.  It makes the code easier to understand and maintain.
Code:
const int waterLowPoint = 2500;
const int waterHighPoint = 6000;
const int beerLowPoint = 8000;
const int beerHighPoint = 12000;
const int wineLowPoint = 13000;
const int wineHighPoint = 17000;
const int mercuryLowPoint = 18000;

Code:
if (sensor >= waterLowPoint && sensor <= waterHighPoint) {
  digitalWrite(LED1, HIGH);
} else if (sensor >= beerLowPoint && sensor <= beerHighPoint) {
  digitalWrite(LED2, HIGH);
} else if (sensor >= wineLowPoint && sensor <= wineHighPoint) {
  digitalWrite(LED3, HIGH);
} else if (sensor > mercuryHighPoint) {
  digitalWrite(LED4, HIGH);
}

Obviously you choose meaningful names rather than the ones I made up !
6  Using Arduino / Programming Questions / Re: small help with HTML commands on: Today at 05:28:44 am
Code:
client.println("<span style=color:darkolivegreen;font-weight:bold>Test</span>");
I would expect you to be able to split the client.print() into as many sections as you like ***.  Does it actually need to be terminated with the newline provided by client.println() ?
Code:
client.print("<span style=color:darkolivegreen;font-weight:bold>");
client.print("Test");
client.print("</span>");

If that works then you could put
Code:
client.print("<span style=color:darkolivegreen;font-weight:bold>");
in a function and call it when you wanted to change the text colour and weight, or take it one stage further and make the function take parameters for font weight and colour to make it more general purpose.

***Note that this is speculation on my part but it seems logical.
7  Using Arduino / Programming Questions / Re: Need help with GenieArduino! on: September 01, 2014, 06:12:31 am
One end is connected to the ground and the other one to A0.
Hmmmmmm........

As suggested, you need to connect it correctly.
8  Using Arduino / Programming Questions / Re: Need help! on: September 01, 2014, 04:34:59 am
How is the pot wired ?
9  Using Arduino / Programming Questions / Re: small help with HTML commands on: August 31, 2014, 04:14:07 am
Quote
how do I do this with clinet.print?
Why can't you do that with client.print() ? (I assume that clinet is a misspelling of client).

Please post the whole program as it is now.
10  Using Arduino / Programming Questions / Re: PID library - How to tell when compute executes on: August 30, 2014, 03:09:42 pm
Quote
I've tried passing a boolean - PidAngle.Compute(PidAngleDn)
Don't pass it anything.  Test what it returns to determine when the output has been computed.
Code:
if ( PidAngle.Compute() == true)
{
    //do stuff if PID was computed
}
11  Using Arduino / Programming Questions / Re: 'check' was not declared in this scope issue on: August 29, 2014, 02:53:37 am
Code:
 int check()
Looks like the start of a function definition.  If that is what it is meant to be then it does not belong inside loop()

Try Auto Formatting the code to fix the indentation and you may see what I am saying more clearly.  As it stands at the moment you do not actually have a check() function.
12  Using Arduino / Programming Questions / Re: 'check' was not declared in this scope issue on: August 29, 2014, 02:24:10 am
Code:
  int check()
What is this line doing inside the loop() function ?
13  Using Arduino / Programming Questions / Re: Help: how to break this while loop in my Arduino Leonardo code on: August 27, 2014, 01:32:42 am
There is something fundamentally wrong with how you are dealing with the serial input to the Arduino.
Code:
  if(Serial1.available() > 0)
This checks whether there is serial data available but does not check how many bytes there are.
Code:
    data1[0] = Serial1.read();
    data1[1] = Serial1.read();
    data2[0] = Serial1.read();
    data2[1] = Serial1.read();
Without knowing how many bytes are available you immediately read from serial 4 times.  At best the results are going to be erratic.

If you know that you will always be receiving 4 bytes then read each of them as they become available and do not assume that because one byte is available that you can sensibly read four.
14  Using Arduino / Programming Questions / Re: Arduino send string to App inventor on: August 27, 2014, 01:19:59 am
Do you have a problem sending the String from the Arduino or dealing with it when it is received by Android ?

Sending it should be easy.  In fact you seem to be doing it already in your program
Code:
BT.println(readString);
seems to me to be sending what you have received back via Bluetooth.

If you have a problem dealing with it on teh Android device then you are asking in the wrong forum.
15  Using Arduino / Programming Questions / Re: Trouble with DateTime Library on: August 26, 2014, 10:51:19 am
Please do us and yourself a favour by posting the program copied from your IDE.  When doing so please note the advice in the stickies at the top of this forum, particularly the advice to use code tags.
Pages: [1] 2 3 ... 285