Dependencies:   mbed Motor mbed-rtos

Useless Robot

Useless Robot Overview

Project by Austin Bartmess and Jeremy Deremer

This is a robot developed on an ARM Microcontroller (LPC 1768). It uses a servo, two DC motors both powered by an external power source, nine red LEDs, two RBG LEDs, a speaker, a toggle switch and a transistor.

The goal of this robot is to stay off. However, the user can turn it on without harm. It attempts to stay off via turning a toggle switch off with an arm attached to a servo. If the robot is turned on too much, it will progressively get angry. It starts by not smiling and changing eye colors. Following that, the robot will frown and yell at the user. Finally, the robot will drive around randomly while screaming and looking angry via its LEDs.

Required Parts

  • mbed Microcontroller x1
  • USB to mini USB cable x1
  • Servo x1
  • H-Bridge Breakout Board x1
  • DC Motors x2
  • DC Motor Wheels x4
  • Red LEDs x9
  • RGB LEDs x2
  • 0.5W Speaker x1
  • Toggle Switch x1
  • BJTransistor x1
  • Jumper Cables Kit x1
  • Breadboard x2

Pinout and Connections

MbedH-BridgeDC MotorsServoTransistorSpeakerLEDsBarrel JackToggle Switch
GNDGND(-)Emitter(-)GND(-)(-)
Vu
VinVm(+)(+)
VoutVcc, /STBY(+)
p5AIN1
p6AIN2
p10LED+
p11LED+
p12LED+
p15Control
p21PWMA
p22Collector
p23Blue
p24Green
p25Red
p26Control
AO1(+)
AO2(-)

/media/uploads/jderemer3/capture.png

Demo Clip

Source Code

Import program4180_FinaProject

Committer:
arb
Date:
Thu Apr 27 03:53:55 2017 +0000
Revision:
2:69a3683834c7
v2 Skeleton code/examples for all the threads

Who changed what in which revision?

UserRevisionLine numberNew contents of line
arb 2:69a3683834c7 1 #include "mbed.h"
arb 2:69a3683834c7 2 //Class to control an RGB LED using three PWM pins
arb 2:69a3683834c7 3 class RGBLed
arb 2:69a3683834c7 4 {
arb 2:69a3683834c7 5 public:
arb 2:69a3683834c7 6 RGBLed(PinName redpin, PinName greenpin, PinName bluepin);
arb 2:69a3683834c7 7 void write(float red,float green, float blue);
arb 2:69a3683834c7 8 private:
arb 2:69a3683834c7 9 PwmOut _redpin;
arb 2:69a3683834c7 10 PwmOut _greenpin;
arb 2:69a3683834c7 11 PwmOut _bluepin;
arb 2:69a3683834c7 12 };
arb 2:69a3683834c7 13
arb 2:69a3683834c7 14 RGBLed::RGBLed (PinName redpin, PinName greenpin, PinName bluepin)
arb 2:69a3683834c7 15 : _redpin(redpin), _greenpin(greenpin), _bluepin(bluepin)
arb 2:69a3683834c7 16 {
arb 2:69a3683834c7 17 //50Hz PWM clock default a bit too low, go to 2000Hz (less flicker)
arb 2:69a3683834c7 18 _redpin.period(0.0005);
arb 2:69a3683834c7 19 }
arb 2:69a3683834c7 20
arb 2:69a3683834c7 21 void RGBLed::write(float red,float green, float blue)
arb 2:69a3683834c7 22 {
arb 2:69a3683834c7 23 _redpin = red;
arb 2:69a3683834c7 24 _greenpin = green;
arb 2:69a3683834c7 25 _bluepin = blue;
arb 2:69a3683834c7 26 }