Project in progress
Lego Robot

Lego Robot

Childhood dreams.

  • 1,246 views
  • 0 comments
  • 5 respects

Components and supplies

Apps and online services

About this project

Apk.

Inspired by the film:

And:

Code

RoboArduino
int data;

#define E1 6  // Enable Pin for motor 1
#define E2 9  // Enable Pin for motor 2

#define I1 4  // Control pin 1 for motor 1
#define I2 5  // Control pin 2 for motor 1
#define I3 8  // Control pin 1 for motor 2
#define I4 7  // Control pin 2 for motor 2


void setup() 
{
 Serial.begin(9600); 
//silnik 1
pinMode(12,OUTPUT);
//silnik 2
pinMode(13,OUTPUT);
//reszta
pinMode(2,OUTPUT);
//głowa powieki
    pinMode(E1, OUTPUT); // speed engine 1
    pinMode(E2, OUTPUT); // speed engine 2
    pinMode(I1, OUTPUT);
    pinMode(I2, OUTPUT);
    pinMode(I3, OUTPUT);
    pinMode(I4, OUTPUT);
}

void loop() 
{
 data=Serial.read();
 Serial.println(data);
 delay(200);
 
 if(data==5)
 {
    digitalWrite(12,LOW);
    digitalWrite(13,HIGH);
    analogWrite(3,255);
    analogWrite(11,255);
 }

if(data==6)
{
  
  digitalWrite(12,LOW);
  digitalWrite(13,HIGH);
  analogWrite(3,0);
  analogWrite(11,0);
  
}
if(data==7)
 {
    digitalWrite(12,HIGH);
    digitalWrite(13,LOW);
    analogWrite(3,255);
    analogWrite(11,255);
}
if(data==8)
{
  
  digitalWrite(12,LOW);
  digitalWrite(13,HIGH);
  analogWrite(3,0);
  analogWrite(11,0);
}
if(data==1)
 {
    digitalWrite(12,HIGH);
    digitalWrite(13,HIGH);
    analogWrite(3,255);
    analogWrite(11,255);
 }
 if(data==2)
{
  
  digitalWrite(12,LOW);
  digitalWrite(13,HIGH);
  analogWrite(3,0);
  analogWrite(11,0);
}
if(data==3)
 {
    digitalWrite(12,LOW);
    digitalWrite(13,LOW);
    analogWrite(3,255);
    analogWrite(11,255);
 }
 if(data==4)
{
  
  digitalWrite(12,LOW);
  digitalWrite(13,HIGH);
  analogWrite(3,0);
  analogWrite(11,0);
}

if(data==14)
{
  digitalWrite(2,HIGH);
}
if(data==15)
{
  digitalWrite(2,LOW);
}
if(data==18)
{
analogWrite(E2, 255);
digitalWrite(I3, HIGH);
digitalWrite(I4, LOW);
}
if(data==19)
{
analogWrite(E2, LOW);
}

if(data==20)
{
analogWrite(E2, 255);
digitalWrite(I3, LOW);
digitalWrite(I4, HIGH);
}
if(data==21)
{
analogWrite(E2, LOW);
}

if(data==16)
{
analogWrite(E1, 255);
digitalWrite(I1, HIGH);
digitalWrite(I2, LOW);
delay(100);
analogWrite(E1,LOW);
}
if(data==17)
{
analogWrite(E1, 255);
digitalWrite(I1, LOW);
digitalWrite(I2, HIGH);
delay(100);
analogWrite(E1,LOW);
}
}

Schematics

schemat.jpg
Schemat

Comments

Similar projects you might like

MeArm Robot Arm - Your Robot - V1.0

Project tutorial by Benjamin Gray

  • 29,567 views
  • 4 comments
  • 42 respects

Amazing 6WD Off-Road Robot | Arduino RC Robot

Project tutorial by Jithin Sanal

  • 9,990 views
  • 0 comments
  • 54 respects

Take Control Over Lego Power Functions

Project tutorial by Patrick Müller

  • 61,418 views
  • 5 comments
  • 76 respects

Voice-Controlled Pick-and-Place Robot

by Sagar pawar

  • 3,391 views
  • 0 comments
  • 11 respects

Bluetooth Controlled Pick And Place Robot

Project tutorial by Ahmed Ibrahim Ahmed

  • 16,839 views
  • 17 comments
  • 58 respects

Scriba Robot - A Printing Robot

Project in progress by RobinB

  • 2,551 views
  • 0 comments
  • 8 respects
Add projectSign up / Login