UATEA Project 2

by polbm02 in Circuits > Arduino

194 Views, 0 Favorites, 0 Comments

UATEA Project 2

WhatsApp Image 2022-12-01 at 19.25.02.jpeg

We are going to configure a control system to drive the movement of a robotic arm with precision. The precision will be measured through a game in which the user will have to put the head of the robotic arm on a red target.

Supplies

Push buttons x2

Resistors of 240 x2

jumper cables x12

Proto board

Arduino board

//Alex Olivella, Pol Baque, Alejandro Guerra

//Grupo 101 2022

#include <avr/wdt.h>

float j0_angle;

float j1_angle;

float j2_angle;

float j3_angle;

float j4_angle;

int ences = HIGH;

int off = LOW;

void setup() {

 Serial.begin(9600);

 pinMode(5, INPUT);

 pinMode(6, INPUT);

}



void loop() {

 int boto = digitalRead(5);

 int boto2 = digitalRead(6);

 Serial.println("Pulsa el primer boton si quieres que algun eje gire a la derecha o el segundo si quieres que algun eje gire a la izquierda.");

 delay(3000);

 if (boto == ences) {

  Serial.println("ELIJE MOTOR:");

  Serial.println("1");

  delay(1000);

  boto=digitalRead(5);

  if (boto == off) {

   j0_angle += 15;

   reset();

  }

  Serial.println("2");

  delay(1000);

  boto=digitalRead(5);

  if (boto == off) {

   j1_angle += 15;

   reset();

  }

  Serial.println("3");

  delay(1000);

  boto=digitalRead(5);

  if (boto == off) {

   j2_angle += 15;

   reset();

  }

  Serial.println("4");

  delay(1000);

  boto=digitalRead(5);

  if (boto == off) {

   j3_angle += 15;

   reset();

  }

  Serial.println("5");

  delay(1000);

  boto=digitalRead(5);

  if (boto == off) {

   j4_angle += 15;

   reset();

  }

  delay(1000);

  Serial.println("Vuelve a empezar.");

 }

 if (boto2 == ences) {

  Serial.println("ELIJE MOTOR:");

  Serial.println("1");

  delay(1000);

  boto2=digitalRead(6);

  if (boto2 == off) {

   j0_angle -= 15;

   reset();

  }

  Serial.println("2");

  delay(1000);

  boto2=digitalRead(6);

  if (boto2 == off) {

   j1_angle -= 15;

   reset();

  }

  Serial.println("3");

  delay(1000);

  boto2=digitalRead(6);

  if (boto2 == off) {

   j2_angle -= 15;

   reset();

  }

  Serial.println("4");

  delay(1000);

  boto2=digitalRead(6);

  if (boto2 == off) {

   j3_angle -= 15;

   reset();

  }

  Serial.println("5");

  delay(1000);

  boto2=digitalRead(6);

  if (boto2 == off) {

   j4_angle -= 15;

   reset();

  }

  delay(1000);

  Serial.println("Vuelve a empezar.");

 }


}

void reset() {

 wdt_enable(WDTO_15MS);

 while (1) {};

}

Schematics

Captura de pantalla_20221130_223448.png
WhatsApp Image 2022-12-01 at 19.25.02.jpeg
WhatsApp Image 2022-12-01 at 19.25.01.jpeg
WhatsApp Image 2022-12-01 at 19.25.01 (1).jpeg

Captura de pantalla_20221201_192347.png

CONCLUSIONS

It has cost us because we have had problems with the board because it has stopped working and has delayed us to get the final result until we have not tried it with another one.

In conclusion we have managed to move the robotic arm with a very simple system and two buttons.