Pages: [1]   Go Down
Author Topic: line follow code  (Read 979 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can someone please help me with my line following code, i am using x3 photodiodes and x3 IR with two servo motors. in desperate need for help please
Logged

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 114
Posts: 4953
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For a start post a diagram of how you have it all hooked up, then paste the code you have so far....

Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is what ive started with. i know its easier to use if statements for when the diodes detect the black tape against the white background but im not sure how to actually write it.

#include <Servo.h>

Servo servoLeft;         
Servo servoRight;
int pd0 = 1;
int pd1 = 0;
int pd2 = 2;


void setup() {
  servoLeft.attach(10); 
  servoRight.attach(9);
  pinMode(pd0, INPUT);
  pinMode(pd1, INPUT);
  pinMode(pd2, INPUT);
  Serial.begin(9600);
}


* jn.jpeg (37.31 KB, 640x480 - viewed 19 times.)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26630
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your code is incomplete - you need a "loop()" function as well as "setup()".
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i know that, im just confused about putting the if statements with the values and making it read the sensors properly
Logged

California
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3447
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i know that, im just confused about putting the if statements with the values and making it read the sensors properly

Well, what have you tried so far?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i know that, im just confused about putting the if statements with the values and making it read the sensors properly

It doesn't sound as if you have any idea where to start. Have you done any coding at all? There are plenty of example sketches that show you how to read switches and turn on lamps and motors that will give you an idea of what the code would look like.

If you're not going to make any serious attempt to do it yourself then you should be posting under Gigs and Collaborations.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: