Show Posts
Pages: 1 ... 38 39 [40] 41 42 ... 44
586  Using Arduino / Motors, Mechanics, and Power / Re: Opening/Closing a cabinet drawer with a continuous rotation servo on: February 22, 2011, 01:02:41 am
You could make a setup like below using a gear motor. If youdrive the drawer from the bottom, the drawer might have enough upward play to lift off the wheel when being manually moved. 


...after listening to a servo, I'm think more about going your route.  Plastic geared servos sound pretty chinzsy.  I reckon there's probably good quality ones, better than SparkFuns.  But this diagram you drew is a more correct to do this.  I picked up a nice gearmotor.

587  Using Arduino / General Electronics / Re: tx & rx pins on: February 22, 2011, 12:56:11 am
Can I use digital pins 0 and 1 just like any other of the digital pins?

Yup.

Quote
Does it just mean that I wouldn't be able to use the serial port back to my pc to get serial.print commands?

Yup.  You may have problems uploading the next Sketch.  Holding reset until the upload starts should get you through.

Quote
what about analog pins, how do I use them for simple digital pins, or can I?

They are accessed in exactly the same fashion (pinMode, digitalRead, digitalWrite).  The pin numbering starts at one more than the last digital pin.  For example...

http://arduino.cc/en/Main/ArduinoBoardUno

The last digital pin is "13".  Analog pin "A0" is also digital pin "14".  Analog pin "A1" is also digital pin "15".  Etcetera.


GREAT!
So there's actually 20 digital pins available on the Uno, then.  I thought someone said 19.
My first project is coming up with 19 pins.  Too bad it's not 18, then the serial would still be available.  I won't need it once I'm done coding, though.
I could use a shiftreg on my LCD, it looks pretty simple.  It looks easier than analoging a 4x3 keypad down to 1 pin.
588  Using Arduino / Sensors / Re: Combining digits from the keypad.getKey() function on: February 22, 2011, 12:50:01 am
Well, just take the inputs & do some math on it:
before reading clear the prior entries
digit1 = 0
digit0 = 0

after you get the entries
total = 10*(digit1) + digit0


Or, you will have a 4x3 keypad?
Make one of the keys = 10.
1-2-3-4-5-6-7-8-9-10-enter-clear
0 = 10,
# = clear,
* = enter

Thanks, yes, 3x4,
 I see now.  I could do either of these...
589  Using Arduino / General Electronics / tx & rx pins on: February 22, 2011, 12:40:16 am
Can I use digital pins 0 and 1 just like any other of the digital pins?  Does it just mean that I wouldn't be able to use the serial port back to my pc to get serial.print commands?

what about analog pins, how do I use them for simple digital pins, or can I?
590  Using Arduino / Sensors / Combining digits from the keypad.getKey() function on: February 21, 2011, 11:47:19 pm
Keypad matrix, using the library:
 http://arduino.cc/playground/Code/Keypad

...
Code:
void loop(){
  char key = keypad.getKey();
 
  if (key != NO_KEY) {
    Serial.println(key);
  }
}

If the user wanted to input the number 10, how would I 'get' that number from the two keypresses '1' and '0'
I haven't written any code yet for the keypad, but here's what I'm thinking:
lcd.print:  "Enter the number of cups of coffee & press #"
     user can enter a number (2,4,6,8,10)
So if they they enter 2 digits, I need to combine them into 1 variable.
591  Using Arduino / Storage / Re: What is the 'config_t'? on: February 18, 2011, 06:53:33 pm
...no, it doesn't seem to be optional like that webpage says, at least it doesn't compile without it.
592  Using Arduino / Storage / Re: What is the 'config_t'? on: February 18, 2011, 06:48:11 pm
Ah, I got, after looking up 'tag', this is very clear:
http://www.exforsys.com/tutorials/c-language/c-structures-and-unions.html

...so it's optional.
593  Using Arduino / Storage / What is the 'config_t'? on: February 18, 2011, 04:31:27 pm
The code I'm working with:
http://www.arduino.cc/playground/Code/EEPROMWriteAnything

I know it works, but if I can understand HOW, it'll be way better. So...
There's no mention of 'struct' in the reference pages, but I understand that it makes something like a group variable.  What is the 'config_t'?  I couldn't find much googling it.
struct config_t
{
    long alarm;
    int mode;
} configuration;

594  Using Arduino / Motors, Mechanics, and Power / Re: does a detached servo with power sraw current? on: February 18, 2011, 08:46:05 am
The reason for this question:  I'm still hoping to just use a servo to open and close a drawer (the drawer is actually a platform on which a coffee pot sits in a cupboard).  I know a servo is not designed to be used this way, but it would save having to rig up extra sesnors/limit switches, and a servo is easy to use. Being it's just used a few seconds a day thing, maybe it'll work for years. 
Here's my first run at code for it.  Does it look promising?
Code:
/* servo speed:
0    full speed reverse
90   stopped
180  full speed forward
*/
Servo myservo;  // create servo object to control a servo
 
void Servo_Out()
{
  myservo.attach(ServoPin);  // attaches the servo on pin 9 to the servo object
  lcd.clear();
  lcd.print("1 coffeepot coming up, er, out.");

   int intDelay = 20;  //changing delay will change the overall distance.
   int x = 1;
   for (int i = 91; i > 90; i = i + x){  //loop from 90 to 179 and back to 90
      myservo.write(i);     // sets the servo speed
      if (i = 179) x = -1;  // start to slow down at full speed
      delay(intDelay);  // set distance to 0.5" longer than drawer travel
   }
  myservo.detach();  // detaches the servo on pin 9 to the servo object
}
595  Using Arduino / Motors, Mechanics, and Power / does a detached servo with power sraw current? on: February 17, 2011, 11:44:02 pm
Code:
  myservo.detach(ServoPin);  // detaches the servo on pin 9 to the servo object
If you detach a servo, but still have the Gnd & +5 volts wires hooked up, is it drawing any current or holding it's current position?
596  Using Arduino / Programming Questions / sending flow back to the Loop() on: February 17, 2011, 06:53:55 pm
It seems I can't just add the line somewhere in a function
Loop;
and have it go back to the Loop() routine?

I put a label first thing in the Loop() routine called
StandbyLoop:
but my reference to it later (goto StandbyLoop;) comp\iles with 'label used, but not defined'
???
597  Using Arduino / Sensors / setting a pin high the 2nd time on: February 17, 2011, 05:53:18 pm
Does it hurt anything to do this:
  digitalWrite(SolenoidPin, HIGH);  //turn on the water valve
...if the pin was already high?
598  Using Arduino / Programming Questions / Re: Different Tabs on: February 17, 2011, 09:29:07 am
What is the purpose of the #ifdef and the #endif do in your sketch?
Code:
#ifdef stand-alone
// Stand-alone photogate setting
#define button1_pin 11 //enter
#define button2_pin 13 //down pause
#define button3_pin 12 //up unpause
#define button4_pin 10 //Escape
#define gate0_pin 15
#define gate1_pin 14
#define gate2_pin 17
#define gate3_pin 16
#endif

599  Using Arduino / Programming Questions / Re: Different Tabs on: February 17, 2011, 08:45:38 am
Thanks for the tone sketch.  I'm gonna really like breaking things into tabs.  Thanks for the blog luidr.
600  Using Arduino / Programming Questions / Re: Different Tabs on: February 16, 2011, 09:18:31 pm
Thanks!
ps.  I'm looking for a little melody tune player, which where you using?
Pages: 1 ... 38 39 [40] 41 42 ... 44