Show Posts
Pages: [1] 2 3 ... 86
1  Using Arduino / Programming Questions / Re: int to byte conversion on: July 28, 2014, 11:59:21 am
(Crossroad asking a question - must try and answer !)

Cant think of anything faster. With a little carefull programming not take much more then 20-50 instructions... or about 20 uS meaning it will take less than a thousandth of your 3 ms time window.

If for some reason yu are stuck by extreme time problem, you could rewire your output circuitry so the ints map better, ie the redunant bits are ignored (I presume we're talking a set of shift registers here)
2  International / Scandinavia / Re: Power supply - mega on: July 27, 2014, 03:04:29 pm
Ja, og skillnaden er at der en diode i BarrelConnectoren (om du nu har en strömforsyningen som har - i mitten). Men det har VIN inte så akta akta. (Den har det inte før at man kan ta ut like bra som sätta in ström på Vin).
3  Using Arduino / Project Guidance / Re: G Code on Arduino? on: July 24, 2014, 03:23:49 pm
I agree with both of you, and maybe not.

Gcode in the 3D printer (or CNC etc) masks the interal workings of the device (turns/mm stuff, postive end stop), yes.

However most slicers need to know much of the printer anyhow in order to generate a good Gcode. F.eks. "retract head slightly and the filament when moving to another section" Here the slicer generates several lines of Gcode to do something that should be internal. Also the slicer needs to know which dialect of Gcode the printer can cope with. (In fact I know of at least two equally used modes of comments - one where the line starting with # is a comment and one where enclosing text in round brackts is a comment. So much for Gcode standard....)

On the other hand when spooling a print of an SD card, you can adjust some running parameters (like the speed) on the fly, as these are below the Gcode layer. Well, may be that could be done with a lower-level software, too.

I notice that programs like Mach3 which control the steppers directly also take Gcode as the input from some other program.

But the biggest motivator is probably TRADITION.  "because that is how we always have done it".
4  Using Arduino / Project Guidance / Re: 3x3x3 LED Cube Malfunction on: July 24, 2014, 02:58:17 pm
( @spycatcher2k There is an #include - seem OK to me )

WireEverywhere - You wrote
I tried to upload the code below but there was something wrong with it
What - it displayed the Pong game instead? Or did the upload fail (no program uploaded at all)

In other words - what was not working / displaying as you expected? You must state What you hoped would happen (and why, ie. what did you do) and what actually happened.

You also write
There are four LEDs in the bottom row that are very bright compared to the other led's
Well, could be your wiring, could be a bad transistor, could be the program. Now you did include the code, but please also include the cube library you are using, so we who are trying to help do not first have to find it (and possibly find a differnet version)

Which brings me back to the first question - apperently some LEDs are lit up, but is it displaying some apttern or is that just a static display ... or an artifact from a previous uploaded unrelated program
5  International / Scandinavia / Re: Power supply - mega on: July 24, 2014, 12:12:16 pm
Sæt 7V (eller op til 12V) på strømstikket.
Brug en 5V forsyning (eller lidt mindre er også OK) og sæt det på 5V pinden.
Der er et kredslop som sørger for at den skifter hvor den tager strøm fra når du hiver USB pinden ind/ud.
6  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.
7  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.
8  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
9  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.
10  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.
11  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.
12  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
// 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 */ ;
13  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)
14  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.
15  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: this?
Pages: [1] 2 3 ... 86