Go to Post The best way to deal with an opponent who is going to hang is to go and hang yourself. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 03-05-2008, 06:06
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Question Automatic counter-Encoder

Hi everyone, I dont know much about programming so please help me out. Thanks!

Im looking for a way to make a counter that counts from 1-30 or 0-29. A total of 30 units. I have a clicker hooked up to a wheel and everytime the wheel moves 12 degrees i get a steady 1 or a steady 0 at the digital input. A total of 15x 0's and 15x1's willl be observed. I need a code that adds 1 everytime the input changes.

Starting with 0 , 1 , 0, 1, 0 , 1 , 0, 1, 0 , 1 ...etc
The counter: 1 +1 + 1+1+1+1 +1 +1 +1 +1 each time...and then everytime a 1 has been added, it keeps that value, untill the next 1 gets added.

Example: I can retrieve a number from the counter and if the number is 23, i make the PWM = 127, when the number is 24, i make the pwm = 135....etc

When the number reaches 29 or 30 depending if you started with 0 or 1, the next digit 30 or 31 does not exist and automatically resets to 0 and starts all over again....

Please point me in the right direction. My knowledge of C is limited to what I've been able to understand from examples and IFI mini RC programming guides.

Yes, I am using the Mini RC, EDU controller.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Something... synth3tk IT / Communications 8 08-03-2008 20:20
Automatic Transmission gnirts Programming 6 18-01-2007 20:44
Automatic Power Swampcoder2 Control System 6 03-02-2005 17:08
Automatic Power Swampcoder2 Electrical 6 03-02-2005 17:08
automatic archiving Joe Ross CD Forum Support 5 04-08-2003 13:27


All times are GMT -5. The time now is 20:26.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi