Show Posts
Pages: 1 ... 129 130 [131] 132 133 ... 364
1951  Using Arduino / General Electronics / Re: converting 5v to 12 V on: August 01, 2013, 09:39:44 am
If you're going to covert without external power then be really careful about how much current you draw. Arduino IO pins are not good for much 5V, not recommended for more than 20 mA of 5V, or total from the board of 200 mA so how much 12V would you expect to get out?

It's better and cheaper to use external power and be sure to connect the grounds unless you use an isolator to level up with.
1952  Using Arduino / Programming Questions / Re: Help Please! Can someone check the source code of my program please? on: August 01, 2013, 07:22:52 am
Try taking smaller bites.

Make different sketches that get each piece/concept working before having any serious thoughts about how they go together. What works may well be different than what you thought would work and that can change how it all fits, works and plays together well.

Work in steps and check compile often. Use Auto Format now and then, if your braces don't match up it will tell you. The -last- thing you want to do is throw up a pile of code and -then- run compile, you end up troubleshooting with many unknowns and their interactions and then what? You end up simplifying down to the stages you should have started with after going through more work. If you're stuck on the original overall structure, fitting the fixed pieces in "to save time" usually doesn't save time or fit well.

It's good to have an original plan but don't get too specific until you have the pieces. Always be ready to make changes and keep your eyes and mind open to discoveries along the way. Don't expect to be perfect, just keep getting better through practice and learn/adapt from everything that interests you.

I have no idea if there's some way to use this:
Code:
if(solenoid == 0 & timerClosed >= timeClosed)
but that's not how to make something happen on time.
The BlinkWithoutDelay Example (in 02. Digital) in your IDE shows how. The example does use longs for 2 of the time variables. They should be unsigned long but unless you're going to have intervals over 23 days long it isn't an issue.

What blinks a led can flipp a switch. What reads a pot reads analog. Do tutorials.

I hope this helps.

1953  Using Arduino / Programming Questions / Re: HELP!!!! new to programming on: July 31, 2013, 08:36:15 pm
Apologies ... I assumed you were talking about the PC end.

Your buttons go to pins on the Arduino that are defined in statements like this
Code:
void setup() {
  pinMode(14, INPUT);  //enter
  pinMode(15, INPUT);  //up
  pinMode(16, INPUT);  //down
  pinMode(17, INPUT);  //left
  pinMode(18, INPUT);  //right
  //other setup code...
}

The 14 - 18 are Arduino pins NOT physical numbers.

Buttons are wired: http://arduino.cc/en/Tutorial/Button

One reason to learn the Control Examples in the IDE before writing your own code is to learn about arrays and for-loops.

Code:
#define KEYS 5;
byte keyPin[ KEYS ] = { 14, 15, 16, 17, 18 }; // easy to change once here, easy to use below
enum { enter, up, down, left, right } key; // learn about these later, just be aware

void setup() {
  for ( byte i = 0; i < KEYS; i++ ) // i will not exist outside of this for loop
  {
    pinMode( keyPin[ i ], INPUT );   
  }
  //other setup code...
}
1954  Community / Bar Sport / Re: I don't like counting braces on: July 31, 2013, 01:44:43 pm
If I put my cursor over one brace the IDE puts a rectangle around the one it calls the match.

Please note that if you use state machine type code and keep the blocks small/short, you can usually avoid deep nesting altogether.


1955  Using Arduino / Project Guidance / Re: Reliable One-Wire for Long distances on: July 31, 2013, 01:41:39 pm
Not 1 wire but a good answer to RS232 limits is RS485. --- note that Dino got in while I was typing this.... 800m! Wow!

I have no part in this store except I've bought from there twice with no problems:
http://yourduino.com/sunshop2/index.php?l=product_detail&p=317

Quote
MAX485 RS485 Transceiver (Pkg of 10)
SKU: EC-110418
Your Price:    $2.00
Stock:    401

The shipping is not cheap **compared to the knock-down chip prices** so I end up picking up extra chips usually 5 for 75 cents to a buck and a half. If you do order there, spend some time browsing the stock and bargain bins as it were. You might get ideas.

Another thought that might help or not is that if you're using CAT 5 then you have 4 pairs that could run 4 1-wire buses. With many devices adding to the 'weight', wouldn't distributing them be one way to increase the working length?
1956  Using Arduino / Project Guidance / Re: Reliable One-Wire for Long distances on: July 31, 2013, 06:24:43 am
Quote
I've got 4 of the modules with on-board antennae, but hardly used them on account of their breadboard-unfriendly pinout. Theres 2 rows of 4 pins right next to each other, necessitating the use of dupont cables or a 2 row socket and some extra wire.

Dig through old PC cables, there's the old 2x5 10-wire ribbon mobo to back panel 9 pin serial cables and like. I've got a bag of crimp female connectors for the cut-off ends and snap-off header pins for menders. Goodwill usually has boxes of cables reasonably cheap but so far my boneyard (set of boxes and tubs full of "junk") has enough for me.

