Sunday, February 28, 2010

Task 23 - Sanguino

http://http//sanguino.cc/

The Sanguino is like an Arduino but has a more powerful microprossesor allowing it to be used in more ways but it is still usable with the Arduino software.

Task 28 - program to turn a LED on whenever the light is blocked to your LED

int photocellPin = 0; // the cell and 10K pulldown are connected to a0
int photocellReading;
int ledPin = 7;
// the analog reading from the analog resistor divider

void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

void loop(void) {
photocellReading = analogRead(photocellPin);

Serial.print("Analog reading = ");
Serial.print(photocellReading); // the raw analog reading

// We'll have a few threshholds, qualitatively determined
if (photocellReading < 10) {
Serial.println(" - Dark");
digitalWrite(ledPin, HIGH); // LED on
} else if (photocellReading < 200) {
Serial.println(" - Dim");
digitalWrite(ledPin, HIGH); // LED on
} else if (photocellReading < 500) {
Serial.println(" - Light");
digitalWrite(ledPin, LOW); // LED off
} else if (photocellReading < 800) {
Serial.println(" - Bright");
digitalWrite(ledPin, LOW); // LED off
} else {
Serial.println(" - Very bright");
digitalWrite(ledPin, LOW); // LED off
}
delay(1000);
}

Task 27

I didn't make any changes as I felt that it was fine as it was. The only thing that I may change is when it is dark, light, dim etc to a different number, so it is picked up faster / slower.

Task 26 - Ladayada Photocell Program

When creating the ladayada photocell program i used one 1k resistor and an LDR. I connected the cable from 5V, 0 and ground to the breadboard from the input section of the Arduino. I then connected the resistor to ground and the 0 point and connected the LDR to the ground and 5V. This then enabled me to run it after using the below code:



int photocellPin = 0; // the cell and 10K pulldown are connected to a0
int photocellReading;
// the analog reading from the analog resistor divider

void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
}

void loop(void) {
photocellReading = analogRead(photocellPin);

Serial.print("Analog reading = ");
Serial.print(photocellReading); // the raw analog reading

// We'll have a few threshholds, qualitatively determined
if (photocellReading < 10) {
Serial.println(" - Dark");
} else if (photocellReading < 200) {
Serial.println(" - Dim");
} else if (photocellReading < 500) {
Serial.println(" - Light");
} else if (photocellReading < 800) {
Serial.println(" - Bright");
} else {
Serial.println(" - Very bright");
}
delay(1000);
}

Task 24

http://http://www.ladyada.net/learn/sensors/cds.html

This website was very interesting and had some great diagrams on how to use the Arduino.

Thursday, February 25, 2010

Task 22 - program: two leds of different colours and output the colour of the led to the screen each time it goes on.

//program: two leds of different colours and output the colour of the led to the screen each time it goes on.
// by Adam Randall

int ledPin = 12;
int greenLedPin = 13;

// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode (greenLedPin, OUTPUT);
Serial.begin(9600);
}


void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
digitalWrite(greenLedPin, LOW); // set the LED off
Serial.println("Yellow");// shows the word yellow on screen
delay(200);
digitalWrite(ledPin, LOW); // set the LED off
digitalWrite(greenLedPin, HIGH); // set the LED on
Serial.println("Green");// shows the word green on screen
delay(200);


}

Task 21 - program to output one led blinking at rate of 200ms that outputs the word "blink" to the screen each time it comes on.

//program to output one led blinking at rate of 200ms that outputs the word "blink" to the screen each time it comes on.
// by Adam Randall

int ledPin = 12;

// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}


void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(200);
Serial.println("blink"); // shows the work blink on screen
digitalWrite(ledPin, LOW); // set the LED off
delay(200);


}

Task 20 - blinking from 100ms to 1 sec back to 100ms.

//for-loop with counter variable i.
//program to get one led to increase its rate of blinking from 100ms to 1sec back to 100ms.
//Repeating forever.
// by Adam Randall

int redLedPin = 12; // LED connected to digital pin 12
int i = 100;
int x = 100;
// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(redLedPin, OUTPUT);
}


void loop()
{
for (i=100; i<1000; i=i+100)// for loop counter increasing i by 50
{
digitalWrite(redLedPin, HIGH);//sets the pin to on
delay(i);//delay
digitalWrite(redLedPin, LOW);//sets the pin to off
delay(i);//delay
}
x=1000; //resets x back to 1000
for (x=1000; x>100; x=x-100)
{
digitalWrite(redLedPin, HIGH);//sets the pin to on
delay(x);//delay
digitalWrite(redLedPin, LOW);//sets the pin to off
delay(x);//delay
}
i=100; //resets i back to 100
}

