CP5070 intro to chemical product design and development
Input devices: Interface a potentiometer analog input to make UNO board and measure/show its signal in serial monitor Arduino IDE.
1. Below are the code/program I have used and the explanation of the code

2. Below are the hyperlink to the sources/references that I used to write the code/program
Link: https://www.youtube.com/watch?v=yyG0koj9nNY
3. Below are the problems I have encountered and how I fixed them.
This setup was relatively easy, so i did not encounter any problems.
4. Below is a short video as the evidence that the code/program work.
Input devices: Interface a LDR to maker UNO board and measure/show its signal in serial monitor Arduino IDE:
1. Below are the code/program I have used and the explanation of the code

2. Below are the hyperlink to the sources/references that I used to write the code/program
Link: https://www.youtube.com/watch?v=yyG0koj9nNY
3. Below are the problems I have encountered and how I fixed them.
This setup was relatively easy, so i did not encounter any problems.
​
4. Below is a short video as the evidence that the code/program work.
Output devices: Interface 3 LEDs (Red, Yellow, Green) to maker UNO board and program it to perform something (fade or flash etc)’
1. Below are the code/program I have used and the explanation of the code

2. Below are the hyperlink to the sources/references that I used to write the code/program
Link: https://www.youtube.com/watch?v=Vs9BzdnqNlc&t=247s
​
3. Below are the problems I have encountered and how I fixed them.
I followed a video i found on YouTube step by step and it worked.
4. Below is a short video as the evidence that the code/program work.
Output devices: Include pushbutton to start/stop the previous task
1. Below are the code/program I have used and the explanation of the code

2. Below are the hyperlink to the sources/references that I used to write the code/program
Nil
3. Below are the problems I have encountered and how I fixed them.
All 3 LEDs lit up the entire time when the button was not even pressed, the problem was rectified by making the 3 LEDs into a parallel circuit so that when the button was pressed all the LEDS would light up at the same time.
4. Below is a short video as the evidence that the code/program works.
Below is my Learning Reflection on the overall Arduino Programming activities.
Doing this practical, I realised that I enjoy and hate coding at the same time. It was very frustrating trying to figure out how to put 3 codes together and make it work, but on the flip side when everything fell into place I was very happy and it was cool to see the hard work paying off.
For the practical, we decided to use Red LED as the eyes of little pegasus to symbolise a ‘Sharingan’ which comes from an anime called ‘Naruto’, we also cued a noise at the start before the eyes flashes as that is what happens in the anime, then after the eye flash the wings that is attached via a metal wire connected to our servo will rotate back and forth causing the wings to flap continuously. We also coloured the wings in an 'Akatsuki' pattern, which is also another ‘Naruto’ themed thing. The body design was inspired by a ‘My Little Pony’ pegasus that could fly at the speed of sound named ‘Rainbow Dash’. To restart the first 2 processes (Noise and eyes), press the reset button we programmed on the Arduino.
​
I can say that the codes we used for the guiding task during class were very helpful for this practical, like i said in the first paragraph, the hard thing was making all 3 codes work together as it was not taught so we had to learn it on the fly. I learnt that we could not have 2 ‘void setup’ or ‘void loop’, so i tried again until i figured out that combining ‘void setup’ and ‘void loop’ was the solution to this whole mumble jumble.
​

Sharingan (Red LED eyes)

Akatsuki (Cloud pattern on the wings)

Rainbow Dash (Colourway for the Tail, Mane and Body)
Assembling of the Pegasus
We pushed out the pre-cut pieces of the cardboard and then assembled it based on what we thought it was supposed to be, luckily it all planned out and the Pegasus was assembled. We then decorated the body.
​
​
​
​
​
​
​
​
​
​
​
​
Coding used for our Pegasus:
define LED 9
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
#include "pitches.h"
// notes in the melody:
int melody[] = {
NOTE_A7
};
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
4
};
void setup() {
pinMode(LED, OUTPUT);
pinMode(3, OUTPUT);`
myservo.attach(11); // attaches the servo on pin 9 to the servo object
// iterate over the notes of the melody:
for (int thisNote = 0; thisNote < 8; thisNote++) {
// to calculate the note duration, take one second divided by the note type.
//e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
int noteDuration = 1000 / noteDurations[thisNote];
tone(8, melody[thisNote], noteDuration);
// to distinguish the notes, set a minimum time between them.
// the note's duration + 30% seems to work well:
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
// stop the tone playing:
noTone(8);
}
}
void loop() {
digitalWrite(LED, HIGH);
delay (100);
digitalWrite(LED, LOW);
delay (100);
digitalWrite(3, HIGH);
delay (100);
digitalWrite(3, LOW);
delay (100);
for (pos = 0; pos <= 180; pos += 15) { // goes from 0 degrees to 20 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(40); // waits 0ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 15) { // goes from 150 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(40); // waits 15ms for the servo to reach the position
}}


