Show Posts
Pages: [1] 2 3 ... 86
1  Using Arduino / Programming Questions / Re: Splitting an integer into its digits - floating point/rounding/conversion error? on: July 14, 2014, 03:17:52 pm
pow() is a function returning floats. Float operations are not exact. Ie when doing something where the answer "should be" 100.00", a float operation may return 100.000001 or 99.9999999. That is what (propably) is happening in your case. The int( ) opertion which is converting to integer mey do a truncate rather than a round. Your spreadsheet is more forgiving (having been written for use by  not-so-computer-science-minded customers).

Choose a differnet algorithm. For example use number %10 to get the last digit. Then reduce number by dividing it by ten, that way the last digit is now what whould be the tens.
2  Using Arduino / Programming Questions / Re: boolean doesn't response on: June 29, 2014, 04:58:34 am
@HugoPT - follow the git link he provided - extensive explanation given there.
3  Using Arduino / Programming Questions / Re: boolean doesn't response on: June 29, 2014, 04:44:06 am
By "stupid" holmes4/Mark means that you only show the code that sets GoToServo to false. Thus, as we can not see any code that sets it to something else, the code snippet is working exactly as it should.

Show all the code that makes changes to GoToServo. If you want to reduce the code posted, then you can exclude functions that make no change GoToServo (F.ex. I do not see the significance why you included the ServoMovement1() code. It does nothing as far as your problem is concerned )

BTW, the print does not "convert" a boolean type to a printable representation, it shows the (interal) value. You may want to replace it with
Code:
Serial.print(GoToServo?"true":"false")
4  Community / Exhibition / Gallery / Re: Harmonogram on: June 29, 2014, 03:00:43 am
Your projects always are stunning and complete.

Still, do I have to buy the book to know what sensors you used to get the pendulum position? Just out of curiosity. (And the techie in me about sampling frequency - analogRead being what it is in the Arduino)

I do not quite see why the pi came into the picture ... oh wait, it is a complete Linux pc, so it drives the screen. Oh, yes, when pausing the film I can see the wiring.
5  Using Arduino / Programming Questions / Re: Same function - different results?! on: June 26, 2014, 12:02:09 pm
"I have triple checked" ... indeed. (I have been there, just like you)  And when I finaly found the problem it was a typo I overlooked.

