Show Posts
Pages: 1 ... 38 39 [40] 41 42 43
586  Using Arduino / Sensors / Re: Understanding 'Analog Buttons' on: February 16, 2011, 08:57:55 am
I'm trying to figure out how the code works to use AnalogButtons.  So I don't have any code yet.
587  Using Arduino / Motors, Mechanics, and Power / Re: Opening/Closing a cabinet drawer with a continuous rotation servo on: February 16, 2011, 08:40:57 am
Ah, I got.  That's a good way to do that!
588  Using Arduino / Sensors / Understanding 'Analog Buttons' on: February 16, 2011, 08:38:09 am
I'm trying to understand how AnalogButtons works

How would I code the analog buttons do to this
Btn1 to toggle intUserSelection between 2,4,6,8 or 10 (rolling back to 2 from 10)
Btn2 runs the function 'SolenoidOn' (which sets pin4 high for a time determined by intUserSelection)

But then while in the SolenoidOn function, I want to have the option 'Press any key to cancel'

So I've really got two different operations for a button--the normal operation that it does, but then if SolenoidOn function is running, the buttons take on a new purpose, to abort the SolenoidOn operation

589  Using Arduino / Motors, Mechanics, and Power / Re: Opening/Closing a cabinet drawer with a continuous rotation servo on: February 16, 2011, 12:17:49 am
interesting.  So, in your drawing, the limiting switches don't need wired to the arduino.  I see how they.  So I'd only have 2 I/O pins.  One for the relay, one for the DPDT switch, right?
590  Using Arduino / Motors, Mechanics, and Power / Re: Opening/Closing a cabinet drawer with a continuous rotation servo on: February 15, 2011, 11:42:19 pm
I would suggest you are better off having two switches (opto, magnetic, or even mechanical) that detect door fully closed and fully open conditons, that way your program can command the servo to stop without having to worry about stalled condition, or having to determine exact timing of travel.

Lefty
Hmm, there goes another I/O pin or 2!
I was hoping a stalled condition wouldn't be too hard on a servo...

a note:
perhaps Sparkfun's Optical Detector / Phototransistor - QRD1114
sku: SEN-00246
could detect 2 end marks or protrusions added to the side of the drawer to give the right span.
591  Using Arduino / Motors, Mechanics, and Power / Bottomline question: Does it harm a servo to let it be stalled for 1 second on: February 15, 2011, 10:37:29 pm
I'll be driving it via a rubber wheel on the side of the wood drawer. The drawer only opens 8", and the weight of it's contents will never change.  My plan is that the drive wheel will have enough friction to open/close the drawer, but not too much that if someone closes it manually, the drive wheel/wood side will let it slide back. 
Timing:  It should only take a second or 2 to open, so that's why I'm thinking if I leave the servo on for say 1 second longer than what ever time it actually takes, then turn it off.  That shouldn't hurt it, should it?  It's usage: probably once a day, average.
So my question:  Is that too hard on a servo, being stalled for 1/2 to 1 second?
592  Using Arduino / Motors, Mechanics, and Power / Opening/Closing a cabinet drawer with a continuous rotation servo on: February 15, 2011, 06:24:51 pm
Using 2 I/O pins, one controls the servo, the other turns power on to the servo via an N channel mosfet (http://www.sparkfun.com/products/10213)

If I had ButtenOpen turn on the servo power, and send the rotation command to the servo, and give it a delay long enough to open the drawer, then turn power off.  And ButtonClose would work the same way, turning on the servo, giving the close signal, delay, turning off power to servo.
Turning off power to the servo should ease the problem of someone manually opening or closing the drawer.  Does this sound like it would work. 


...Any thoughts?
593  Using Arduino / Displays / Re: does shiftreglcd work with a backlit lcd on: February 15, 2011, 06:15:54 pm
Be aware that the back light might / probably will need a small resistor in line to keep the current in check.
1K ?
I can check the mA, what is the typical current or resistor size used on these?  It's just a common 16x2 coming from Hong Kong.
594  Using Arduino / Storage / Re: How to save an integer in eeprom on: February 14, 2011, 08:15:26 am
Thanks!  Now it compiles.
595  Using Arduino / Storage / Re: How to save an integer in eeprom on: February 14, 2011, 12:26:00 am
...I added them, but it's the same error
This is my complete sketch, not just part of it, if that helps debug:

Code:
#include <EEPROM.h>

template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
    const byte* p = (const byte*)(const void*)&value;
    int i;
    for (i = 0; i < sizeof(value); i++)
  EEPROM.write(ee++, *p++);
    return i;
}

