Loading...
  Show Posts
Pages: [1] 2 3 ... 158
1  Using Arduino / Project Guidance / Re: Greenhouse master controller in the middle of nowhere on: May 23, 2013, 03:17:51 pm
My code exceeds the maximum allowed length. Does this mean I have to by an arduino mega?  smiley-yell

Perhaps. Attach your code (I assume it's too long to post) and people may have suggestions as to how you can make it smaller.
2  Using Arduino / Programming Questions / Re: controlling Relays with Uno on: May 23, 2013, 09:02:33 am
What does your serial output look like?
3  Using Arduino / Programming Questions / Re: Checking Rapid Blinking Input on: May 22, 2013, 12:56:27 pm
Keep an array of unsigned longs. Loop through your pins and digitalRead them. For any that are high, store millis in the corresponding array entry. Loop through the array and compare the times to millis. If any of them have a difference > 750mS, shut everything down.

This assumes that you can wait a little. A similar, but slightly more complex approach will be needed if you want to catch the "I'm going to shut down shortly" signal.
 
4  Using Arduino / Project Guidance / Re: Mearing flow rate on: May 22, 2013, 07:03:11 am
The PulseIn function will get you the PWM detail. You can write the data to a file on an SD card if you have the hardware, or send it to a PC running a program that will push it to a file. Processing is often used for this purpose although you can write the receiving program in your language of choice or use a terminal program that can capture input to file.
5  Topics / Home Automation and Networked Objects / Re: how to access ethernet shield from a separate network (far locations) on: May 22, 2013, 06:54:46 am
You don't need a static IP - dyndns takes care of this part for you. You do however have to configure your router to pass traffic on your chosen port (80 in the simple case) to the arduino.
6  Using Arduino / Programming Questions / Re: Need larger "String buffer", and, How to delete 1st 65 chars of a string on: May 21, 2013, 02:17:43 pm
Get rid of this:
Code:
  if( content != "" ){
    delay(100);
  }
At 9600 baud you can be getting ~960 characters per second - your 10th second delay allows you to miss ~96 - more than enough to overflow the buffer.
7  Using Arduino / Project Guidance / Re: Servo minimum delay? on: May 21, 2013, 01:01:55 pm
Without actually looking at the servo library, I'm going to guess that it makes no difference how fast you're setting the servos to position. The library has to send the signal frequently (every 20mS?) so I suspect that your new data will be used the next time it's time to send, unless you overwrite it before that.
8  Using Arduino / Programming Questions / Re: Get steering and drive servos to work at the same time on: May 21, 2013, 10:36:24 am
Search the forums for state machine code. Your nested if logic isn't going to do what you want - it'll call the stop routine, but immediately afterwards loop will run again and steer and drive, so you'll never notice the stop.
9  Using Arduino / Programming Questions / Re: trying to parse a serial string with strange results on: May 17, 2013, 04:07:55 pm
Your code contains a tacit assumption that the string you typed will all be read back to back in your while loop. It won't - the arduino is much too fast for that. It'll read a single char, check for another being available and nothing will have arrived.

Get rid of the i=0; at the top of loop. You'll need it somewhere, but not there.
10  Using Arduino / Programming Questions / Re: Speeding up the compiler on: May 17, 2013, 12:40:24 pm
Quote
I noticed something is hogging memory (exactly what isn't clear)

Sounds like it's time to open the process tab in task manager and find out what each of them actually is. There are plenty of sites e.g. www.processlibrary.com/ that will tell you what they are.
11  Community / Gigs and Collaborations / Re: Help with project - financial reward! on: May 17, 2013, 11:57:48 am
Glad it worked - you would likely have got the same advice for free in the programming forum, so keep the cash  smiley
12  Community / Gigs and Collaborations / Re: Help with project - financial reward! on: May 17, 2013, 10:26:23 am
It uses a static boolean local variable  (a global would work too) to keep track of whether the camera is recording or not.

Every time loop executes, it checks to see if either of the pirs are detecting anything. If one or both of them is detecting, it checks to see whether the camera is already recording. If it is, the code does nothing, if it isn't, it sends the REC command to start recording.

If neither pir sees anything, it checks to see whether the camera is recording. If it is, send REC to turn it off; if it's not, do nothing.
13  Community / Gigs and Collaborations / Re: Help with project - financial reward! on: May 17, 2013, 08:52:11 am
Here's the logic in loop that I think will do what you want. I don't see anything in your code that commands the camera, but you say you've managed to get it into record mode so I've assumed a function that does it.

Code:
void loop()
{
static bool Recording=false; // Is the camera recording?
ldr_value = analogRead(ldrpin);                  //read LDR value
 
if (ldr_value >300)
  {
  nightservo.write(27);                        // IE dark , tell servo to go to position 27
  }
else
  {
  nightservo.write(5);
  }
 
pirvalue1 = digitalRead(pir1);  //read pirvalue
pirvalue2 = digitalRead(pir2);
if(pirvalue1==HIGH || pirvalue2==HIGH)
  {
  if(!Recording)
    {
    Recording=true;
    SendRecCommand();  // Start recording
    }
  }
else
  {
  if(Recording)
    {
    Recording=false;
    SendRecCommand();  // Stop recording
    }
  }
}
14  Using Arduino / Programming Questions / Re: Get time zone with GPS? on: May 14, 2013, 06:38:23 pm
http://www.geonames.org offers a web service that does this for you. Useful if you have a static installation perhaps. If you have an SD card, you could store the vectors of the timezone map borders in terms of lat long and figure out which one you're in from that.
15  Using Arduino / Programming Questions / Re: Averaging analog inputs without delay() help needed on: May 12, 2013, 11:01:59 am
Or a normal moving average - multiply the current average by nine, add the new reading, divide by ten.

As to the serial port, use the blink without delay technique and only print once a second or so.
Pages: [1] 2 3 ... 158