Loading...
  Show Posts
Pages: 1 2 [3] 4 5 ... 18
31  Using Arduino / Project Guidance / Re: Advice Needed On Debounce Sketch and Logic - Newbie to Programming on: May 06, 2013, 09:01:12 pm
At present i have three questions

1. Will this sketch work as intended (subject to meeting the below requirements), it verifies is this a good sign ?

The fact that it verifies only tells you that the syntax is correct, not whether it will work as intended.
Quote
2. Is there a command to furfill pre-requistes on push button switches....my sketch at present still means that any of the push buttons can be operated by the user and something will happen. It needs a sequence of events.

By which i mean if there are 3 push buttons, (button1, button2, button3). How do i tell the program that button 1 must be HIGH before button 2 can be HIGH, Button2 Must be HIGH before Button 3 can be High.
Try something like this:
Code:
if(button1 && button2 && button3){...
// only true if all three buttons are HIGH at the same time

if(button1 || button2 || button3){...
//true if any one (or more) of the three buttons is HIGH
//false if none of the buttons are pressed

//or you could use nested if statements

if(button1){...
   if(button2){...  //here, both buttons must be high for this to be true
       if(button3){...  // here, all three buttons must be high for this to be true
       }
   }
}
32  Using Arduino / Project Guidance / Re: Advice Needed On Debounce Sketch and Logic - Newbie to Programming on: May 06, 2013, 08:30:34 pm
Code:
if (buttonState == HIGH) {   
  // turn LED on:   
    digitalWrite(ledReadyDispatch, HIGH); 
  }
  else {
  // turn LED off:
      digitalWrite(ledReadyDispatch, LOW); }
Much simpler
Code:
digitalWrite(ledReadyDispatch, buttonState);

Or even:
Code:
digitalWrite(ledReadyDispatch, digitalRead(buttonReadyDispatch));
Quote
There's no reason I can see for buttonState to be a global.
I can see no reason for buttonState.
33  Using Arduino / Project Guidance / Re: Automated Bar - The Beginnings on: May 06, 2013, 08:15:32 pm
Flushing the lines would work, but I guess dealing with the water would cause issues. I would need to prevent it from being mixed in with the other drinks. So, it looks like the option is to pressurize the bottle containing the alcohol, and letting a solenoid control the flow.

Why not just use gravity? Most alcoholic drinks have a viscosity of less than water, so there'll be no problem with the flow. See:
http://www.ebay.co.uk/itm/Beaumont-25ml-Solo-Pub-Spirit-Measure-Bar-Optic-/300607619410

Mount your optics and bottles on a carousel. Turn the carousel until the required bottle is over the glass. Lift the glass to open the optic. Wait until the optic is empty. Lower the glass. Serve the drink.
Pros:
Two stepper motors, no tubing or pumps to clean, accurately measured volume, will work with 'crystalised' glasses, all very simple.
Cons:
All your glasses would have to be of similar height or you'll need to test when each glass has been lifted enough to operate the optic, but not enough to smash it. smiley
34  Using Arduino / Project Guidance / Re: IR led sensing IR led Reflections. on: May 06, 2013, 07:45:34 pm
Can you please post your schematic, as I'm planning on using reflected IR in one of my projects.
35  Using Arduino / Programming Questions / Re: "Hourglass" without delay - understanding if, while, & for loops on: May 05, 2013, 09:40:46 pm
I would use a switch case statement.

Code:
int state =0;
unsigned long startTime = millis();
void setup{
turn on all your LEDs
}

void loop(){

if (millis() -startTime >=6667){
 state ++;
 startTime =millis();
 switch (state){

case1:
 turn off first LED;
 break;

case2:
 turn off second LED;
 break;

case3:
 turn off third LED;
 break;

...etc

case9:
 turn on all LEDs;
 state = 0;
 break;

default:
 whatever you want to happen if there's an error;
 break;
}
}
read your button presses here.
}
36  Using Arduino / Project Guidance / Re: Strategy for long duration subroutine on: May 05, 2013, 09:07:04 pm
I have been thinking of a state-machine but the nature of the servo movements (at least as I conceive them at the moment) suggest that it would get very complex and I am wondering is it worth the trouble. I will give it more thought in case there may be a different way of managing the servo movement.

Why complex?
Code:
long routine(){
if(servos have not reached their destination){
step servos once
}
}
shortroutine1{
if(there's something useful for it to do now){
do it
}
}
shortroutine2{
if(there's something useful for it to do now){
do it
}

}

That way, all your routines get equal treatment each each time round the loop, no matter how long each routine takes.
37  Using Arduino / Project Guidance / Re: Automated Bar - The Beginnings on: May 05, 2013, 08:44:15 pm
I was looking into making my own automated bar as a fun project to work on. I just had some questions about feasibility and different ways to approach it.

My idea was to use a Peristaltic pump to move the liquids around. This would allow me to accurately measure the amount of fluids that are dispensed. The problem is that they are expensive, so I would like to minimize the amount of pumps that would be needed. I was thinking of using 2 pumps, one for alcoholic beverages, and the other for non-alcoholic beverages, and using solenoid valves to select which bottle the pump draws from. My problem is finding a way to get the solenoids to flow into one output so I can feed that into the pump.

I am assuming that you can pump carbonated beverages through piping without it losing its carbonation. I was just mulling this over, and haven't put any money down. It seemed like it would be something neat to do, as well as something that I can expand to include more functionality. Thank you for any input.

I think you're going to have some very messy alcoholic drinks. Imagine passing advocaat, creme de menthe and whisky through the same pump, one after another!!!

Why not use a similar method to how pubs measure and serve drinks? Use solenoid operated optics. Move the glass under the required optic before activating it. That also solves the measurement problem. In pubs, carbonated drinks and draught beers are dispensed (under pressure) from a 'trigger' or tap. You could replace the trigger/tap with a solenoid valve. If all your glasses are of a standard capacity, you only need to time how long it takes to dispense a 'glassfull', assuming that the pressure is kept constant.
38  Using Arduino / Programming Questions / Re: how to run a loop n number of times on: May 04, 2013, 08:50:51 pm
Ok, so here is where I'm at with my programming knowledge. I don't know what a flag is. But I'll mess around with the for loop for a while and see how it goes.
   
    Thanks

A flag is just another variable that can either be 0 or 1.
You define it as boolean
eg. boolean x = 1;
39  Using Arduino / Project Guidance / Re: PIZZA OVEN PROJECT on: May 04, 2013, 08:26:44 pm
Degrees C, Degrees F or Degrees K?

500oC would be pretty crispy y'know.


Depends how long he leaves the pizza in the oven smiley-razz
The Arduino can count in microseconds...
40  Using Arduino / General Electronics / Re: Loooooooong cable... on: May 03, 2013, 09:30:18 pm
out of interest, what would be too long... i suppose the resistance of the wire before the interference?

but 100's of metres, 1000's of metres?

You could go from Bristol to London IF your wire is thick enough smiley-wink
The limitation would be the cost of that much copper!
41  Using Arduino / General Electronics / Re: next generation transistors! on: May 03, 2013, 09:14:35 pm
Wow! Amazing indeed.

Presumably, there would have to be another conducting layer above the gallium beads to complete the circuit.

Light emitting wallpaper and cheap multilayer photovoltaic cells are a couple of uses that spring to mind.
42  Using Arduino / Programming Questions / Re: Stepper Motor Speed Increase Response to Sensor on: May 03, 2013, 08:40:32 pm
i is just a counter to keep track of the number of steps taken.
Yep, I forgot to declare it smiley-eek-blue
You should declare it as an int before loop().
Introducing unnecessary global variables is poor style, this sort of loop variable should
be declared locally like this:
Code:
  for (int i = 0; i<stepsPerRevolution; i++){

Doesn't that re-declare it each time around the loop?
I've read (on this forum) that re-declaring a variable uses stack space each time it's re-declared, leading (eventually) to stack overflow. Maybe I misunderstood.
43  Using Arduino / Programming Questions / Re: Timer1 interrupit problem on: May 03, 2013, 08:24:39 pm
the code has compiled, but don't work.

the code should call the function ping every 5 seconds if it does not receive "the command" via serial port, but it hangs on the call interruption and not run but nothing.

What is this line supposed to do?
Code:
 for(;x==0;y=0)
 
44  Using Arduino / Project Guidance / Re: PIZZA OVEN PROJECT on: May 03, 2013, 07:43:48 pm

- Sensor Temperature (which use ?) --> because right now I've use only a DS18B20 but the max temperature is 125 ° and I need at least for to be sure 500°

Degrees C, Degrees F or Degrees K?
45  Using Arduino / Project Guidance / Re: Lift with Arduino on: May 03, 2013, 07:38:14 pm
Hi, i have an idea on how it will work but it's hard to translate that in programming.

So, when I turn on the arduino, i would like a kind of Initialisation. So the lift verify that it's in the bottom of the structure (floor 0 ).

What if it's not at floor 0 when you turn it on?

Quote
And, from that "point", it's waiting for a call. For example, the lift is at level 0, it's called at floor 2, it speeds up, and when it arrives at level 1,5 it speeds down and stops at floor 2.

now, i imagine that the lift is moving, i have absolutely no idea how i can "rember" a push on a button WHILE the motor is turning.

Set the motor running
Start checking
Check the buttons and position switches (save the results in variables)
Has lift reached the point where it needs to slow down?
If it hasn't, go to start checking
If it has, slow the motor.
Has lift reached the floor?
If it hasn't, go to start checking
If it has, stop the motor, open the doors
Now see what buttons have been pressed and act on those.

Quote
EDIT: I also have to respect the priority. If the guy at floor 1 want to go at Floor 3 and that a guy in floor 2 also want  to go to floor 3, so the lift has to stop at floor 2 before going to 3. So I suppose I will have a VAR for the direction of travel smiley

And one for each position switch and one for each push button and one for each set of doors (to know whether they are open or shut).

Other things to think about are, if the lift is on, say, level 3, is empty and no buttons have been pressed, does it stay there or does it return to level 0? Do the doors stay open or do they close when the lift is inactive?
Pages: 1 2 [3] 4 5 ... 18