Task 19 - program to get one led to increase its rate of blinking from 100ms to1sec.

//for-loop with counter variable i.
//program to get one led to increase its rate of blinking from 100ms to 1sec.
//Repeating forever.
// by Adam Randall


int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12; // LED connected to digital pin 12
int i = 100;
// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(redLedPin, OUTPUT);
}


void loop()
{
for (i=100; i<1000; i=i+50){ // for loop counter increasing i by 50
digitalWrite(redLedPin, HIGH);//sets the pin to on
delay(i);//delay
digitalWrite(redLedPin, LOW);//sets the pin to off
delay(i);//delay
}
i=100; //resets i back to 100
}


}

Task 18 - Like 17 but i can be any value. Try different ones. Later we can input this value from the keyboard.

//for-loop with counter variable i.
//It will get one led to blink 20 (different value) times, using the for-loop, then the other to blink once.
//Repeating forever.
// by Adam Randall


int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12; // LED connected to digital pin 12
int del =50;
int i = 0;
// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
}


void loop()
{
for (i=1; i<20; i++){ // for loop counter
digitalWrite(ledPin, LOW); //sets the pin to off
delay(del); //delay
digitalWrite(redLedPin, HIGH);//sets the pin to on
delay(del);//delay
digitalWrite(redLedPin, LOW);//sets the pin to off
delay(del);//delay
}
digitalWrite(ledPin, HIGH);//sets the pin to on
delay(del);//delay

}

Task 17 - for-loop with counter variable i. Get one led to blink 5 times, using the for-loop, then the other to blink once. Repeat forever.

//for-loop with counter variable i.
//It will get one led to blink 5 times, using the for-loop, then the other to blink once.
//Repeating forever.
// by Adam Randall


int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12; // LED connected to digital pin 12
int del =100;
int i = 0;
// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
}


void loop()
{
for (i=1; i<6; i++){ // for loop counter
digitalWrite(ledPin, LOW); //sets the pin to off
delay(del); //delay
digitalWrite(redLedPin, HIGH);//sets the pin to on
delay(del);//delay
digitalWrite(redLedPin, LOW);//sets the pin to off
delay(del);//delay
}
digitalWrite(ledPin, HIGH);//sets the pin to on
delay(del);//delay

}

Sunday, February 21, 2010

Task 14 - One LED mostly off the other LED has a slight flash.

int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12; // LED connected to digital pin 12
int del =100;


// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
}


// the loop() method runs over and over again,
// as long as the Arduino has power


void loop()
{

digitalWrite(ledPin, LOW);
digitalWrite(redLedPin, HIGH);
delay(del);
digitalWrite(ledPin, LOW);
digitalWrite(redLedPin, HIGH);
delay(del);
digitalWrite(ledPin, LOW);
digitalWrite(redLedPin, HIGH);
delay(del);
digitalWrite(ledPin, LOW);
digitalWrite(redLedPin, HIGH);
delay(del);
digitalWrite(ledPin, LOW);
digitalWrite(redLedPin, HIGH);
delay(del);
digitalWrite(ledPin, HIGH);
digitalWrite(redLedPin, LOW);
delay(del);

}

Task 13 - One LED mostly on the other LED has a slight flash.

int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12; // LED connected to digital pin 12
int del =100;


// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
}


// the loop() method runs over and over again,
// as long as the Arduino has power


void loop()
{

digitalWrite(ledPin, HIGH);
digitalWrite(redLedPin, LOW);
delay(del);
digitalWrite(ledPin, HIGH);
digitalWrite(redLedPin, LOW);
delay(del);
digitalWrite(ledPin, HIGH);
digitalWrite(redLedPin, LOW);
delay(del);
digitalWrite(ledPin, HIGH);
digitalWrite(redLedPin, LOW);
delay(del);
digitalWrite(ledPin, HIGH);
digitalWrite(redLedPin, LOW);
delay(del);
digitalWrite(ledPin, LOW);
digitalWrite(redLedPin, HIGH);
delay(del);

}

Task 16 - One LED Blinks Twice, The Other Blinks Once coding

int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12; // LED connected to digital pin 12
int del =100;


// The setup() method runs once, when the sketch starts


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
}