**ps: I have read all of the app notes from Maxim

Are you sure you have seen this one? Guidelines for Reliable Long Line 1-Wire® Networks
http://www.maximintegrated.com/app-notes/index.mvp/id/148

If the weighting you calculate doesn't add up then look for whatever it is you missed.


1957  Using Arduino / Project Guidance / Re: Reliable One-Wire for Long distances on: July 31, 2013, 05:26:22 am
The cheapest I can buy 50m of Cat5 costs more money than 2 of these modules cost. They have a range of 1000 meters...
http://www.ebay.com/itm/2-4G-nRF24L01-1000m-RF-Wireless-Module-NRF24L01-PA-LNA-w-2DB-Antenna-EW24L01-/261219518108?pt=LH_DefaultDomain_0&hash=item3cd1e5869c

Line of sight?

1958  Community / Bar Sport / Re: I don't like counting braces on: July 31, 2013, 05:11:45 am
Quote
You got to play with Transputers?
Play?

We had a 90 processor array at one point for real-time video processing - only ever built three of them.

Back before 2000, anything I liked was play even if it was harder than chewing rocks.

1959  Community / Bar Sport / Re: I don't like counting braces on: July 31, 2013, 05:09:26 am
Indenting works for me, but I put the opening brace on a new line, I rarely get right across the page  :-

Code:
function foo(x,y)
 {
    bar();
    baz();
    if (x>y)
       {
        xyzzy();
        thud();
       }
  squeak();
 }

of course I auto format before posting any code on the forum, or some people moan :-)

I auto format early and often.

When I write a block I start by putting in both braces then going back up to fill. Or I try to remember when I'm not fixated on an idea that could slip away in a second.

if ( something )
{
}

becomes

if ( something )
{
  whatever
}

Note also the whitespace around parenthesis. It's easier on the eyes which leads to slower burnout and fewer times confusing )) with 1) or )}. My eyes are so bad now I'm using 12 or 14-point font in the IDE (I forget which, it's probably 16 anyway) and 120% on the browser here.

Eyestrain makes head pain and that just slows me down.
1960  Community / Bar Sport / Re: I don't like counting braces on: July 31, 2013, 04:56:55 am
Quote
It's like trying to communicate with someone where the length of the pauses between sentences has some hidden meaning.

-    .-.   ..-  .    smiley

Neat chart for Morse Code:
http://www.learnmorsecode.com/

1961  Community / Bar Sport / Re: I don't like counting braces on: July 31, 2013, 04:49:59 am
Quote
Are there any programming languages, even esoteric ones, that come right out and tell you the level of nesting?
I programmed a lot in occam, and it only uses the level of indentation to define blocks - no braces to count.


 smiley-eek You got to play with Transputers?

MAJOR Envy!

1962  Community / Bar Sport / Re: How to control a cat with an Arduino on: July 31, 2013, 04:47:58 am
He had to use bacon? I just had to act like it was food. Crinkle some plastic first if the dog is the suspicious type. Wrappers mean candy.

1963  Using Arduino / Programming Questions / Re: Problem communicating one-way between XBee’s and then the PC on: July 31, 2013, 04:20:13 am
This won't work unless you want UNO2 to broadcast:

(UNO1 pins 0 & 1) to xbee1 <---> xbee2 to (pins 0 & 1 UNO2 pins 0 & 1) to USB cable <---> PC

because UNO2 to PC will also send xbee2 to xbee1.

This will work if you want discreet communications:

(UNO1 pins 2 & 3) to xbee1 <---> xbee2 to (pins 2 & 3 UNO2 pins 0 & 1) to USB cable <---> PC

because xbee2 is using a different serial channel than the USB to PC connection.

Wiring the xbees to pins 2 & 3 allows connecting both UNO's to the same or different PC's. That's right, you can run 2 IDE windows to 2 USB channels with 2 serial monitors. I've done it to test UNO Software Serial to UNO Software Serial... best reliable speed I can do is 57600.
1964  Community / Bar Sport / Re: How to control a cat with an Arduino on: July 30, 2013, 11:26:39 pm
Waiting to see a cat in a little kitty wingsuit since there already looks to be a cat (fake or rug?) built into a quadcopter.

This is sick so if you're a cat lover, don't look:
http://www.huffingtonpost.com/2013/03/21/andrew-lancaster-cat-skin-rug-auction_n_2925875.html

Lancaster the taxidermist should also become a vet. That way no matter what happens, you get your pet back.


1965  Community / Bar Sport / Re: "The Physics Problem" on: July 30, 2013, 11:17:54 pm
Mine are inner ears and kinesio sense I was born with and trained.
Unfortunately they are not calibrated, nor are my eyes and ears, etc.
All are Mk I OEM wetware parts though the eyes have manufacture defects.
Pages: 1 ... 129 130 [131] 132 133 ... 364