|
4936
|
Using Arduino / Programming Questions / Re: Questions combining RTC sketch to turn motor sketch on/off 2x daily
|
on: August 16, 2012, 08:38:00 pm
|
|
Have a global variable that records the RTC time when the motor was last turned on.
Write some code that reads the current time from the RTC and works out whether 12 hours have elapsed since the motor was last turned on. If it has, turn the motor on and record the new time.
Write some code that reads the current time from the RTC and works out whether 30 minutes has elapsed since the motor was turned on. If it has, turn the motor off.
Put the two bits of code described above in your loop() function so that they will get called repeatedly.
|
|
|
|
|
4937
|
Using Arduino / Programming Questions / Re: How to use class-specific variables in a function?
|
on: August 16, 2012, 08:30:11 pm
|
Specifically if I define an int or bool in the public or private how do I write to it in a method? What would I write?
That part is easy and has been explained at least twice in this thread. But what you were trying to do in your original post seemed to be access a 'struct array' and it was unclear whether this was a struct, an array, a struct with an array in it, an array of structs, or what. Of course the syntax for dealing with that depends entirely on what your data structure is - and your code didn't include that.
|
|
|
|
|
4938
|
Using Arduino / Project Guidance / Re: Servo controlled with a Pot. Approach 2?
|
on: August 16, 2012, 05:27:12 pm
|
|
I assume you have a normal servo where you control the position.
You want your pot to control the servo's speed. The simplest way is to process the position of the pot at regular intervals. Each time, you measure the position of the pot, calculate the deflection away from the neutral position, calculate the servo speed associated with that deflection and add a corresponding amount to the servo position.
The relationship between pot position and servo speed doesn't have to be linear - you can arrange for it to have a deadband around the 'at rest' position and you can control how quickly the speed increases as you move away from there.
Actually, I lied. The simplest approach is to replace your standard servo with a continuous rotation servo and then you can get the effect you wanted without changing the sketch at all.
|
|
|
|
|
4939
|
Using Arduino / Programming Questions / Re: How to create lookup table
|
on: August 16, 2012, 04:45:39 pm
|
flloat vArray[20] = { 0.46, 100, //0 0.6, 90, //2 0.78, 80, //4 1.02, 70, //6 1.33, 60, //8 1.7, 50, //10 2.13, 40, //12 2.6, 30, //14 3.07, 20, //16 3.51, 10,}; //18
You table is twice as big as it needs to be - since the sample points are at exact 10C increments, that dimension of the array is redundant. All you need is a 1-D array with ten values in it. The algorithm would be to walk the array to find the two elements with values that straddle the input value; the array indices for these two elements give you the two corresponding output values. Then you do a linear interpolation between the two input values and the two output values.
|
|
|
|
|
4940
|
Using Arduino / Programming Questions / Re: Weird compiling error messages
|
on: August 16, 2012, 02:16:17 pm
|
Also, it doesn't make much sense because a .ino file really is almost a c++ file and could have a .cpp extension.
It's not *quite* a CPP file because the Arduino IDE mangles it slightly to generate the CPP file that is actually compiled.
|
|
|
|
|
4941
|
Using Arduino / Programming Questions / Re: Serial data does not display
|
on: August 16, 2012, 02:13:20 pm
|
Serial.begin(19200);
Serial.begin (9600);
See the difference? Your Arduino and your serial monitor have to agree what settings to use on the serial port. If your Arduino is using a non-default speed then you will have to configure the serial monitor to match it.
|
|
|
|
|
4943
|
Using Arduino / Programming Questions / Re: Simple way to get access via ethernet to SD CSV-file
|
on: August 16, 2012, 02:02:02 pm
|
I can´t figure how to print the file in explorer, when accessing via http:\\home-ip
Your web server can tell the browser what type of file it is supplying, by designing the URL so that it has the appropriate file extension and/or by setting the Content-Type header field in the reply. If you don't use either of these methods, you could still save the file with the appropriate file type and then use whatever local application you like to open it and print it.
|
|
|
|
|
4944
|
Using Arduino / Programming Questions / Re: How to create lookup table
|
on: August 16, 2012, 01:55:45 pm
|
|
Using an interpolation lookup only takes a few lines of code and reduces the size of the lookup table by a factor of 100 compared to the 'brute force' approach. Since the brute force approach also needs you to work out and type in those 1000 values, the brute force approach doesn't look remotely attractive to me.
|
|
|
|
|
4945
|
Using Arduino / Project Guidance / Re: error detection problem reading data stream
|
on: August 16, 2012, 01:48:16 pm
|
Maybe this will work. comments?
I don't know enough about the problem to tell whether that code will solve it. I see that you are using 0x100 as a start-of-message marker, so you know when you have got the start of a message. How can you tell whether you have received a complete message? Is there anything in the message that explicitly indicates the end of the message, or implicitly indicates it (for example by enabling you to work out the expected length)?
|
|
|
|
|
4948
|
Using Arduino / Project Guidance / Re: Could I Control RC Airplan on 3G or 2G by Arduino ?
|
on: August 16, 2012, 12:07:30 pm
|
I have ideal,I will control RC airplan on 3G or 2G by Arduino. Is it posible ?  Possible, I'm sure, but I'm not convinced it is sensible. For real-time display of a moving model you need a very reliable, low latency link between the pilot and the model, and the model will (hopefully) be in a direct line of sight. In that environment an ordinary RC controller is going to work a lot better than a data link that goes via the internet and various wireless data providers. If you change the problem to weaken the requirements for lag and reliability, for example by using it to control a slow ground vehicle that can afford to stop and wait if there is any disruption in the control channel, control via the internet would be more plausible,
|
|
|
|
|
4949
|
Using Arduino / Project Guidance / Re: How to build an autonomous remote wind station + camera
|
on: August 16, 2012, 12:01:38 pm
|
|
Using SMS messages to send data sounds a bit nasty and would need a plan that gives you a huge number of texts. If you can get a plan that allows it, using a handset that supports 3G/data would be far easier, faster and probably cheaper.
Regarding the enclosure, can you mount it securely? Assuming this is something you'd be building for yourself, I suggest you style it like a conventional weather station i.e. a white box with slatted sides. This will keep it cool and also dispel any curiosity about what it does or what it's for. Are you actually entitled to install private equipment in that area?
Given that beaches are places where people tend to get undressed, I'd be very cautious about installing anything that could possibly be construed as spying on them. In my mind that means putting it far enough away that there is no possibility of it showing detailed pictures of people on the beach. This also means that it's probably far enough away that the people on the beach will not notice or be concerned about it.
|
|
|
|
|
4950
|
Using Arduino / Project Guidance / Re: Pressure/ Force Sensor...
|
on: August 15, 2012, 06:33:29 pm
|
|
From that data sheet it looks as if the sensor should produce zero output voltage at zero pressure, up to 20mV at 100 psi.
Are you saying that your sketch is getting an analog read result of 518 with no pressure applied? That makes me think it isn't wired up correctly. I suggest you post a wiring diagram and your code that shows the problem.
|
|
|
|
|