Show Posts
Pages: 1 ... 36 37 [38] 39 40 ... 44
556  Using Arduino / Displays / Re: shiftreg alternate IC on: February 24, 2011, 04:46:49 pm
I'm going to today,
with this tutorial:
it looks like a great tutorial.
557  Using Arduino / Displays / Re: LCD Backlight current on: February 24, 2011, 10:13:06 am
I just ordered this from SparkFun.
white on black LCD...
the spec sheet says
typical LED voltage 4.2
typical LED current 120ma

so, on the 5volt pin, (5.0 - 4.2)volts/ .120 = 5 ohms?

558  Using Arduino / General Electronics / Re: tx & rx pins on: February 24, 2011, 01:44:03 am
Yes it's important for code to be clear to a human as well as correct for the computer. And just to show that I don't practice what I preach, here's a line from the app I'm writing now.

Serial.print (isprint(((*(start + i)) & 0xFF)) ? (*(start + i)& 0xFF) : '.', BYTE);

Quick, you have 5 seconds to tell me what this does smiley


...errrr, ummmm...
559  Using Arduino / General Electronics / Re: tx & rx pins on: February 24, 2011, 01:26:31 am
      key = keypad.getKey();  //check for key event
      if (key = '0') return;       //action canceled
      if (key = '1')
        for (int i=0; i < 5; i++){
          MySettings.mySensVals[i] = 0;  //reset sensor values
        EEPROM_writeAnything(0, MySettings);  //save the settings
        delay(4000);  //wait for user to read message
  while (1);

I like it.  I can read it.  I looked at the conglomeration of NOTs, ORs, AND's, and WHILEs, and still couldn't get it.
I can follow this!
560  Using Arduino / General Electronics / Re: tx & rx pins on: February 24, 2011, 12:42:08 am
Thanks!  I'm trying to take in everything you said, I got most of it.
What about the Confirm_Pour() function, I will need the while statement or some kind of loop statement, won't I.  It's to give the user the option to cancel, after they enter a number.
How does this look:
void Confirm_Pour()
  srlcd.clear(); // Clear display, set cursor position to zero
  srlcd.print(key);  //LCD display the number they selected
  srlcd.print(" cups"); //plus cups
  srlcd.setCursor(0, 1); // Sets cursor position to the 2nd line
  srlcd.print("Press '*' to start or # to cancel"); //This needs to scroll across the 2nd line somehow so it can all be read
    key = keypad.getKey();
    if (key == '*') PourWater();  //turn on the water
    if (key == '#')
      srlcd.print("Action canceled");
      delay (5000); //wait for user to read message
      return;  //go back to the main loop routine
  while(key == NO_KEY);   

while(key = NO_KEY); 

PourWater =>  PourWater()


   while (key != NO_KEY)
      key = keypad.getKey();
      //just waiting for a key press here to start water flow...
Shouldn't these be "key == NO_KEY"?
yes, fixed

void CountPulse()
   FlowSensorCount++;  //increases the count from the interupt pin 2
Is the interrupt signal debounced?
I reckon it doesn't need to be, does it?  It's an interrupt signal on pin 2 coming from this flow sensor (hall effect):

while (key != '1' || key != '0'); =>  while (key != '1' && key != '0');
Are you sure?  That's actually what I had first, but then I thought, key will NEVER be 1 and 0 at the same time so the while statement will never end...  I'll go back and re-reason through it.

I'll keep browsing.
561  Using Arduino / Motors, Mechanics, and Power / Re: current rating for this plug on: February 24, 2011, 12:34:22 am
I think I'm going to go with 2 RJ45 plugs.  I need 5 wires going to my gearmotor and opti-detector, and then 5 wires going to a 575 mA solenoid and water flow sensor.  The gearmotor only draws 90 mA, but could stall at 800mA. 
Different specs I see show the RJ45 plugs to be rated at 1.5 A.  I like Cat 5 wire, too, as it's a heavier guage than a lot of these serial cables I've cut apart to interrogate.  Most of them are 28 gauge.
I can get RJ45 pcb mountable, and put them on my protoshield, so they line up with the Arduino's USB and DC jack.  It'll all come out the back of the enclosure.
Does RJ45's sound like they'd work?
562  Using Arduino / General Electronics / Can someone critique this please on: February 23, 2011, 03:52:07 pm
My first attempt was pretty bad, so I deleted it.  This seems a lot more concise.  It even compiles!
Could someone please look it over and tell me if it will work? 
My Uno will be here tomorrow.
563  Using Arduino / Displays / LCD Backlight current on: February 23, 2011, 12:55:30 pm
I can't find any info on this.
What's a typical resistor to use for the back light on a generic 16x2 LCD display with Blue backlight?
I'll connect it to the 5 volt pin.
564  Using Arduino / Displays / Re: how to set the contrast? on: February 23, 2011, 12:38:20 pm
I use a multi-turn potentiometer. It's a pain to turn this thing if I'm no the wrong end of the scale but once I get there I can adjust my contrast so much better than single turn pots. Just my 2 cents.
thanks, I have a multi-turn 10K, so will use that.
565  Using Arduino / General Electronics / Re: tx & rx pins on: February 23, 2011, 10:09:20 am
I think my code needs a LOT of help!  If anyone can tell what I'm trying to have it do and can fix it up a bit in a few minutes, they'll save me hours...
566  Using Arduino / General Electronics / Re: tx & rx pins on: February 23, 2011, 02:22:24 am
Here's my rough draft.  Ugh.  If anyone would like to re-model it into real code I would be VERY happy.  I've only ever coded in basic before a week ago, so this probably looks 'basic'.
All I worked on was the actual water flow part of the code.  I figured I should get that up and running first, before adding any frills like audio feedback or light sensing photocells...

attatchment removed, it was terrible!
567  Using Arduino / Displays / Re: how to set the contrast? on: February 23, 2011, 02:13:30 am
Great!  Sounds easy enough.
Something like a 10K?
568  Using Arduino / Displays / how to set the contrast? on: February 23, 2011, 12:34:20 am
I've got a cheap 16x2 LCD from Hong Kong coming, pictured below.  I am going to use the shiftLCD library.
So, that will take care of the 7 pins driving it.  The backlight-I will just hook up with a proper resistor.
But what about the contrast.  What do I do with that connection?
569  Using Arduino / General Electronics / Re: tx & rx pins on: February 23, 2011, 12:19:36 am
Pins   Description   Arduino Pin#
2   Serial to PC (debugging)   0,1
2   Shift LCD               12,13
1   Motor (on/off)            A4 (18)
1   Motor Relay 2P2T (reverse)   A3 (17)
1   Optical Detector           A2 (16)
1   I/O Knock sensor        A1 (15)
1   I/O Photocell              A0 (14)
1   Solenoid (water valve)   10
1   Flow Sensor                  2
7   Keypad                         3,4,5,6,7,8,9
1   I/O for Audio                  11
19   Total   

This is my pin line up
570  Using Arduino / General Electronics / Re: tx & rx pins on: February 23, 2011, 12:15:38 am
I'd be happy to post my code with offers on improvement!  If that's not imposing on anyone...
If it's split up into tabs, is there any way to post it here?  Or just zip it up and attach?
Pages: 1 ... 36 37 [38] 39 40 ... 44