Software & Tools
Arduino IDE
Project description
Code
Code for Obstalce avoidance stepper
csharp
Can be reversed by deleting the ! in the if cycle.
1void setup() { 2 Serial.begin(9600); 3 pinMode(3, INPUT); //IR Sensor 4 pinMode(8, OUTPUT); // Stepper Direction 5 pinMode(9, OUTPUT); // Stepper Step 6 digitalWrite(8, LOW); 7 digitalWrite(9, LOW); 8} 9 10void loop() { 11int detect = digitalRead (3); 12if (detect != HIGH){ 13 digitalWrite(9, HIGH); 14 delayMicroseconds(500); 15 digitalWrite(9, LOW); 16 delayMicroseconds(500); 17} 18else{ 19 if(detect == LOW) 20 digitalWrite(9, LOW); 21 delayMicroseconds(500); 22 digitalWrite(9, HIGH); 23 delayMicroseconds(500); 24} 25}
Downloadable files
Breadboard
Breadboard view of the project.
Breadboard

Schematic
Schematic view of the project.
Schematic

Schematic
Schematic view of the project.
Schematic

Breadboard
Breadboard view of the project.
Breadboard

Comments
Only logged in users can leave comments