Show Posts
Pages: 1 ... 38 39 [40] 41 42 ... 44
586  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?
587  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.
588  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.
589  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.
590  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;

591  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
}
592  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?
593  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'
???
594  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?
595  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

596  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.
597  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?
598  Using Arduino / Sensors / Re: Understanding 'Analog Buttons' on: February 16, 2011, 08:42:05 pm
...I'll be working on a Flow Chart in Excel, be back later, but I still hope someone answers my previous post, I think I'm correct in the way I understand it.
A flow chart is a very good idea, thanks.
599  Using Arduino / Sensors / Re: Understanding 'Analog Buttons' on: February 16, 2011, 08:26:38 pm
Am I correct that analogButtons.checkButtons();
should be in my Loop routine, and then in the function
void handleButtons(int id, boolean held)
is where I actually put the commands to call different routines, depending on which button was pressed?
600  Using Arduino / Programming Questions / Re: Different Tabs on: February 16, 2011, 08:20:32 pm
So for now, just learning, I can add additional tabs and when I name them, add .pde to the name.  Then when I compile, it will be like they are all together as one sketch. (Variable references in other tabs will work fine)
This will help organization.
Pages: 1 ... 38 39 [40] 41 42 ... 44