Archive | February, 2012

Building the robot 2/23/12

23 Feb

20120223-151638.jpg

20120223-151645.jpg

20120223-151654.jpg

20120223-151738.jpg

Advertisements

Juliana soldering

16 Feb

20120216-153222.jpg

20120216-153318.jpg

20120216-153326.jpg

20120216-153338.jpg

Binary numeral system

16 Feb

The binary numeral system is a system using two numbers which are 1 and 0. The places have different values, the first value is 1, the second is 2, the third value is 4, the fourth value is 8 and so on. You determine the next value by multiplying by the current value by 2.
For example 18 in binary would be 10010, and 17 would be 10001.

How to make robot move right,left, forward and backwards.

16 Feb

int motor1a=13; //control pins for Motor1
int motor1b=12;
int motor2a=11; //control pins for Motor2
int motor2b=10;

int enableMotor1=9; //PWM Motor 1 Speed pin
int enableMotor2=8; //PWM Motor 2 Speed pin

void forward(int speed) //function to move forward at a defined speed (0-255)
{
digitalWrite(motor1a, HIGH); //set motor 1 direction
digitalWrite(motor1b, LOW);
digitalWrite(motor2a, HIGH); //set motor 2 direction
digitalWrite(motor2b, LOW);
analogWrite(enableMotor1, speed); //set motor 1 speed (0-255)
analogWrite(enableMotor2, speed); //set motor 2 speed (0-255)
}

void reverse(int speed)
{

digitalWrite(motor1a, LOW); //set motor 1 direction
digitalWrite(motor1b, HIGH);
digitalWrite(motor2a, LOW); //set motor 2 direction
digitalWrite(motor2b, HIGH);
analogWrite(enableMotor1, speed); //set motor 1 speed (0-255)
analogWrite(enableMotor2, speed); //set motor 2 speed (0-255)

}
void left(int speed)
{
digitalWrite(motor1a, HIGH); //set motor 1 direction
digitalWrite(motor1b, LOW);
digitalWrite(motor2a, LOW); //set motor 2 direction
digitalWrite(motor2b, HIGH;
analogWrite(enableMotor1, speed); //set motor 1 speed (0-245)
analogWrite(enableMotor2, speed); //set motor 2 speed (0-133)

}
void right(int speed)
{
digitalWrite(motor1a, LOW); //set motor 1 direction
digitalWrite(motor1b, HIGH);
digitalWrite(motor2a, HIGH); //set motor 2 direction
digitalWrite(motor2b, LOW);
analogWrite(enableMotor1, speed); //set motor 1 speed (0-133)
analogWrite(enableMotor2, speed); //set motor 2 speed (0-245)

}

void stop()
{
digitalWrite(motor1a, HIGH); //set motor 1 direction
digitalWrite(motor1b, HIGH);
digitalWrite(motor2a, HIGH); //set motor 2 direction
digitalWrite(motor2b, HIGH);
}

void setup()
{
pinMode(motor1a, OUTPUT);
pinMode(motor1b, OUTPUT);
pinMode(motor2a, OUTPUT);
pinMode(motor2b, OUTPUT);
pinMode(enableMotor1, OUTPUT);
pinMode(enableMotor2, OUTPUT);
}

void loop()
{
forward(255); //go forward full speed
delay(2000); //for 2 secs
left(127); //turn left at 50% speed
delay(2000); //for 2 secs
reverse(255); //go reverse full speed
delay(1000); //for 1 sec
right(64); //turn right at 25% speed
delay(500); //for 0.5 secs
}

Assembly of the robot 2/16/12

16 Feb

20120216-143856.jpg

20120216-143900.jpg

20120216-143907.jpg

20120216-143916.jpg

20120216-143923.jpg

20120216-143929.jpg

How to write code for a rectangle

15 Feb
 
Syntax: rect(x, y, width, height)
Example: rect(30, 20, 55, 55);

How to write code for a triangle

15 Feb
Triangle(30, 75, 58, 20, 86, 75);
Traingle(x1,y1,x2,y2,x3,y3);