But you say you cut-n-paste. That leaves two possible causes. One of the variables is not local, or there is some scope problem, so you are using different variables in the "library". (What do you mean by library? A simple #include or a class where this is a memberfunction?) I do not have my Arduino handy here, so I can not test run.

The other cause is that your other code is writing into buffer locations which are OUTSIDE the array bound, which happens to clobber something in your code. Or you have run out of memory, and other functions by simply being called destroy memory here-and-there.

And the above list is in order of probability.
6  Using Arduino / Project Guidance / Re: Which timer library should i use? on: June 23, 2014, 04:06:26 pm
A stepper motor takes sharp steps a 200th-of-a-circle (for a typical motor). That's why it is called a stepper motor. smiley

Anything that makes regular vibrating motion (which is what your machine will do when the stepper steps) has a few frequencies where the machine (or parts of it) resonate and amplify the noise and the vibrations. That is the way mechanics and physics works. The frequency at which this happens varies with the mechanical construction it drives.

One engineering trickery is to make the steps less abrupt. The average steppermotor controller has therefore Microstepping which uses in-between values of the coils (which in full mode are fully on one way or the other). It also enables stopping "halfway" (or 32nd of a step) between the normal step positions. Like all trickery it comes at a price - in this case the microcontroller needs to geenerate step-pulses at 32 times the rate.

You can also mount the stepper motor with various rubber/vibration isolation mounts, and how the turning motion is connected to your machinery.
7  Using Arduino / Programming Questions / Re: function of code that interrupt calls is never run on: June 21, 2014, 06:57:40 pm
Does your program "stop" and do nothing more?

That is because in your interrupt you are calling a routine that uses delay.

Whilst in your interrupt routine the other other interrupts are blocked, and this millis() does not advance... delay() does not work.

When using interrupts you must keep the interrupt execution SHORT, and certainly not use delay().

The commented out code is better as a principle. Set the button state and test for it in the loop. To avoid the delays blocking the check for the new state,(which is te reason I guess that you decided you neeed interrupts)  you must avoid using delay().

Althouh you'd be better of using a proper timer and state logic, to keep things simple in THIS program you replace the delay calls in your loop (when turing things on or off) with something like
Code:
// digitalWrite(xx,HIGH); // whatever needed doing
millisstart = millis() ; note the time now
while ( millis() - millistart < 1000  && selectedPGM != buttonCallCancel ) // whilst the time is not done nor the button pressed again
    /* do nothing */ ;
 
8  Using Arduino / Programming Questions / Re: 2 timer relay. How to use mills instead of delay on: June 18, 2014, 04:54:19 pm
The other simpler example with two leds (instead of the single led in the much mentioned "Blink without delay", it does two - and no, I did not write it, it was a community effort by at least 5 of the big contributors) is HERE

And I did write somethig that very closely matches your requirement is this article ( comments and enhancments welcome)
9  Using Arduino / Programming Questions / Re: Turning ADC on and off. on: June 17, 2014, 01:38:08 pm
Your code stops at the loop() so ... is it the code?

No wiring diagram etc ... how do you know that 0 is the wrong value? (what is the refernec voltage and the setup thereto?) Try using the Example sketch AnalogInSerialOut to verify your circuit.
10  Using Arduino / Programming Questions / Re: Interrupt code not working as supposed to..... on: June 17, 2014, 01:33:20 pm
My sarcastic - and thus less than helpful - comment to the original subject heading is "They rarely do " and then add i a low voice  "and the 'supposition' is all wrong, too".   smiley-evil

The only valid reason I have seen in this forum for using interrupts is catching encoder pulses or generating PWM/Stepper pulses when above 50Khz. Button pushes do NOT qualify  smiley-yell

@Columbus1231: Why are some lines in your code example bold and some not? ANd why is the code not in a nice box...
Code:
...like this?
11  Using Arduino / Programming Questions / Re: Arduino IDE 1.5 kust stopped compiling on any home made code on: June 17, 2014, 08:28:43 am
...would compile and upload great. All of a sudden, the IDE just stopped compiling...
I have had my years in working in "support". The conversation usually runs like:
- It stopped working!
- What did you do?
-Nothing!
-Why are you sitting in fornt of your computer if it isnt doing "something"?
- ?! Oh well, yes, I just did <and here came the thruth>

Over to you: When was the last time you Know it Worked. When was the First time it Stopped? What did you do in between....
12  Using Arduino / LEDs and Multiplexing / Re: Controlling 6 meanwell drivers on: June 17, 2014, 07:50:11 am
If you include a link to the "ELN-60-48D" specification sheet (the bit that talks about voltage, current, control input and the like) and related items, then it is easier for folks here to answer.

So, from the work I put in googling for your device smiley-sad I get that you can use you average Arduino UNO, a Logic-MOSFET (that is a MOSFET that needs less then 5V on gate to go fully on) plus resistors to levelshift the Arduino 5V to the ELN-60's 10V control line. The rest is programming. I suggest a RTC (RealTimeClock) with a button battry, so it keeps time, even if you powercycle. Not that you need second accuracy, but the convinience that it does not start at "12:00-flashing" (You do not need a display, I was using it figurativly)
13  Using Arduino / LEDs and Multiplexing / Re: LED strip "sleep" current draw on: June 17, 2014, 07:39:39 am
Measuring "Ohms" across a chip Vcc-GND is not going to give any usefull result. It does contain transistors that switch on/off ... smiley-wink

On first reading the 325mA seems a lot, but on 60 devices it is 5mA pr chip. That still seems a lot, but then I read the spec sheet and the words "low power" or equivalent do not appear anywhere. It does not specify the chips current, only that the LED will draw 20mA pre colour per LED.

Have you measured the actual current consumed?
14  Using Arduino / LEDs and Multiplexing / Re: Adalight project with WS2801 - One led light stays on on: June 17, 2014, 07:05:20 am
The pictures do not show the wiring ... only that you have good connectors. For the wiring seeing the diagram would be more helpful. Also including a direct link to the WS2801 you purchased saves some of us first to search for it in order to answer your question. Likewise include/link the sample code.

All this swapping you write makes me think you're not really following the instructions (or the instructions are too vauge). Unless you made one error early on, blew the circuits, and now it is stuck in white.
15  Using Arduino / LEDs and Multiplexing / Re: Blinking two different LED colours alternately on: June 17, 2014, 06:59:33 am
Code:
int redled1=11 ;
int redled2=13 ;
... and digitalWrite can only set ONE pin at a time

(fixed typo in code example - "oh yes, trying to be clever eh?" - the first ine now seays redled1)
Pages: [1] 2 3 ... 86