Show Posts
Pages: 1 [2] 3 4 ... 291
16  Using Arduino / Programming Questions / Re: i want to know how to write this syntax on: September 20, 2014, 04:18:37 pm
What is this meant to be ?  Bit 7 of PINC perhaps ?  Please clarify what you are trying to do.
17  Using Arduino / Programming Questions / Re: How to read 500 readings from analog input block in 1 second in simulink? on: September 20, 2014, 05:11:41 am
I am using simulink as it can convert the blocks in simulink into c conde and burn it into the arduino, without actually writing any code.
Except when the simulation program won't do what you want....

It sounds like you are going to have to write some code yourself.  I assume that what you are calling a vector is an array.  It seems odd that Simulink only allows a one element one dimensional array as that is about as much use a a chocolate teapot and might just as well be a normal variable. 

What sort of data do you want to store ?  If they are ints them a 500 element array will use half of the memory available on a Uno, which is not a good start.  What sort of manipulation do you want to do on the Arduino and how will the results be output ?
18  Using Arduino / Programming Questions / Re: ReadASCII String Example Problem on: September 19, 2014, 02:07:08 am
What do you see on the Serial monitor ?
What have you got the line ending set to in the Serial.monitor ?
19  Using Arduino / Programming Questions / Re: Problems with strings and &chars on: September 18, 2014, 04:22:23 pm
//error: 'string' does not name a type"
The error message is telling you exactly what is wrong.

Is string a valid data type in C++ ?
20  Using Arduino / Programming Questions / Re: Variable "A" control the state of 2 to ? on: September 18, 2014, 11:19:38 am
Can I use multiple arguments, something like...
One of the things that I like most about the Arduino is that it is so easy to try ideas out .....
21  Using Arduino / Project Guidance / Re: avoiding delay on: September 18, 2014, 11:15:28 am
Look at the BlinkWithoutDelay example in the IDE
22  Using Arduino / Programming Questions / Re: has not been declared on: September 18, 2014, 08:17:05 am
Thanks for reading my post.
In the first part are MyToolBox.h.
I put it in attachement too, and Arduino code.

Thanks and bast regards.
I see references to MyToolBox.h in this thread but I do not see it #included in your program.
23  Using Arduino / Programming Questions / Re: has not been declared on: September 18, 2014, 07:31:40 am
I can't see MyToolBox.h being #included  in your program.  Might that be a problem ?

In future please use code tags when posting programs as it makes them so much easier to read.  You will, of course, have read
24  Using Arduino / Programming Questions / Re: Set on closed loop controller on: September 18, 2014, 06:26:55 am
The answer to your question depends on several factors including

How fast is the variable changing ?
What range of values does it vary over ?
Can the other system output the "variable" as a voltage ?
Is the data being processed on the Arduino in real time as it arrives or periodically depending on time ?

More details of what you are doing would help formulate an answer.

25  Using Arduino / Programming Questions / Re: Encoder code stops perfect one way, not the other? on: September 18, 2014, 04:48:31 am
    tempKnob.write (200);            //write encoder to 200 gets divided by 4 in byte "t"
the idea is that it will not allow "T" to go below 50.

Using that logic
would not let it go below 100

Are you sure that
tempKnob.write (200);
is not setting the maximum temperature ?
26  Using Arduino / Programming Questions / Re: Encoder code stops perfect one way, not the other? on: September 18, 2014, 02:40:51 am
I would be suspicious of this line
    tempKnob.write (200);            //write encoder to 200 gets divided by 4 in byte "t"
What does it do exactly and what does the parameter mean ?
27  Using Arduino / Programming Questions / Re: PERSISTANT PROBLEMS TO COMPILE NEWPING SKETCH on: September 18, 2014, 01:26:54 am
Please post a copy of the error messages here.

Start fixing the errors by declaring the 3 variables used in this line of code
NewPing sonar(trigger_pin, echo_pin, max_in_distance); 

Formatted more sensibly your setup() function looks like this
void setup()
I suspect that you have ended it sooner than you intended because the code after it is not in a function.

As written your code is hard to read.  Try Auto Format but you will find that it will not work but it will give you a clue to at least one problem.  I suggest that you put each { and } on its own line and leave a blank line between functions to make it easier to read.  Then put the cursor after an an opening brace and look at the closing brace that the IDE indicates.  Do the pair of braces surround the block of code that you intended ?
28  International / Portugues / Re: Dúvida de código para contagem de pulsos on: September 17, 2014, 03:01:25 pm
You are adding 1 to the variable when the button IS pressed.  What you need to do is to add 1 to the variable when the button changes from being NOT PRESSED to PRESSED.  Look at the StateChangeDetection example in the IDE to see how to do it.

29  Using Arduino / Programming Questions / Re: What argument redirection is accepted in serialprint()? on: September 17, 2014, 12:40:19 pm
but serialprint(array[0]) does not
Strange.  It works for me.

byte array[] = {5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5};

void setup()
  for (int i = 0; i < sizeof(array) / sizeof(array[0]); i++)

void loop()

Does anyone know where to find the documentation of allowed arguments for serialprint() function.
HardwareSerial.cpp on your PC would be a good place to start.
30  Using Arduino / Programming Questions / Re: Speed of two DC motors on: September 17, 2014, 11:29:18 am
so is there any posts or tutorial could help me in that way ?
My advice would be to stay away from PIDs to start with and use the crude method because you will have full control over what is going on.

Some pseudo code for you
declare global variables

setup() function
   usual stuff to set up pinModes and interrupts

loop() function
  if it is time to adjust speeds (use the BlinkWithoutDelay principle using millis())
    if the left encoder count is higher than the right encoder count
      speed up the right motor a small amount
      slow down the left motor a small amount
    end if
    if the right encoder count is higher than the left encoder count
      speed up the left motor a small amount
      slow down the right motor a small amount
    end if
    zero both encoder counts
    reset the timing variables
  end if
end of loop function

left encoder ISR
  add 1 to left encoder count
end of function

right encoder ISR
  add 1 to right encoder count
end of function

If you want to explore the use of a PID then this page will get you started but it can be hard going
Pages: 1 [2] 3 4 ... 291