Last visit was: It is currently Fri Jun 21, 2013 12:31 am


All times are UTC + 10 hours [ DST ]




Post new topic Reply to topic  [ 11 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: zener diodes
PostPosted: Sun Oct 02, 2011 1:05 pm 
Site Admin
User avatar

Joined: Sat Jul 24, 2010 11:34 pm
Posts: 711
Location: Adelaide
Yes it only uses 1 pin to drive the motor, although it will require 1 pin for the pot to set the ADC reading and 1 pin for the fish trigger.

It is just a simple "For/Next" loop, (lookup for/next commands)

What happens is the "for Y = 0 to adc_count" sets the number of times it repeats the commands between the "For" and the "Next" lines of code.

If we said "for b1 = 0 to 9" (i had called the variable Y) then it would repeat the loop 10 times, as each time the program gets to the line that would say "Next b1" it would go back to the "For b1" line, each time it loops through the code it increases the value in the variable b1 until b1 = 9 then it exits the loop.

In the case of the example above the 9 is replaced with the value read from the pot for the adc reading.


You could use PWM but i think this is simpler and it allows you to change the pause length from 10mS to whatever to suit the period of operation and then adjusting the pot just sets how many bursts of pulses you send to the motor, or you might think of it as how many steps the motor will make, sorter like teeth on a cog and how many teeth to rotate to deliver x amount of food.

Its the same as flicking the switch to the motor on/off 10 times for example.

Pete.


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page Previous  1, 2

All times are UTC + 10 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net & kodeki