Wednesday, January 14, 2009
















I learned two new programing languages during this project, interactive c and the language for Arduino. I also learned how to do some wiring for the cell and that to procrastinate just makes you stress more and that is not such a good thing. I renforced the the things that I learned in bio to be able to show mechanicaly how the cell works. I also learned that I should not rely on other people or parents to do or get stuff for me. I need to be efficent and not slack off. fromm the start I knew what I wanted to do and had an image of what it had to be.
My goal was to create a robot that shows the function of a plant cell. The lights were to Ribosomes, a strip light was to be a Golgi complex, the motor was to be the Mitochondria, the batteries were to be the ATP, and the Arduino was to be the Nucleus.
I actually achieved my goal, I had to change the plant cell into a Plant-Like Protist because I put wheels onto the bottom that would make it more and plant cells don't normally move. So the wheels are Flagella.
I think that if I were to do this again I would not procrastinate because I didn't do any of the project over my Christmas vacation. I would also do a little bit more of the reading to beable to wire the cell because my dad did most of just the wiring.
Next for my project I want to make a touch sensor so it can run in to walls then turn around. I also would like to be able to use three push buttons on one code.

Monday, January 12, 2009

I have finished my cell bot today. I have made a code to make three groups of lights light up in sequence. Here is the code.
int pins[] = {13,12,11,};
int num_pins = 3;

void setup()
{
int i;
for (i = 0; i < num_pins; i++)
pinMode(pins[i], OUTPUT);
}
void loop()
{
int i;
for (i = 0; i < num_pins; i++)
{
digitalWrite(pins[i], HIGH);
delay(250);
digitalWrite(pins[i], LOW);
}
for (i = num_pins - 1; i >= 0; i--)
{
digitalWrite(pins[i], HIGH);
delay(250);
digitalWrite(pins[i], LOW);
}
}
Next I made a code with a push button that controls a stirp of lights.
int ledPin = 9;
int inputPin = 2;
int val = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(inputPin, INPUT);
}
void loop()
{
val = digitalRead(inputPin);
if (val == HIGH)
{
digitalWrite(ledPin, HIGH);
delay(5000);
}
else
{
digitalWrite(ledPin, LOW);
}
}
lastly I made a code to control my motors. They go forward then when you press a button it goes backwards. It also blinks a light 3 time befor it moves.
int switchPin = 2;
int motor1Pin = 3;
int motor2Pin = 4;
int speedPin = 7;
int ledPin = 13;
void setup()
{
pinMode(switchPin, INPUT);
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(speedPin, OUTPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(speedPin, HIGH);
blink(ledPin, 3, 500);
}
void loop()
{
if (digitalRead(switchPin) == HIGH)
{
digitalWrite(motor1Pin, HIGH);
digitalWrite(motor2Pin, LOW);
delay(5000);
}
else
{
digitalWrite(motor1Pin, LOW);
digitalWrite(motor2Pin, HIGH);
}
}
void blink(int whatPin, int howManyTimes, int milliSecs)
{
int i = 0;
for ( i = 0; i < howManyTimes; i++)
{
digitalWrite(whatPin, HIGH);
delay(milliSecs/2);
digitalWrite(whatPin, LOW);
delay(milliSecs/2);
}
}

Sunday, January 11, 2009

pics of cell bot







Yesterday I wrote a code to contol four pins on the arduino to have four lights blink.
int pins[] = {13,12,11,10};
int num_pins = 4;

void setup()
{
int i;
for (i = 0; i < i =" 0;" i =" num_pins">= 0; i--)
{
digitalWrite(pins[i], HIGH);
delay(50);
digitalWrite(pins[i], LOW);
}
}
Then today my father and I started to wire and build the cell bot.
I still have questions,
1)How do I get more than one push button?
2)How do I get more than one loop?

Saturday, January 10, 2009

The first two posts are the first two entries in the scratch program I made, but they do not have a link to them. The next post is the three codes that I used for the lego brick when I was learning interactive c. The links under cell bot scratch entries are to the doumentation to cell bot. I did the doumentation on scratch because I thought it would be easier than a blog, but I was wrong.
void main()
{
fd(1);
fd(2);
sleep(2.0);
bk(1);
bk(2);
sleep(2.0);
fd(1);
fd(2);
sleep(2.0);
off(1);
off(2);
}
void main()
{
fd(1);
fd(2);
sleep(2.0);
bk(1);
bk(2);
sleep(1.0);
fd(1);
fd(2);
sleep(2.0);
off(1);
off(2);
sleep(2.0);
fd(1);
bk(2);
sleep(4.0);
off(1);
off(2);
}
void main()
{
fd(1);
bk(2);
sleep(3.0);
off(1);
bk(1);
bk(2);
sleep(3.0);
fd(1);
fd(2);
sleep(3.0);
fd(2);
bk(1);
sleep(4.0);
off(1);
off(2);
}