Header Ads Widget

Celebrate good grades with this Arduino-powered robot

If you're a student and you just received some good grades, congratulations! You should be proud of your hard work and dedication. And what better way to celebrate than with a robot that you build yourself? In this article, we'll show you how to create an Arduino-powered robot that can dance and light up in celebration of your achievements.


What you'll need:

An Arduino Uno board

A breadboard

A robot chassis kit

Two DC motors

A motor driver shield

An ultrasonic sensor

An LED matrix display

Jumper wires

A USB cable

Step 1: Assemble the robot chassis kit

First, you'll need to assemble the robot chassis kit. This will be the physical body of your robot. Follow the instructions that came with the kit to put it together.

Step 2: Connect the motors to the motor driver shield

Once you have the chassis assembled, you can connect the two DC motors to the motor driver shield. Use jumper wires to connect the motor terminals to the corresponding pins on the shield.

Step 3: Connect the ultrasonic sensor

Next, connect the ultrasonic sensor to the Arduino board using jumper wires. The sensor should be connected to the 5V pin, the ground pin, and two digital pins (one for the trigger and one for the echo).

Step 4: Connect the LED matrix display

Connect the LED matrix display to the Arduino board using jumper wires. The display should be connected to the 5V pin, the ground pin, and two digital pins (one for the data and one for the clock).

Step 5: Program the Arduino

Now it's time to program the Arduino board. You'll need to write some code that will allow the robot to detect when you're nearby, display a celebratory message on the LED matrix display, and start dancing.

Here's an example code:

scss

Copy code

#include <Adafruit_GFX.h>

#include <Adafruit_LEDBackpack.h>

Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

int trigPin = 9;

int echoPin = 10;

void setup() {

  matrix.begin(0x70);

  pinMode(trigPin, OUTPUT);

  pinMode(echoPin, INPUT);

}

void loop() {

  long duration, distance;

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);

  distance = (duration/2) / 29.1;

  if (distance < 10) {

    matrix.clear();

    matrix.setCursor(0,0);

    matrix.print("Great job!");

    matrix.writeDisplay();

    delay(1000);

    for (int i = 0; i < 4; i++) {

      digitalWrite(5, HIGH);

      digitalWrite(6, LOW);

      digitalWrite(10, HIGH);

      digitalWrite(9, LOW);

      delay(500);

      digitalWrite(5, LOW);

      digitalWrite(6, HIGH);

      digitalWrite(10, LOW);

      digitalWrite(9, HIGH);

      delay(500);

    }

  }

}

This code uses the ultrasonic sensor to detect when you're within 10 centimeters of the robot. When you are, it displays a message on the LED matrix display and starts the robot dancing.

Step 6: Upload the code to the Arduino board

Connect the USB cable to the Arduino board and your computer. Open the Arduino IDE and upload the code to the board.

Step 7: Celebrate!

Now that your robot is programmed and ready to go, it's time to celebrate

Post a Comment

0 Comments