Loading...
  Show Posts
Pages: 1 ... 700 701 [702] 703 704 ... 1039
10516  Forum 2005-2010 (read only) / Syntax & Programs / Re: Do something, let time pass but no pause, do some on: September 30, 2010, 02:44:04 pm
Sure, that's a common requirement for doing lots of things. Load the digital example file from the Arduino IDE called blink without delay to see how you can build a non-blocking time delay using the millis() function.

Lefty
10517  Forum 2005-2010 (read only) / Syntax & Programs / Re: changing a 16bit binary number into two 8-bit byte on: September 28, 2010, 10:37:33 am
The Arduino core library also has functions to extract the high and low bytes from a int:

http://arduino.cc/en/Reference/LowByte
http://arduino.cc/en/Reference/HighByte

Lefty
10518  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino encoder reading on: September 26, 2010, 11:00:30 am
Quote
I am trying to use this sketch to connect an Accucoder to a SerIO.

Com          Black      F
+VDC        Red        D
A            White      A
A'          Brown      H
B            Blue        B
B'          Violet      E
Z      Orange      C
Z'      Yellow      J
Case      Green      G
Shield      Bare      -

Does anyone know where I would connect  the Com wire?

I assume +VDC goes to one of the 5V plugs

I wonder what I should do with A' B' and Z'

Any clues woud be much appriciated.

It's good that you posted a link to the encoder. However if you look at the datasheet there are many optional encoder output types. We would need the full part number of your specific encoder to see which options dictate how the outputs should be wired.

You state: " I am trying to use this sketch to connect an Accucoder to a SerIO."

What is a SerIO? If you mean the Arduino serial data pins 0 & 1, there would be no direct connection wired between the encoder outputs and the arduino serial pins, that would be a software function that you would have to include in your sketch.

Lefty


10519  Forum 2005-2010 (read only) / Syntax & Programs / Re: I think I'm missing something on: September 15, 2010, 12:37:57 pm
Before digging into your code a quick question, have you wired a pull-down resistor for the switch input? If not that would cause unstable reading of the push button switch.

Lefty
10520  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino + RECEIVER R/C 2.4 GHZ on: September 16, 2010, 05:53:24 pm
Quote
I really tried but many have not yet succeeded

Show us (by posting) the code you have tried so far and tell us what did or didn't perform properly.

Lefty
10521  Forum 2005-2010 (read only) / Syntax & Programs / Re: calculating with analog input values on: September 15, 2010, 01:23:48 pm
Quote
(temp = ((val / 1023 ) * 5 - 0.5 ) * 100), not really caring that I'd lose precision because I don't think the sensor's that precise.

It's not just about precision loss but also truncation that can blow up calculations with gross math errors.

Lefty
10522  Forum 2005-2010 (read only) / Syntax & Programs / Re: calculating with analog input values on: September 15, 2010, 01:12:48 pm
I suspect your calculations are running into problems because of the use of float and int variables together in the same statements. I'll let the stronger software people explain it better then I can, but it's a common mistake for beginners to make.

Lefty
10523  Forum 2005-2010 (read only) / Syntax & Programs / Re: can you amend a global variable within a library? on: September 10, 2010, 05:22:51 pm
Quote
"de-reference operator"

Must you adult C types talk over us kids while we are in the same room.  smiley-wink

Lefty
10524  Forum 2005-2010 (read only) / Syntax & Programs / Re: Header file correct use? I'm getting an error... on: September 09, 2010, 08:28:11 pm
Hey Paul, you trying to trash a popular Arduino myth or something?  ;D

Lefty
10525  Forum 2005-2010 (read only) / Syntax & Programs / Re: Questions on attachInterrupt on: September 09, 2010, 08:20:17 am
at some time we have change on pin 2 so it running the "function1" function,

what will be happen if we have some rising on pin 3 when it running function1?

It will be ignored because when a ISR routine is first entered global interrupts are disabled. So unless you re-enable interrupts inside the ISR routine no other interrupt will be serviced.

will chip stop everything is doing on function1 and will start function2?

No, unless you have re-enabled interrupts inside function1 ISR.

or it will continue to execute the function1 and it will lose the rising ?

 It will continue to run function1 ISR, however I believe that the interrupt hardware will 'remember' (buffer) that second interrupt and will trigger it as soon as the ISR routine for the first interrupt completes. However if there were multiple interrupts for the second one then onlt the first will be buffered and indeed a interrupt will have been missed. The basic recommendation is that ISR functions should be as short and quick as possible and then return. Don't try to do much, usually no can just have the ISR set or reset a flag or variable and let the main loop code perform what action is required rather then try and do it inside the ISR. Indeed even calling other functions while inside a ISR function is not something recommended.

Lefty
10526  Forum 2005-2010 (read only) / Syntax & Programs / Re: Factory Default Sketch on: September 04, 2010, 01:35:06 pm
Quote
Can someone point me to where I can download the factory default sketch that comes preloaded on the Arduino 2009 boards? It's the one where the flashing on pin 13 speeds up like a drumroll.

Well I've never owned a 'real' Arduino so I have no idea what 'default' sketch may have come preloaded. All the clone boards and AVR chips I've bought have come preloaded with the simple blink program (one second on one second off) sketch that is in the ARduino IDE files/examples/digital folder.

Maybe someone here can confirm that there is some standard sketch loaded on the 'real' Arduino boards these days?

Lefty

10527  Forum 2005-2010 (read only) / Syntax & Programs / Re: Resetting millis() on: September 03, 2010, 12:21:36 am
Quote
Hello I want to know to how you guys were able to resolve this. In my case I had to do a custom form of delaying since the maximum delay that the Delay() function can handle is just 30seconds. I'm doing a logging systems that logs hourly. Another odd this is that My Arduino is getting crippled by the 9 hour rollover issue when it fact the millis() function has already been updated to last for 55 days... what am I missing here?

If you look at the blink without delay sketch in the Arduino IDE digital examples you will see that there is no reason to use delay(), it's a rather primitive and blocking function that is best not used these days.

 As far as your 9 hour rollover, are you aware that millis() returns a long value, sounds like you may be assigning it to a int variable rather then a long variable?

Lefty
10528  Forum 2005-2010 (read only) / Syntax & Programs / Re: Delay() a good way to wait several minutes? on: September 03, 2010, 12:27:08 am
Quote
For me there is also something appealing about a nice slow interrupt that only happens once per second. It seems it would give more programming options than waiting on a delay. Just my opinion.

There is also a very simple to use timer library called MsTimer2 in the playground that allows you to have interrupts generated at a programmable time frame you define.

http://www.arduino.cc/playground/Main/MsTimer2

Lefty
10529  Forum 2005-2010 (read only) / Syntax & Programs / Re: Debouncing on: August 26, 2010, 07:23:18 pm
Well debouncing a switch contact efficently inside a ISR is kind of tricky, as there could still be a lot of useless interrupts being generated from the switch bounces. If it could be debounced with a external filter components it might make for a simpler more reliable system, just saying....

Lefty
10530  Forum 2005-2010 (read only) / Syntax & Programs / Re: 8-byte double to 32-bit float on: August 17, 2010, 12:54:28 am
Quote
One other thing to try (I can't at the moment else I would): declare an Arduino variable of type 'long double'. That might be 64 bits and you can just import it directly.

I don't see that data type listed in the Arduino reference section.

http://arduino.cc/en/Reference/HomePage

Lefty
Pages: 1 ... 700 701 [702] 703 704 ... 1039