Arduino code. Suggestions wanted???

General discussion of topics that don't seem to fit anywhere else.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
wirelessguyny
Posts: 31
Joined: Tue Jul 07, 2015 3:54 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Arduino code. Suggestions wanted???

Postby wirelessguyny » Wed Jul 15, 2015 11:33 pm


Fridolin
Posts: 11
Joined: Sun Jul 12, 2015 6:00 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby Fridolin » Thu Jul 16, 2015 2:55 am

I suggest you use a library
It made things way easier for me.

wirelessguyny
Posts: 31
Joined: Tue Jul 07, 2015 3:54 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby wirelessguyny » Thu Jul 16, 2015 2:13 pm

Thanks for the link. I have downloaded the code and some of the examples but I'm really not skilled on the programming front. (I'm OK reading what others have done but my programming is as basic as can be).

I've gone ahead and posted to the google forum for that group to see if anyone has any suggestions for me in coming up with some simple code to drive the motor in one direction for a given interval and then just stop. So far everything I've seen seems to loop and the best I can do is have he motor spin in one direction and then return to its original location, so I don't hit in to an end.

Any recommendations are still welcome.

Thanks.

Fridolin
Posts: 11
Joined: Sun Jul 12, 2015 6:00 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby Fridolin » Thu Jul 16, 2015 2:34 pm

Just for clarity.
You want the motor to move into one direction, then stop, wait some time and then move again in the same direction and you want it to stop so it doesn't reach the end?

wirelessguyny
Posts: 31
Joined: Tue Jul 07, 2015 3:54 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby wirelessguyny » Thu Jul 16, 2015 3:24 pm

Actually, even simpler.

At first I just want to be able to control it in one direction. (e.g. take 5 paces up then Stop. I'll run that again and again manually- probably start at a higher number and get smaller as I get close to the end).

Once I'm at the far end I'd work to figure out how many paces until the other end. At that point I'd be able to load in code that gets it to sweep all the way from one side to another. (Hopefully that will give me enough info to know what I'd need to load in to Creation Workshop to give it the out limits of travel.

Does that make sense?

Fridolin
Posts: 11
Joined: Sun Jul 12, 2015 6:00 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby Fridolin » Sat Jul 18, 2015 9:17 am


wirelessguyny
Posts: 31
Joined: Tue Jul 07, 2015 3:54 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby wirelessguyny » Sat Jul 18, 2015 11:02 pm

This sort of works.

I needed to change your (digitalRead(buttonPin) == HIGH) to say LOW for some reason.

It will move the stepper forward for 5 paces and then stop 'temporarily' but it starts up again. The movement itself doesn't seem quite fluid either.

Fridolin
Posts: 11
Joined: Sun Jul 12, 2015 6:00 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby Fridolin » Sun Jul 19, 2015 2:34 am

Can you draw a little scematic of how you connected the button to your arduino board?

The movement isn't fluid because this library uses acceleration. Basicly your stepper starts with a slow speed and accelerates to its maximum speed.
You can change both maximum speed and acceleration to suit your needs.

wirelessguyny
Posts: 31
Joined: Tue Jul 07, 2015 3:54 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Arduino code. Suggestions wanted???

Postby wirelessguyny » Sun Jul 19, 2015 8:47 pm

I've gone and shifted everything from pins 4,5,6 to 5,6,7 to better match some of the code I will end up using in production.

I have a 12V @ 1.5A line going to =/- for the Stepper itself (with 100uF decoupling cap) Stepper is on A1,A2,B1,B2 as usual
M0, M1, M2 all go to 5V on the Arduino board (high/high/high - i.e. 1/32 step)
Enable - 7
Step - 6
Dir - 5

(The production code I refer to is what HTL here came up with to interface his Arduino Uno with Creation Workshop with a few User Defined variables. I've yet to try that code because I don't have any limit switches and wanted to gauge my total working distance before messing with more complex code. You can find HTL's code and background info here: ).

I don't know what a full revolution is for my stepper and I guesstimate that the total working distance I have from end to end is 44.75mm (so roughly 45mm )


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable