Loading...
  Show Posts
Pages: [1] 2 3 ... 107
1  Using Arduino / Programming Questions / Re: Why would people write comment code this way?! on: Today at 12:51:08 pm
You can, of course, comment a block of lines in the Arduino IDE by highlighting them and using Ctrl+Slash and undo it in the same way.  Undoing it is sometimes 'interesting' because instead of undoing the comments it adds another set for reasons that I have yet to fathom out.
2  Using Arduino / Programming Questions / Re: Difference between attachInterrupt() and ISR() on: Today at 12:11:56 pm
Where have you seen ISR() ?
Can you provide a link or an example ?
3  Using Arduino / Programming Questions / Re: Project is looping the setup on: Today at 02:30:35 am
What is the return; in setup() supposed to do ?
4  Using Arduino / Programming Questions / Re: Boring "Sketch is Read-Only" dialog. on: Today at 01:53:19 am
Load the example and do a Save As
That protects the original and gives you your own version to work with

You can remove the read only attribute of the examples folder if you like, but as has been pointed out you then risk changing the example programs.
5  Using Arduino / Storage / Re: SdFat, insert text before another text on: June 17, 2013, 12:22:17 pm
Write the new data to a new file.  Read the data from the old file and write it to the new file.
6  Using Arduino / Storage / Re: Copy file from teensy SD card on: June 17, 2013, 12:19:52 pm
Quote
How can copy file from teensy SD card to computer
Take it out of the teensy.  Insert it into a PC card reader.  Copy file.
7  Using Arduino / Programming Questions / Re: Using IF with smoothing code. on: June 17, 2013, 07:18:59 am
Turn the smoothing code into a function that can be called when required then do this
Code:
initialise variables
setup input pin and serial port

start of loop
  if serial input is available
    read one byte from serial
    if byte matches '1'
      call the averaging_function
    end of if
  end of if
end of loop

void averaging_function
  code to read analog input 10 times and add to total
  calculate average of readings
  print average
end of function
8  Using Arduino / Storage / Re: Copy file from teensy SD card on: June 17, 2013, 01:15:46 am
or ... ? what ?
9  Using Arduino / Project Guidance / Re: multiple serial values? on: June 17, 2013, 01:10:51 am
The serial data will be read by the Arduino one byte at a time.  So, if Processing sent a string like 190 followed by a carriage return the Arduino could read byte one, interpret it as referring to servo 1 then read bytes until the carriage return and interpret the number received as an angle to move to.  To move servo 2 to an angle of 150 degrees the string would be 2150 followed by carriage return.  This would work for up to 10 servos.  Note that this uses C style strings rather than Strings.

Have a look at http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=11425&page=1 to see how to read bytes and put them in an array for processing.  To convert the string into a number to use to set the servo angle look at the atoi() function.
10  Using Arduino / Programming Questions / Re: LED BLINK PROBLEM, THIS PROGRAMMING IS NOT RUNNING. on: June 16, 2013, 09:46:41 am
Do you get any messages when the code is compiled and uploaded ?
What does the LED do, if anything ?
What Arduino are you using ?
Have you got an external LED connected or are you watching the one built into a board like the UNO ?
11  Using Arduino / Programming Questions / Re: microstepper/stepper programming on: June 16, 2013, 05:00:26 am
I am reluctant to make changes to the code because you won't learn learn so much that way.  It is better if you do it yourself.

There is, however, a problem either way because the code will not compile.  I don't have PCD8544 the library, but even if I did, when I attempted to Auto Format your code it reports that there are too many right curly braces.  This needs to be fixed.

If you look at the pseudo code that I posted, then the OKtoRun variable should be checked before calling the Bstepper() function then, after the function is run it should be set to false until some action sets it to true, at which point the motor will run again.

You also need to take into account the fact that the motor may need to be accelerated up to speed as suggested in other posts.
12  Using Arduino / Programming Questions / Re: microstepper/stepper programming on: June 16, 2013, 02:41:01 am
Quote
Maybe you can give me a way to stop these loops? Maybe a way as example to my code part?
If you will not post all of your code then it is difficult to give specific advice but maybe something like this
Code:
set OKtoRun variable true
start of loop()
if OKtoRun is true
  outer for loop
    inner for loop
      do motor stuff here
    end of inner loop
  end of outer loop
  set OKtoRun variable false
end of if

other code goes here

end of loop()
13  Using Arduino / Programming Questions / Re: How can I listen two port while they have not been initiate at the same place on: June 15, 2013, 01:21:38 pm
Post your whole program otherwise it will be impossible to help.
14  Using Arduino / Programming Questions / Re: microstepper/stepper programming on: June 15, 2013, 01:19:52 pm
You have not posted all of your code so the context is not clear, but considering that 25,000 * 2,850 is over 71 million iterations, each with a delay of 10 milliseconds it will take a while for the nested loops to complete.

Can I suggest that you post your whole program so that we can see where you are executing the nested for loops.  I strongly suspect that you have them in the loop() function which, as its name suggests, loops forever and repeats the code within it unless you take steps to prevent it.

Are you sure that the stepper/driver combination does 25000 steps per revolution ?
15  Using Arduino / Programming Questions / Re: Weird behavior of external interrupts on: June 15, 2013, 01:08:29 pm
A couple of questions to help me understand what you are doing

1. What do you mean by "I'm using two internal pull-up resistor buttons" ?
2. What do the empty for loops in the functions do ?


Pages: [1] 2 3 ... 107