Skip to content

Commit

Permalink
Implementando novas funções
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaCosta committed May 3, 2023
1 parent c54e1f6 commit 1df5759
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions robo_limpeza/robo_limpeza.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void setup() {
pinMode(RED_LED, OUTPUT);

// sensor digital input
// pinMode(INTERRUPT_PIN, INPUT);
pinMode(INTERRUPT_PIN, INPUT);

// interruption
// pinMode(INTERRUPT_PIN, INPUT_PULLUP);
Expand All @@ -47,6 +47,16 @@ void loop() {
// Robot ON
digitalWrite(RED_LED, HIGH);

move(1000);
turn_left();
move(1000);
turn_left();
move(1000);
turn_left();
move(1000);
turn_left();

delay(10);
}

int left_is_clear(void){
Expand All @@ -73,10 +83,10 @@ void turn_left(void){
l_motor(STOP);
}

void move(void) {
void move(int distance) {
r_motor(FORWARD);
l_motor(FORWARD);
delay(25);
delay(5 * distance);
r_motor(STOP);
l_motor(STOP);
}
Expand Down Expand Up @@ -134,5 +144,5 @@ void l_motor_velocity(int velocity){
}

void interrupt_function() {
;
digitalWrite(BLUE_LED, HIGH);
}

0 comments on commit 1df5759

Please sign in to comment.