0% found this document useful (0 votes)
2 views2 pages

Arduino Motor Control with IR Sensors

Uploaded by

Kirigaya Kazuto
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Arduino Motor Control with IR Sensors

Uploaded by

Kirigaya Kazuto
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

#define IR_SENS_RIGHT 11

#define IR_SENS_LEFT 12

#define MOTOR_SPEED 150

int enableRightMotor=6;

int rightMotorPin1=7;

int rightMotorPin2=8;

int enableLeftMotor=5

int leftMotorPin1=9;

int leftMotorPin2=10;

void setup() {

// put your setup code here, to run once:

TCCR0B = TCCR0B & B11111000 | B00000010;

pinMode (enableRIghtMotor, OUTPUT);

pinMode (rightMotorPin1, OUTPUT);

pinMode (rightMotorPin2, OUTPUT);

pinMode (enableLeftMotor, OUTPUT);

pinMode (leftMotorPin1, OUTPUT);

pinMode (leftMotorPin2, OUTPUT);

pinMode (IR_SENSOR_RIGHT, INPUT);

pinMode (IR_SENSOR_LEFT, INPUT);


rotateMotor(0,0)

void loop() {

// put your main code here, to run repeatedly:

int rightIRSensorValue = digitalRead(IR_SENSOR_RIGHT);

int leftIRSensorValue = digitalREAD(IR_SENSOR_LEFT);

You might also like