template <class T> int EEPROM_readAnything(int ee, T& value)
{
    byte* p = (byte*)(void*)&value;
    int i;
    for (i = 0; i < sizeof(value); i++)
  *p++ = EEPROM.read(ee++);
    return i;
}


struct config_t
{
    int mynumber1;
    int mynumber2;
    int mynumber3;
} configuration;

void setup()
{
    EEPROM_readAnything(0, configuration);
    Serial.begin(9600);       // use the serial port
    Serial.println(mynumber1, DEC);
    Serial.println(mynumber2, DEC);
    Serial.println(mynumber3, DEC);
    // ...
}
void loop()
{
    // let the user adjust their settings
    // I'll put values here to simulate user selected options
    mynumber1 = 1035;
    mynumber2 = 34;
    mynumber3 = 845;

    // if they push the "Save" button, save their configuration
    if (digitalRead(13) == HIGH)
        EEPROM_writeAnything(0, configuration);

}
596  Using Arduino / Storage / Re: How to save an integer in eeprom on: February 13, 2011, 10:55:35 pm
Hmm, I thought something like this code would test out my 3 numbers being saved, but it doesn't compile.
Code:
#include <EEPROM.h>

template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
    const byte* p = (const byte*)(const void*)&value;
    int i;
    for (i = 0; i < sizeof(value); i++)
  EEPROM.write(ee++, *p++);
    return i;
}

template <class T> int EEPROM_readAnything(int ee, T& value)
{
    byte* p = (byte*)(void*)&value;
    int i;
    for (i = 0; i < sizeof(value); i++)
  *p++ = EEPROM.read(ee++);
    return i;
}


struct config_t
{
    int mynumber1;
    int mynumber2;
    int mynumber3;
} configuration;

void setup()
{
    EEPROM_readAnything(0, configuration);
    Serial.begin(9600);       // use the serial port
    Serial.println(mynumber1, DEC);
    Serial.println(mynumber2, DEC);
    Serial.println(mynumber3, DEC);
    // ...
}
void loop()
{
    // let the user adjust their settings
    // I'll put values here to simulate user selected options
    mynumber1 = 1035
    mynumber2 = 34
    mynumber3 = 845

    // if they push the "Save" button, save their configuration
    if (digitalRead(13) == HIGH)
        EEPROM_writeAnything(0, configuration);

}


error: expected "," or "..." before "&" token
I don't know where the error is.
597  Using Arduino / Storage / Re: How to save an integer in eeprom on: February 13, 2011, 10:03:15 pm
Thanks!
Quote
It will be proposed for built-in support in a future release like 0014.
...I'd vote for it!  But we're already up to release 0022, so it must not be popular.
598  Using Arduino / Storage / How to save an integer in eeprom on: February 13, 2011, 06:30:55 pm
I need to store 5 integers in eeprom.  I kinda follow the example sketches given on eeprom write and right, but they are for one byte. 
Could someone please give me an example sketch of how to write and then read just 1 integer in eeprom.  The integer could be either 2,3, or 4 digits, depending on user selected input.
If I can see how to do this for 1 interger, then I can figure out how to save/load all 5 of my integers, maybe starting each one at different addresses in eeprom like 10, 20, 30, 40, & 50.
Thanks.
599  Using Arduino / General Electronics / Re: Panel mount jack on: February 10, 2011, 07:40:25 pm
Quote
If, however, such connections need more protection from being unplugged, four-pin RJ11 plugs and jacks are a robust and easy-to-use (not to mention common) solution.

Great! I wondered about them, just how much current they can handle.  I'm getting a large full rot. servo from SparkFun.  I can't find out what current it draws, nor do I know what an RJ11 Jack can handle.  But I'd guess half an amp for the servo, and probably an 1amp for the jack?
600  Using Arduino / General Electronics / Re: Panel mount Photoresistor on: February 10, 2011, 12:45:24 pm
Hey, that's a good idea.  I could put something clear in front of it to help make it waterproof...
Pages: 1 ... 38 39 [40] 41 42 43