Loading...
Pages: [1]   Go Down
Author Topic: line follow code  (Read 419 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
Offline Offline
Edison Member
*
Karma: 34
Posts: 1705
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

IT Crowd:
Roy... "Have you tried turning it off and on again?"
Moss.. "Have you tried forcing an unexpected reboot?"

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);
}
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 137
Posts: 19007
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.

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
Edison Member
*
Karma: 37
Posts: 1828
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
Tesla Member
***
Karma: 89
Posts: 6313
-
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

Pages: [1]   Go Up
Print
 
Jump to: