Show Posts
Pages: [1] 2 3 ... 285
1  Using Arduino / Programming Questions / Re: PID library - How to tell when compute executes on: Today at 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
}
2  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.
3  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 ?
4  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.
5  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.
6  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.
7  Using Arduino / Programming Questions / Re: Simple IF Statement Error on: August 26, 2014, 04:10:52 am
Quote
The serial monitor won't update.
Please post your whole program as it is now.
8  Using Arduino / Programming Questions / Re: Controlling motors with pushbuttons (2 pin) on: August 26, 2014, 04:02:13 am
Code:
if (digitalRead(10) == LOW)
{
  digitalWrite(13, HIGH);
}
else
{
  //put code here to be run if the button is not pressed
}
9  Using Arduino / Programming Questions / Re: Missing Ping Library Among Other Things in Code PLEASE HELP on: August 24, 2014, 02:06:16 pm
It would have helped if you posted the error.  When I try to compile your program I get
Quote
sketch_aug24a:2: error: 'Tone' does not name a type
sketch_aug24a.ino: In function 'void setup()':
sketch_aug24a:28: error: 'tone1' was not declared in this scope
sketch_aug24a.ino: In function 'void loop()':
sketch_aug24a:44: error: 'tone1' was not declared in this scope
sketch_aug24a:45: error: 'tone1' was not declared in this scope
None of the errors has anything to do with ping.

Do you have Tone.h on your system and if so where is it and what is in it ?
10  Using Arduino / Programming Questions / Re: Serial print and millis does not work as it is intended on: August 23, 2014, 01:45:57 pm
Code:
//serial print will show data
  Serial.print("pot = " );
  Serial.print(inputpotValue);
  Serial.print("\t  led = ");
  Serial.println(outputValue);
 
  //DELAY PART IN MILLIS 8SEC
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis > interval);
 //save the last time message was printed
 previousMillis = currentMillis;

You need to move the printing into the code executed if the timing interval has passed and also fix the problem with this line
Code:
if (currentMillis - previousMillis > interval);
The semi-colon ends the code executed if the test is true so as it stands nothing will happen whether the test is true or false.
11  Using Arduino / Programming Questions / Re: Arduino IDE Literal words: PRESSED why is it blue text? on: August 23, 2014, 12:43:57 pm
In library folders you will often find a file named keywords.txt which contains a list of key words pertaining to the library.  The contents of these files cause words in the IDE to be coloured to make them stand out as keywords.  However, the mechanism is useless because the colour coding is picked up whether or not you have included the library in your program.

In your case the word PRESSED must be in a library keywords.txt file on your system.
12  Using Arduino / Programming Questions / Re: Problem retriving value from a Switch case on: August 23, 2014, 04:23:33 am
Quote
In terminal when I give " 1 " it gives me

Code:
49
Enter a correct value
10
Enter a correct value
You are seeing the ASCII value of the digit 1 followed by the ASCII value of a linefeed which is presumably how you have the serial monitor line ending set.

Now that you know what you are getting from serial you can change your switch/case to suit or subtract 48 from the incoming byte value after reading it and leave the switch/case alone.
13  Using Arduino / Programming Questions / Re: Problem retriving value from a Switch case on: August 23, 2014, 03:46:24 am
Code:
  int sv = Serial.read();
What type of variable does Serial.read() return ?
To see what value you are actually getting, if any, try printing sv after you have read it.  Does it match any of the values that you are testing for in switch/case ?
14  Using Arduino / Programming Questions / Re: char and int issue on: August 23, 2014, 03:22:30 am
Quote
If the UID of the card is something like "CD D2 F8 FE" then thats a mixture of int's and char's,
It looks like you need to do some reading up on hexadecimal representation of numbers, because that's what each of the values in the string you quoted look like to me.
15  Using Arduino / Programming Questions / Re: How to control domotiga by database sqlite ? on: August 23, 2014, 03:17:49 am
If I have understood you correctly domotiga (whatever that is) is connected to the Pi.
If that is the case then why are you asking this question in an Arduino forum ?
If I have misunderstood then please explain in more detail how the Arduino is involved with domotiga.
Pages: [1] 2 3 ... 285