Search:

Type: Posts; User: 777funk

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    10
    Views
    3,576

    I'd think it does just what you said (runs the...

    I'd think it does just what you said (runs the outer loop twice then goes to 90° and STOPS). Instead it loops this sequence indefinitely.

    Maybe as Matticus says it is indeed an Arduino thing and...
  2. Replies
    10
    Views
    3,576

    It drives a stepper motor run by an arduino MCU...

    It drives a stepper motor run by an arduino MCU chip.

    I'd like it to cycle from 0 to 180 a couple times then land at 90. But it does it indefinitely.
  3. Replies
    10
    Views
    3,576

    Well the two sweeps (incr and decr q number of...

    Well the two sweeps (incr and decr q number of times) is what's needed. But after that (q number of times) I'd like it to stop and not continue forever. But I need the bracket at the end and at the...
  4. Replies
    10
    Views
    3,576

    How do I run this code only once?

    I'd like to run this code only once instead of a loop. Is there a simple way to do this?


    void loop() // Main Program
    {

    //// Two Sweeps
    for (q = 0; q <=1; q += 1)
    {
    for(pos = 180; pos...
  5. Not sure the right wording but can I DEFINE an entire block of code with one Name?

    I have a program with some pretty repetitive blocks of code (i.e Loop A, Loop B, Loop C, then Loop A again... etc) , is it possible to define an entire loop as a single line/function?

    Say I have...
  6. Replies
    6
    Views
    1,434

    That's quite a welcome! Thank you. Wow. As...

    That's quite a welcome! Thank you. Wow.

    As far as reading, I've done some (Ritchie's book and a few others). I will have to do more. I am learning C and am in a rush on a quick project. I figured...
  7. Replies
    6
    Views
    1,434

    Is there no way to define an entire block of code...

    Is there no way to define an entire block of code as a command?

    Sorry if this is a dumb question. I'm new to C.

    Once again I'd like to condense a group of code into a single function. I'm a...
  8. Replies
    6
    Views
    1,434

    It is a check for the relay on or off and an exit...

    It is a check for the relay on or off and an exit if it is OFF.

    But I'd like to abbreviate it a bit or represent it as a variable if it's possible.

    i.e.

    getout = that entire block of code
  9. Replies
    6
    Views
    1,434

    Would this be considered defining a funcion?

    I'd like to run a block of code interspersed throughout a program and rather than making a mess in the program I'd like to define it as a variable. I'm not sure if that's the right terminology but...
  10. Well I actually don't necessarily want it to...

    Well I actually don't necessarily want it to execute all the way through any of the sub loops (and their are lots of them within the main while loop which is triggered by the HIGH pin) in my program...
  11. Ok, now I have it in the while loop: ...

    Ok, now I have it in the while loop:




    while (relaystate == HIGH)
    {
    // if Relay for the motor is high (5V) then run the pickup program)
  12. Anyone have an example of how I would do this...

    Anyone have an example of how I would do this with a while?

    My digital input trigger to start the while loop is working but it's going into the loop and never exiting. I guess that means (based...
  13. That's not all of my code. It's pretty long so...

    That's not all of my code. It's pretty long so the braces may not all add up properly. I cut out most of the code just to give the idea.

    I'm sure the indentation is horrible. It's a result of a...
  14. Here's what I've got as the main bones of my...

    Here's what I've got as the main bones of my code. I tried the Goto and bailout and it isn't working for some reason. It is not entering the while loop until the condition is met but once it's in, it...
  15. One thing I didn't think of.... while loop ...

    One thing I didn't think of....

    while loop

    Would that do what I'm thinking?
  16. is there an if/else function that implements IMMEDIATELY?

    I'm in the middle of righting a program for a servo motor. I'd like to use an if and else to have the motor exit the main program with a pin going low and I'd like it to do it immediately.

    Right...
  17. Replies
    3
    Views
    24,153

    Great thanks guys! And it worked in real life...

    Great thanks guys! And it worked in real life with the hardware I'm working on (Arduino Microcontroller and a servo).
  18. Replies
    3
    Views
    24,153

    int and float - will this work?

    I've got this code and I'm trying to multiply something times 1.3 (float value)

    Anyways, P is defined:

    int p=0;

    Here's the code:
  19. Well shoot! Looks like my servo burned itself out...

    Well shoot! Looks like my servo burned itself out so I'll have to continue the research later this week (got more ordered).
  20. I finally got it to do what I've been trying to...

    I finally got it to do what I've been trying to get it to do. But it seems to not be sweeping the entire degree range (around 40 degrees from 67 to 107).



    void loop()
    {
    for (a...
  21. Ok I changed it to x -= 1 and it's actually more...

    Ok I changed it to x -= 1 and it's actually more within the range but it's not doing what I had hoped (going the full range and decrementing a degree per side i.e. 67 to 107, 68 to 106, 69 to 105...
  22. I just tried the following and it did some weird...

    I just tried the following and it did some weird things. Definitely not what I was thinking it'd do (work from the outside bounds (67 and 107 in my case) and gradually get smaller as the numbers head...
  23. I think that makes sense to me. I'll try it. What...

    I think that makes sense to me. I'll try it. What if I want to offset it by say + or - 10 with a maximum still capping at 180?
  24. Don't bet your life on it! I'm a beginner when it...

    Don't bet your life on it! I'm a beginner when it comes to programming:)

    but is it a set of brackets missing for the first "for" loop to encapsulate the second?
  25. Thanks for the input and cool username:) lol ...

    Thanks for the input and cool username:) lol

    As far as the motor it is a DC Servo. I have it working with the above code that I'd posted (taken from a library for this microcontroller) but would...
Results 1 to 25 of 28
Page 1 of 2 1 2