Monday, 23 November 2015

Arduino Challenge 2

Challenge Name:
Blinking Christmas lights
Author:
Joshua Mac 
Credit
Aron Graca
Difficulty level
2
Proof






















Time
10 mins

Challenge Description:
Write a program that uses 6 LED's where the EVEN numbered LED's light up (LED#2, LED# 4, LED#6) and then the ODD numbered LED's light up (1,3,5), and then repeats backwards (6,4,2) then (5,3,1).
Hint
None
Answer
int ledPin2=2;
int ledPin3=3;
int ledPin4=4;
int ledPin5=5;
int ledPin6=6;
int ledPin7=7;

void setup ()
{
  pinMode(ledPin2,OUTPUT);
  pinMode(ledPin3,OUTPUT);
  pinMode(ledPin4,OUTPUT);
  pinMode(ledPin5,OUTPUT);
  pinMode(ledPin6,OUTPUT);
  pinMode(ledPin7,OUTPUT);
}

void loop ()
{
  digitalWrite(ledPin2, HIGH);
  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, HIGH);
  digitalWrite(ledPin5, LOW);
  digitalWrite(ledPin6, HIGH);
  digitalWrite(ledPin7, LOW);
  delay(1000);

  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, LOW);
  digitalWrite(ledPin5, HIGH);
  digitalWrite(ledPin6, LOW);
  digitalWrite(ledPin7, HIGH);
  delay(1000);
}

Friday, 20 November 2015

Arduino Lab 2

Challenge Name:
Wavy Lights

Author:
Joshua Mac

Credit:
Kyle Chan
Aron Graca

Difficulty Level:
- 3
Pictures:




















Time to Complete:
- 10 minutes

Challenge Description:
In this challenge you will have to make a wave with 3 LED's. The process in this challenge is: LED1 turning on then off, LED2 turning on then off, LED3 turning on then off.

Hint:
- It is 1 big code, and not 3 separate ones

Answer:

int LedPin2 = 2; -Creating a variable named ledPin2 to represent the number 2
int LedPin3 = 3; -Creating a variable named ledPin3 to represent the number 3
int LedPin4 = 4; -Creating a variable named ledPin4 to represent the number 4

void setup() -This creates our setup() function which defines what the pins will do
{ -This indicates the start of void setup() 
  pinMode(ledPin2, OUTPUT); -This declares the value of ledPin2 to be an OUTPUT
  pinMode(ledPin3, OUTPUT); -This declares the value of ledPin3 to be an OUTPUT
  pinMode(ledPin4, OUTPUT); -This declares the value of ledPin4 to be an OUTPUT
This indicates the end of void setup() 

void loop() -This is where we put the program we want to loop forever 
{ - 
This indicates the start of void loop()   
  digitalWrite(ledPin2, HIGH); -ledPin2 is given maximum power
  delay(1000) -1000ms wait 
  digitalWrite(ledPin2, LOW); -ledPin4 goes off
  delay(1000) -1000ms wait 
  digitalWrite(ledPin3, HIGH); -ledPin3 is given maximum power
  delay(1000) -1000ms wait
  digitalWrite(ledPin3, LOW); -ledPin4 goes off
  delay(1000) -1000ms wait
  digitalWrite(ledPin4, HIGH); -ledPin4 is given maximum power
  delay(1000) -1000ms wait
  digitalWrite(ledPin4, LOW); -ledPin4 goes off
  delay(1000) -1000ms wait
} -This indicates the end of void loop() 


Arduino Challenge 1

Challenge Name:
Wavy Lights

Author:
Joshua Mac

Credit:
Kyle Chan
Aron Graca

Difficulty Level:
- 3
Pictures:



Time to Complete:
- 10 minutes

Challenge Description:
In this challenge you will have to make a wave with 3 LED's. The process in this challenge is: LED1 turning on then off, LED2 turning on then off, LED3 turning on then off.

Hint:
- It is 1 big code, and not 3 separate ones

Answer:

int LedPin2 = 2;
int LedPin3 = 3;
int LedPin4 = 4;

void setup()
{
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
}

void loop()
{
  digitalWrite(ledPin2, HIGH);
  delay(1000)
  digitalWrite(ledPin2, LOW);
  delay(1000)
  digitalWrite(ledPin3, HIGH);
  delay(1000)
  digitalWrite(ledPin3, LOW);
  delay(1000)
  digitalWrite(ledPin4, HIGH);
  delay(1000)
  digitalWrite(ledPin4, LOW);
  delay(1000)
}

Wednesday, 18 November 2015

Arduino Lab 1

Purpose:
Make an LED blink on and off

Equipment:
LED
Resistor
wire(any color)
wire(any color)
wire(any color)

Program Details:
I used Arduino

Time to Program and Complete:
Around 10 mins

Results:
I was connected to the wrong port, so I changed it in the tools tab

Photo/Video Proof:






















Program:
int ledPin = 13; - This creates a variable

void setup() - This declares the setup function to define what pins on our Arduino will do 

{ - This bracket shows us the start of the setup function

 pinMode(ledPin, OUTPUT); - pinMode allows us to define if a pin is an input or an outpud

} - This bracket shows us the end of the setup function 

void loop() - This declares a function to loop forever

{ - This bracket shows us the start of the setup function

 digitalWrite(ledPin, HIGH); - digitalWrite turns on power to a specific pin (0-13) at a specific value (1 - 255)

 delay(1000); - Delays arduino to wait a number of miliseconds before going to the next instruction

 digitalWrite(ledPin, LOW); - This digitalWrite is setting the power of ledPin (pin 13) to LOW or 0

 delay(1000); - Tells arduino to wait one second before looping to the top of the function

} - This bracket shows us the start of the setup function


Program Modifications:
none.

Helpful Tips:
Make sure you are on the right port.

References:
Kyle Chan, Aron Graca