Author Topic: new to programming PICs, need a little help  (Read 489 times)

0 Members and 1 Guest are viewing this topic.

Offline machinegunmaxTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
new to programming PICs, need a little help
« on: March 06, 2010, 01:42:49 AM »
Basically i have a line following robot.  The inputs are 2 signals coming between an LDR and a resistor acting as a voltage divider as outlined in http://www.societyofrobots.com/schematics_photoresistor.shtml
The output is a servo.  Here is some very rough pseudocode:

A = input1 - input2

servo pulse length = 1.5ms + k*A

here k is a constant.  1.5ms is the pulse length which lines up the servo so that the robot goes straight.  So if one side gets more light the signal will be larger, A will be +ve and therefore the servo will move one direction, if the other LDR gets more light, A will be -ve and the servo will move the opposite direction.  My question is: firstly would this sort of idea work ... and if it would, how would i find the value of K (or could you suggest any good starting values)

Offline little-c

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 1
Re: new to programming PICs, need a little help
« Reply #1 on: March 07, 2010, 03:03:17 PM »
idea works. its simple enough.



as for k, start with a value of 100, and multiply/divide by ten to find when it starts changing from too violent to too slow a reaction, then start splitting it in half.


so if 100 was too slow, and 1000 too fast, go for 500, and if thats too slow, go for 750, blah.

if the value is 750 and it behaves like that, I want a cookie! ;D

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
4270 Views
Last post March 05, 2011, 09:01:34 AM
by TrickyNekro
23 Replies
3527 Views
Last post December 28, 2007, 06:54:28 PM
by ed1380
1 Replies
1141 Views
Last post March 18, 2008, 05:51:21 PM
by paulstreats
3 Replies
1444 Views
Last post October 19, 2008, 10:29:39 AM
by Ro-Bot-X


Get Your Ad Here

data_list