Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 295
61  Using Arduino / Programming Questions / Re: Need help with storage of multiple ints on: September 22, 2014, 06:00:35 am
Code:
int time[50];
No.  You need
Code:
unsigned long timeStored[50];
because as I noted earlier millis() returns an unsigned long

Quote
how do i then make it put the time and value together, so that it knows which value entry, has which time entry?
By using the same array index for both.

Quote
Won't millis rollover, after some time?
No, because you will use a construct like
Code:
if (millis() - timeStored[x] >= interval)
to test whether the time has passed to delete entry x from the array of tag numbers.  By using unsigned longs and subtracting them from millis() the rollover problem is avoide.
62  Using Arduino / Programming Questions / Re: AREXX AAR ROBOT - BLUETOOTH HC-06 NEED HELP PLS on: September 22, 2014, 05:00:59 am
As Paul suggests I would start by getting the robot to move under control of the program.  To help this I would create functions to move the robot forward, backward, left, right and stop and call them in sequence from setup() to ensure that each one does what is required.  Then you can move onto control via bluetoooth and possibly passing a speed parameter to each function.
63  Using Arduino / Programming Questions / Re: Keep maximum value with analog reading on: September 22, 2014, 04:50:27 am
Quote
do you have any better approach ?
Set a variable to zero
If the analogue input is greater than the variable then set the variable to the input value

No need for an array
64  Using Arduino / Programming Questions / Re: Need help with storage of multiple ints on: September 22, 2014, 04:46:46 am
Quote
The arduino then has to store 875 for 5 minutes. so that if 875 is scanned again, it can go through the array, and know that exactly this tag, has already been scanned before, within 5 minutes.
In order to know that the number has been stored for 5 minutes you will need to store the time at which it was stored.  Unless you have an RTC you will need to store the value of millis() as the start time.  millis() returns an unsigned long integer which takes 4 bytes to store which increases the storage requirement considerably,
65  Using Arduino / Programming Questions / Re: Need help with storage of multiple ints on: September 22, 2014, 03:03:04 am
Quote
i have to store a lot of integers at a time. like maybe 40-50 at the same time, for 5 minutes.
This sounds like you should be using an array to store the ints.  True that will use a fixed amount of memory but it will not expand once declared and you can store 50 ints in 100 bytes of memory using an array.  You cannot delete the entries in the array but you could set them to a value indicating that the entry is not currently valid or create a second array of bytes to hold a list of currently valid array entries.

It would be easier to provide advice if you were to expand further on what you are doing.
66  Using Arduino / Programming Questions / Re: ReadASCII String Example Problem on: September 22, 2014, 02:03:13 am
You didn't answer my question about how you have got the line ending set in the Serial monitor.  The program is looking for a Newline character at the end of the input.  If it is not there then the program will not work.
67  Using Arduino / Programming Questions / Re: QLOCKTWO project on: September 21, 2014, 06:12:51 am
Quote
The code exceed the mas characters so please use the top imgur link
Why not attach the code to your post using the Additional Options.. link at the bottom left of the edit window ?  We cannot copy an image into the IDE to see the program fully, edit it or copy from it.
68  Using Arduino / Programming Questions / Re: Ignoring IF statment. on: September 21, 2014, 04:49:40 am
Code:
if(val=='F');
The trailing semi-colon is your problem.  It is the only piece of code executed if the test is true.
Check out the Arduino reference for the syntax of the if command.
69  Using Arduino / Programming Questions / Re: i want to know how to write this syntax on: September 20, 2014, 04:18:37 pm
Code:
PINC.7
What is this meant to be ?  Bit 7 of PINC perhaps ?  Please clarify what you are trying to do.
70  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
Quote
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 ?
71  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 ?
72  Using Arduino / Programming Questions / Re: Problems with strings and &chars on: September 18, 2014, 04:22:23 pm
Quote
//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++ ?
73  Using Arduino / Programming Questions / Re: Variable "A" control the state of 2 LEDs...how to ? on: September 18, 2014, 11:19:38 am
Quote
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 .....
74  Using Arduino / Project Guidance / Re: avoiding delay on: September 18, 2014, 11:15:28 am
Look at the BlinkWithoutDelay example in the IDE
75  Using Arduino / Programming Questions / Re: has not been declared on: September 18, 2014, 08:17:05 am
Hello,
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.
Thierry
I see references to MyToolBox.h in this thread but I do not see it #included in your program.
Pages: 1 ... 3 4 [5] 6 7 ... 295