// the loop() method runs over and over again,
// as long as the Arduino has power


void loop()
{

digitalWrite(ledPin, HIGH); // set the LED on
digitalWrite(redLedPin, LOW);// set the LED on
delay(del); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
digitalWrite(redLedPin, LOW);// set the LED off
delay(del);// wait for a second
digitalWrite(ledPin, HIGH); // set the LED on
digitalWrite(redLedPin, LOW);// set the LED off
delay(del);// wait for a second
digitalWrite(ledPin, LOW); // set the LED off
digitalWrite(redLedPin, LOW);// set the LED off
delay(del);// wait for a second
digitalWrite(ledPin, LOW); // set the LED off
digitalWrite(redLedPin, HIGH);// set the LED on
delay(del); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
digitalWrite(redLedPin, LOW);// set the LED off
delay(del);// wait for a second

}

Task 11 - Blink 2 coding

int ledPin = 13; // LED connected to digital pin 13
int redLedPin = 12;
int ledPin2 = 11; // LED connected to digital pin 13
int del =200;


void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(redLedPin, OUTPUT);
}


// the loop() method runs over and over again,
// as long as the Arduino has power


void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
digitalWrite(redLedPin, LOW);// set the LED on
delay(del); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
digitalWrite(redLedPin, HIGH);// set the LED off
delay(del); // wait for a second


}

Friday, February 19, 2010

Arduino Wireless Reviews - Youtube

http://www.youtube.com/watch?v=xFccaMiNTJA&feature=related

I thought this was quite a cool idea. It is an Arduino wirelessly display letters rotating round. Although it is not smooth, going by some of the comments this can be arranged. This has also helped giving me ideas in what I should make when coming to the projects.


http://www.youtube.com/watch?v=Qc6DKDFwg9c

Rumble robots is such a cool idea and at some stage I would love to make my arduino into something similar to this. Check it out!


http://www.youtube.com/watch?v=4t-WHWAsyk0

This youtube video is about overclocking an arduino, it is overclocked to 16 mhz and 32 mhz and is running the blink program. It is quite cool and you can clearly see the difference between them.

http://www.youtube.com/watch?v=hQhV601jIpg

Here is another link to another arduiono project that would be cool to make. It is a midi interface program using the arduino. I think bringing music and the arduino together will be quite cool!

LED Pixel Matrix Project Review

http://www.youtube.com/watch?v=hEKEM6ZOsZE

I just watched the LED Pixel Matrix Project. I thought this was quite a good design. It has some real character with the space invader and the different coloured lights and I thought it was quite practical that it could tell the time and what the temperature was. I think if it could get the time on one line instead of two, it would complete the project.

Task 10 - Arduino LED blinking

I found the cut off time for me to see the LED light blinking was about 11ms on and off, when I had it on 10ms, it seemed to me that it wasn't flashing at all. The code below is what I used to have the LED blinking:

int ledPin = 13;

void setup () {
pinMode (ledPin, OUTPUT);
}

void loop () {
digitalWrite (ledPin, HIGH);
delay (11);
digitalWrite (ledPin, Low);
delay (11);
}

PeerWise

From what I have found Peer-Wise is a tool supporting students to create multi-choice questions with answers and explanations.

Open Office

Open office is free software similar to microsoft word etc.

Fritzing

Fritzing is a tool for making prototypes for Arduinos. Should be interested tool to use when making bigger projects.

Chip8

Chip8 is a programming language making games easier to programme. Should be interesting to see if it will work on the Arduino.

Moodle

Moodle appears to be an elearning website, not sure what it is all about.

Wikieducator

Wikieducator appears to be an easy access website to find out information on all sorts of things, a bit like google.

GNU - GCC

I found accessing this website a bit confusing to get around. It appears to have information about GCC a compiler for the GNU operating system.

Processing Environment

The Processing website is similar to the Arduino website in what it offers. It should also be helpful and handy when programming.

Thursday, February 18, 2010

Task 9 - LED mostly on

int ledPin = 13; // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(100);
}

Task 8 - Blink mostly off

int ledPin = 13; // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(100);
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}

Tuesday, February 16, 2010


Arduino Enviroment

I have recenetly checked out the Arduino Enviroment at http://www.arduino.cc/. It looks like a good website to use in conjunction with the Arudino board and has a lot of helpful references and tips.

Monday, February 15, 2010

Task 1 - 7

These task have all been done, however nothing to display for it in blog. I do however have you-tube videos under general names, where I am unable to change the task name.