isangmu
Published

Star Wars R2-D2 Made Out of Paper

I tried to make a paper R2-D2 from Star Wars which has been my all-time favorite robot.

IntermediateFull instructions provided2,581
Star Wars R2-D2 Made Out of Paper

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
HC-06 Bluetooth Module
×1
DC Motor, 12 V
DC Motor, 12 V
×2

Story

Read more

Code

r2d2

Arduino
#include <SoftwareSerial.h>
SoftwareSerial BT(7,6);
#include <VarSpeedServo.h> 
VarSpeedServo myservo;

void setup()
{
  BT.begin(9600);
  pinMode(2, OUTPUT); 
  pinMode(3, OUTPUT); 
  pinMode(4, OUTPUT); 
  pinMode(5, OUTPUT); 
  myservo.attach(9);
}
char a;
void loop()
{
  if (BT.available()) {
    a = (BT.read());
    if (a == '0') {
    BT.println("Beast is stopping!");
    digitalWrite(2, LOW); 
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW); 
    digitalWrite(5, LOW); 
    }
    if (a == '1') {
    BT.println("Beast is forwarding!");
    digitalWrite(2, HIGH); 
    digitalWrite(3, LOW); 
    digitalWrite(4, HIGH); 
    digitalWrite(5, LOW); 
    }
    if (a == '2') {
    BT.println("Beast is backwarding!");
    digitalWrite(2, LOW); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, LOW); 
    digitalWrite(5, HIGH); 
    }
    if (a == '3') {
    BT.println("Beast is turning left!");
    digitalWrite(2, HIGH); 
    digitalWrite(3, LOW);  
    digitalWrite(4, LOW); 
    digitalWrite(5, HIGH); 
    }    
    if (a == '4') {
    BT.println("Beast is turning right!");
    digitalWrite(2, LOW); 
    digitalWrite(3, HIGH);  
    digitalWrite(4, HIGH); 
    digitalWrite(5, LOW); 
    }
        if (a == '4') {
    BT.println("Beast is turning right!");
    digitalWrite(2, LOW); 
    digitalWrite(3, HIGH);  
    digitalWrite(4, HIGH); 
    digitalWrite(5, LOW); 
    }    
        if (a == '5') {
  myservo.write(180, 30, true); 
  myservo.write(0, 30, true);  
    }
  }
}

Credits

isangmu

isangmu

0 projects • 22 followers

Comments