ARDUINO BLOGš”š»
- Eshvin Kaur
- Dec 3, 2022
- 5 min read
HEY GUYSSSS!!!!! I AM BACK WITH YET ANOTHER BLOGš I REALLY HOPE YALL WOULD LOVE THIS BLOGš®āšØ AS THIS IS DEFINITELY ONE OF THE MOST INTERESTING PRACTICALS THAT I HAVE DONEš±š¤«. I WILL BE TALKING ABOUT MY EXPERIENCE𦺠WITH ARDUINO UNO AND CERTAIN ACTIVITIES I DID WITH IT AND HOW TO DO SO š š!!!
Input Devices:
Interface a potentiometer analog input to the maker UNO board and measure/show its signal in serial monitor Arduino IDE.
The code/program I have used and the explanation of the code.
Code Used | Explanation |
void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); pinMode(A0, INPUT); pinMode(LED_BUILTIN, OUTPUT); } void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.println(sensorValue); // turn the LED on digitalWrite(LED_BUILTIN, HIGH); // pause the program for <sensorValue> millseconds delay(sensorValue); // Wait for sensorValue millisecond(s) // turn the LED off digitalWrite(LED_BUILTIN, LOW); // pause the program for <sensorValue> millseconds delay(sensorValue); // Wait for sensorValue millisecond(s) } | āvoid setup() Serial.begin(9600)- shows the rate of change of speed of value on the display pins are configured to be outputs by using the pinMode() function. void loop() int sensorValue = analogRead(A0)- print this information to serial monitor window. Serial.println(sensorValue)-displays the value of sensorVal of it is pressed. digitalWrite(LED_BUILTIN, HIGH)- turn the LED on (HIGH is the voltage level) delay(sensorValue)- wait for sensoreValue digitalWrite(LED_BUILTIN, LOW)- turn the LED off (LOW is the voltage level) Adjusting potentiometer will increase or decrese the speed of LED blinking. |
Hyperlink š to the sources/references that I used to write the code/program.
The problems š I have encountered and how I fixed š©š¼āš§ them
Firstly, i knew that i install the potentiometer and wires correctly but still when i upload in the Arduino IDE, it does not work. Then i thought lets try other ports and that when it started working so that was the first problem i went through.
Secondly, since i am not very skilful at coding, i always make errors when trying to make my own code as i always forget to put the minor things such as a colon. It is defitenely frustrating š” but as i do the other Arduino Programming activities, i know what i have to look out for.
Short video š¹ of the code/program working
Interface a LDR to maker UNO board and measure/show its signal in serial monitor Arduino IDE.
The code/program I have used and the explanation of the code.
Code Used | Explanation |
āint ldr; void setup() { pinMode(A0,INPUT); Serial.begin(9600); } void loop() { ldr= analogRead(Ao); Serial.println(ldr); delay(10); } | āvoid setup() Serial.begin(9600)- shows the rate of change of speed of value on the display pins are configured to be outputs by using the pinMode() function. void loop() When the LDR sense light,it will send a signal to the make UNO board and the LED will light up. delay(10)- a delay of 10 miliseconds |
Hyperlink š to the sources/references that I used to write the code/program
Youtube Tutorial: https://www.youtube.com/watch?v=pzJvd0Rfa_c
The problems š I have encountered and how I fixed š©š¼āš§ them
The only problem that i encountered was trying to type out the codes manually as i tend to miss one or two numbers so what i did was i took a screenshot of the code and look at my phone while typing out the code.
Short video š¹ of the code/program working
Output devices:
Interface 3 LEDs (Red, Yellow, Green) to maker UNO board and program it to perform something (fade or flash etc)
The code/program I have used and the explanation of the code.
Code for interface | Explanation |
#define LED_PIN_1 11 #define LED_PIN_2 10 #define LED_PIN_3 9 void setup() { pinMode(LED_PIN_1, OUTPUT); pinMode(LED_PIN_2, OUTPUT); pinMode(LED_PIN_3, OUTPUT); } void loop() { digitalWrite(LED_PIN_1, HIGH); digitalWrite(LED_PIN_2, LOW); digitalWrite(LED_PIN_3, LOW); delay(1000); digitalWrite(LED_PIN_1, LOW); digitalWrite(LED_PIN_2, HIGH); digitalWrite(LED_PIN_3, LOW); delay(1000); digitalWrite(LED_PIN_1, LOW); digitalWrite(LED_PIN_2, LOW); digitalWrite(LED_PIN_3, HIGH); delay(1000); } | #define LED_PIN_1 11 - power on the LED on pin 11 first voidsetup() pins are configured to be outputs by using the pinMode() function. voidloop() digitalWrite(LED_PIN_1, HIGH)- power on the LED with digitalWrite() and HIGH, and wait for 1 second using delay() delay(1000)- a delay of 1000 milliseconds |
Code for Fading | Explanation |
int led_1 = 9; // the PWM pin the LED is attached to int led_2 = 10; // the PWM pin the LED is attached to int led_3 = 11; // the PWM pin the LED is attached to int brightness_1 = 175; // how bright the LED is int brightness_2 = 175; // how bright the LED is int brightness_3 = 175; // how bright the LED is int fadeAmount_1 = 1; // how many points to fade the LED by int fadeAmount_2 = 1; // how many points to fade the LED by int fadeAmount_3 = 1; // how many points to fade the LED by // the setup routine runs once when you press reset: void setup() { // declare pin 9 to be an output: pinMode(led_1, OUTPUT); pinMode(led_2, OUTPUT); pinMode(led_3, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // set the brightness of pin 9: analogWrite(led_1, brightness_1); analogWrite(led_2, brightness_2); analogWrite(led_3, brightness_3); // change the brightness for next time through the loop: brightness_1 = brightness_1 + fadeAmount_1; brightness_2 = brightness_2 + fadeAmount_2; brightness_3 = brightness_3 + fadeAmount_3; // reverse the direction of the fading at the ends of the fade: if (brightness_1 <= 7 || brightness_1 >= 205) { fadeAmount_1 = -fadeAmount_1; } if (brightness_2 <= 7 || brightness_2 >= 205) { fadeAmount_2 = -fadeAmount_2; } if (brightness_3 <= 7 || brightness_3 >= 205) { fadeAmount_3 = -fadeAmount_3; } // wait for 30 milliseconds to see the dimming effect delay(10); } | int led_1 = 9 - where the LED is attached to int brightness_1 = 175 - how bright is the LED int fadeAmount_2 = 1 - how many points to fade the LED by voidsetup() pins are configured to be outputs by using the pinMode() function. voidloop() analogWrite(led_1, brightness_1) - setting the brightness (brightness_1 <= 7 || brightness_1 >= 205) { fadeAmount_1 = -fadeAmount_1; } - reverse the direction of the fading. delay(10)-a delay of 10 milliseconds |
Hyperlink š to the sources/references that I used to write the code/program.
Robotics Back End: https://roboticsbackend.com/arduino-led-complete-tutorial/
The problems š I have encountered and how I fixed š©š¼āš§ them.
For this activity i did not faced much problem as i watch a lot of tutorial videos and i found the best suited code for interfacing the 3 LEDS and Fading it. There were a bit of issue handling with the wires as you can see from below.
Short video š¹ of the code/program working
Include a pushbutton to start/stop the previous task
The code/program I have used and the explanation of the code.
Code | Explanation |
#define LED_1_11 #define LED_2_10 #define LED_3_9
void setup() {
pinMode(LED_1_PIN,OUTPUT);
pinMode(LED_2_PIN,OUTPUT); pinMode(LED_3_PIN,OUTPUT);
} void loop() { byte buttonState = digitalRead(BUTTON_PIN); if(buttonstate == LOW{ digitalWrite(LED_1_PIN.HIGH); digitalWrite(LED_2_PIN.HIGH); digitalWrite(LED_3_PIN.HIGH); } else{ digitalWrite(LED_1_PIN.LOW); digitalWrite(LED_2_PIN.LOW); digitalWrite(LED_3_PIN.LOW); } } | #define LED_PIN_1 11 - power on the LED on pin 11 first voidsetup() pins are configured to be outputs by using the pinMode() function. voidloop() digitalWrite(LED_PIN_1, HIGH)- power on the LED with digitalWrite() and HIGH. digitalWrite(LED_PIN_1, LOW)- turn the LED off (LOW is the voltage level) |
Hyperlink š to the sources/references that I used to write the code/program.
Robotics Back end : https://roboticsbackend.com/arduino-input_pullup-pinmode/
The problems š I have encountered and how I fixed š©š¼āš§ them.
In the maker uno kit package, it was only written on how to use the pushbutton as a digital input. Alos based on many tutorial videos that i watched, the pushbutton was given to them . Then i did my reserach and cam out with a code that can stop the previous task as shown below.
Short video š¹ as the evidence that the code/program work.
Learning Reflection šāš¼ on the overall Arduino Programming Activities
So far these Arduino activities have been NERVE-WRECKING š¤Æš³!!! First of all, before attending the Arduino Programming Practical, we were task šµš» to do a pre practical where we had to complete four challenges 4ļøā£ which are Hello World, Programmable Button, Make some noise and Servo. I had to repeat all of them many times as each time i always do something wrong ā or i discover i should have done another way š¤. It was defenitly a long š and torturing š¹ process but in this way i learned what each code actually means šÆ and its interesting to know how it actually works like we can play around and input any functions and see what it does šš”.

For practical, my group was tasked to make two 2ļøā£ unicornš¦ flap its wings, make it very aestheticš and make it blink or have a sound š. My group decided to have the blink šØ function. My partner, Insyirah and I took the cardboard of the unicorn and made it.
Then we created the code needed to make the servo function. We tried out different speeds šš¼ of the servo as the wings were not flapping a lot. However, we realized that it was challenging š« to find the correct ā position to tie the metal wire of the servo to the bottom of the wings. This is because at a certain direction the wings do not flap a lot. We finally found the right angle at which to tie the string āļø

Afterwards we then untie the servo from the unicorn to design it š©š¼āšØ . Since Insyirah and I are a huge football ā½ļø fans and its the WORLD CUP SEASON š !!!! we decided to create a football theme for our unicorn šØ .







Comments