Show Posts
Pages: 1 [2] 3 4 ... 10
16  Forum 2005-2010 (read only) / Syntax & Programs / Typecasting or rounding off... on: December 06, 2009, 03:55:33 pm
hello all,

if i want to convert and round a float to a int, how would i do that?

int(floatVar)?

background:

i am calculating the sin(x) function to ramp up a stepper to full speed, but i use a for loop to do the actual clockpulses to the TA8439H stepper chip. so the result of the calculation should be a int.

17  Forum 2005-2010 (read only) / Syntax & Programs / Re: Softwareserial on: November 26, 2008, 07:34:04 am
sounds like a "posted on the wrong spot" problem. try reposting in the hardware interfacing section...

and try a less general subject line.
18  Forum 2005-2010 (read only) / Syntax & Programs / Re: interrupt workflow on: December 07, 2009, 08:57:18 am
well, in my case, i use a external interrupt to keep my timing tight for a stepper driver. works like charm now and indeed the program continues where it was. i only change the value of one var in the interrupt so the loop where the program was in before, finishes early.

never forget to disable interrupts as soon as you enter a interrupt routine.
19  Forum 2005-2010 (read only) / Syntax & Programs / interrupt workflow on: December 04, 2009, 05:13:33 pm
hello all,

i was trying to remember how interrupts work, but have forgotten and i am unable to state my question the way google can answer it for me, so maybe real people can help.

I am controlling a stepper and want to ease it in and out, so i made a array of speeds and steps to perform. but now i want to be able to make it shorter based on a external input. so a interrupt seems the way to go.

attaching an interrupt is no problem, but what happens when the attached procedure finishes. where does it continue? for example: the program is in a for loop and halfway the interrupt occurs, will it continue from where it was?
20  Forum 2005-2010 (read only) / Syntax & Programs / Re: modifying libraries on: June 11, 2008, 02:32:55 am
I found the solution. it was slapped in the face by carefully reading the keymap tutorial here:

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

it states that you have to alter the cpp file an recompile (delete the .o file and restart the arduino ide)

21  Forum 2005-2010 (read only) / Syntax & Programs / Re: modifying libraries on: June 10, 2008, 04:41:48 pm
That is clear, but is not about the keymap array. i would like to know if it is possible to populate the array in the sketch or only in the library .cpp file

if i make a 5 times 6 button matrix, the default keymap array is clearly not enough
22  Forum 2005-2010 (read only) / Syntax & Programs / Re: modifying libraries on: June 10, 2008, 09:45:41 am
so to answer my own question regarding arrays:

keymap[1][4] = A
keymap[4][1] = *


that is clear enough,

now for the adaption of the library. any thoughts there?
23  Forum 2005-2010 (read only) / Syntax & Programs / modifying libraries on: June 10, 2008, 06:27:21 am
I am planning to do something with the keypad library in a sketch, but i'm unshure if i have to asign the pins in the keypad.cpp file or in my sketch. as for the array with the keymapping:

// 4x4 keypad key mapping. You shouldn't need to touch this unless you have
// a keypad with different (or more) keys than those listed.
const char keymap[4][5] = {      "123A",
                        "456B",
                        "789C",
                        "*0#D"  };


if i want to make a bigger matrix, how would i do that? should i change the keymap array again in the .cpp file and let the ide recompile? should i define the matrix and array in my sketch or should i try to make a copy of the lib and modify that?

al those multidimensional arrays are a bit confusing. looking at the  example above, what would be the result of

keymap[1][4]

or

keymap[4][1]

sorry for the question-mix
24  Forum 2005-2010 (read only) / Syntax & Programs / Re: How to Reset milli() function? on: May 04, 2008, 04:01:41 pm
Quote
I believe the Arduino IDE sends a reset command to the Arduino when you open the Serial Monitor. So, the entire program is resetting, not just the millis().

That is not true. the arduino is not aware of the monitor. it just sends data your way if you told it to do so with the serial library.
25  Forum 2005-2010 (read only) / Syntax & Programs / Re: simple VMUSIC2 project query on: April 16, 2008, 04:17:03 am
As i read it, this is just for playing one file until the button is released. did you manage to intergrade the bend sensor?
26  Forum 2005-2010 (read only) / Syntax & Programs / Re: Reading and writing files on: October 09, 2007, 04:08:42 pm
i think i found the solution:

http://processing.org/learning/topics/savefile1.html

and

http://processing.org/learning/topics/loadfile1.html

globally cover what i was looking for
27  Forum 2005-2010 (read only) / Syntax & Programs / Re: Reading and writing files on: October 09, 2007, 04:02:16 pm
No, no. i want to open a file in processing and control the throughput via the arduino. no problems there. opening a file is a very basic thing. even so basic that it is very difficult to find info about. google did'nt came up with a nice solution anyway...

something like a open dialog would be nice
28  Forum 2005-2010 (read only) / Syntax & Programs / Reading and writing files on: October 09, 2007, 03:17:48 pm
Hello all.


for a side project, i want to be able to open a file, read ascii characters as numbers (A=41) one by one and substract or add a arbitrary number and write the outcome to another file.

The adding, substracting and leaving alone is already programmed by me, but how do i open and close a file, read a char, change its contents and write it to another file?

does one need a library for this?
29  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino and sleep settings on: December 29, 2006, 07:22:24 pm
HEY,

I am proud to announce the birth of yet another page in the playground on this topic. Look on  

http://www.arduino.cc/playground/Learning/ArduinoSleepCode

and learn to let your arduino sleep.

as a start this is helpfull, but reading the apropiate pages in the Atmega8 pdf and the sleep.c and interrupts.c helps

good luck!
30  Forum 2005-2010 (read only) / Syntax & Programs / Re: GICR |= (1<<INT0) on: January 01, 2007, 05:06:32 am
Nice reader!

the browser should'nt matter, because the formatting is all done by the wiki engine. The only thing to take care of is that if you include code, it will not be wrapped on your page.

anyway, it looks fine here in camino and safari
Pages: 1 [2] 3 4 ... 10