Show Posts
Pages: [1] 2 3 ... 256
1  Using Arduino / Programming Questions / Re: Help with malfunctioning sketch - arduino keeps looping same "if" on: October 18, 2014, 06:01:11 am
I expect grumpy_mike has guessed it - it looks like you have a wiring issue such that when you switch on the main fan, the power drawn is sufficient to restart the arduino. You might also print millis in loop as a more evidence.

It's hard to say though, because it's evident that that serial output came from a modified version of your sketch, so any conclusions based on it without the updated sketch are suspect.
2  Using Arduino / Programming Questions / Re: Help with malfunctioning sketch - arduino keeps looping same "if" on: October 17, 2014, 02:23:17 pm
Quote
something like that

Much nicer to have the actual output you're seeing.
3  Using Arduino / Programming Questions / Re: Help with malfunctioning sketch - arduino keeps looping same "if" on: October 17, 2014, 10:27:52 am
What does your serial output look like?
4  Using Arduino / Project Guidance / Re: Running Two FSM's simultaneously on: October 17, 2014, 08:51:57 am
Not really. I'd expect this:
Code:
case 1:                      // entrance gate
    if (buttonState == LOW){     // reading card
    digitalWrite(zoemerPin, HIGH); // beep
    delay(1000);
    digitalWrite(zoemerPin, LOW);
    digitalWrite(groenPin, LOW); // green light on
    pressCount = 2;
    break;

to be this:
Code:
case 1:                      // entrance gate
    if (buttonState == LOW){     // reading card
    digitalWrite(zoemerPin, HIGH); // beep
    delay(1000);
    digitalWrite(zoemerPin, LOW);
    digitalWrite(groenPin, LOW); // green light on
    pressCount = 2;
    }
    break;
And the other clauses need the same treatment

It probably works, but generally, you would never expect to see a switch structured that way.
5  Using Arduino / Project Guidance / Re: Running Two FSM's simultaneously on: October 17, 2014, 07:56:36 am
The use of braces doesn't look right. For example:
Code:
    case 3:
    if (button3State == HIGH) { // 45┬░check
    digitalWrite(motorPin, HIGH); // stop turning
    pressCount = 1;
    break;


Shouldn't there be a closing brace before the break? I note that you've got it to compile by throwing in enough braces at the end, but I'm not convinced that that's what you need.
6  Using Arduino / Programming Questions / Re: void function that returns an equation? or anything? on: October 17, 2014, 06:46:51 am
Quote
As for the RPM, we took several measurements of the RPM at different pulse width values, put them into excel and derived an equation that allows us to input RPM and the program changes that into the appropriate pulse width value based on our equation.

That makes it quite sensible to have a function SetRPM that takes RPM as a parameter and instructs a servo accordingly. It would be reasonable that such a function return nothing, as your professor suggested. What do you want to return?

In reality, SetRPM would probably take another parameter specifying which servo to operate on too.
7  Using Arduino / Project Guidance / Re: How to make a big instruments who interacts with body? on: October 17, 2014, 06:37:18 am
This might give you some ideas: http://en.wikipedia.org/wiki/Theremin
8  Using Arduino / Programming Questions / Re: PID command not working in compiler on: October 17, 2014, 06:19:20 am
The IDE doesn't look there for libraries. There should be a libraries folder in the folder where your sketches are. If not, create one and then copy the PID library folder there. Restart the IDE and you should hopefully get better results.
9  Using Arduino / Programming Questions / Re: problem with my sketch on: October 16, 2014, 05:20:29 pm
There is a missing closing brace at the end of setup, just before this line:
Code:
   void loop(){

To echo earlier comments though, if you need help fixing this one, you're really going to struggle to debug a sketch of this complexity.
10  Using Arduino / General Electronics / Re: Cheap and good way to feed 12v digital input on: October 16, 2014, 12:55:10 pm
Can't get much cheaper than a voltage divider; just make sure that your 12V input really is 12. In case it can be a little high, you may want to choose resistors to drop it a little lower than 5V - it'll still register as high.
11  Using Arduino / Motors, Mechanics, and Power / Re: Power supply on: October 16, 2014, 09:19:42 am
12-5 is 7 though. You can use the old fan under voltage method to get seven volts out of a PC PSU.
12  Using Arduino / Project Guidance / Re: Help needed on multiple input of data to exosite on: October 15, 2014, 01:48:32 pm
You have declared a second variable called temh here:
Code:
  float temh = dht.readHumidity();

This one is masking the static variable with the same name which you use to send data to exosite.

Get rid of the word float in the snippet above.
13  Using Arduino / Project Guidance / Re: Outdoor Weather Station - looking for ideas on: October 15, 2014, 12:47:50 pm
I tried wifi for a similar purpose, but didn't get anything like 150'. Admittedly, there are several brick walls in the way. My current solution is xBee pros - still in testing but certainly better than my wifi shield.
14  Using Arduino / Programming Questions / Re: HELP! on: October 15, 2014, 10:11:47 am
Another vote for a state machine approach.

I'd also look at using an array of structs to store the data associated with each tap - there's too much repetition in loop.

A simple improvement you could make is to use the constants you have defined for the pin numbers. In this routine in particular, it might help you see a way to simplify:

Code:
int GlassFill(int TapSole, int FillTime)
{
switch (TapSole)
  {
  case 8:
    digitalWrite(TapSol1, HIGH);
    delay(FillTime);
    digitalWrite(TapSol1, LOW);
    break;

  case 9:
    digitalWrite(TapSol2, HIGH);
    delay(FillTime);
    digitalWrite(TapSol2, LOW);
    break;

  case 10:
    digitalWrite(TapSol3, HIGH);
    delay(FillTime);
    digitalWrite(TapSol3, LOW);
    break;

  default:
    return -1;
  }
}

Note also here that not every execution path has a return value. Not that it matters because you never use it anyway.

Also, Don't Repeat Yourself: EmergencyStop should call MotorStop rather than replicating what it does.
15  Using Arduino / Programming Questions / Re: HELP! on: October 15, 2014, 08:04:16 am
Please attach your latest code - preferably not zipped.
Pages: [1] 2 3 ... 256