Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- Servo servo1;
- Servo servo2;
- int BlackLine = 0;
- float BlackTotal;
- void setup() {
- servo1.attach(6);
- servo2.attach(7);
- Serial.begin(115200);
- }
- void loop() {
- analogReference(EXTERNAL);
- BlackLine = analogRead(1);
- if (BlackLine > 792)
- {
- servo1.writeMicroseconds(1400);
- servo2.writeMicroseconds(1500);
- delay(100);
- servo1.writeMicroseconds(1500);
- delay(100);
- BlackTotal = BlackTotal + 1;
- }
- else
- {
- servo1.writeMicroseconds(1500);
- servo2.writeMicroseconds(1600);
- delay(100);
- servo2.writeMicroseconds(1500);
- delay(100);
- }
- Serial.print(BlackLine);
- Serial.print(",");
- Serial.print(BlackTotal);
- Serial.println(" ");
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement