top of page
Search

ARDUINO BLOGšŸ’”šŸ’»

  • Writer: Eshvin Kaur
    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



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.




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.



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 šŸ˜„šŸ’”.
ree



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 ā—ļø

ree


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 šŸŽØ .



ree



Since i am an England šŸ“ó §ó ¢ó „ó ®ó §ó æ Supporter and she's a Brazil šŸ‡§šŸ‡·Supporter, we decorated an England šŸ“ó §ó ¢ó „ó ®ó §ó æ flag and logo at one side and Brazil šŸ‡§šŸ‡· flag and logo and the other side.





We were definitely running out of timeā³ but in that short time we quickly created a box šŸ“¦ to store the wires and Arduino set and connected the servo and adjust the position of it. As we kept adjusting, the LEDšŸ“ kept falling from the unicorn head šŸ¦„ so that was extra work as it was hard šŸ˜®ā€šŸ’Ø to put it back. We then colour the box green 🟢as if it look like grass šŸ€ but well it didn't and we crush two pieces of papers and make them look like the World Cup Football āš½ļø. Honestly i had fun 🄳 doing the practical because although the Arduino programming part can be a little boring 🄱 but having to be innovative with designing the product makes the practical extra fun and worthwhile šŸ‘» šŸ¤™šŸ» .


Overall, I feel that I have gained a better understanding šŸ‘©šŸ½ā€šŸ’» of how to use Arduino Uno after completing the above activities for the blog šŸ“ and practicalsšŸ‘©šŸ¼ā€šŸ”§. In spite of the fact that I was unable šŸ¤• to achieve the results that I desired, I continued to attempt and researched the possible 🧠 reasons for my failure. I was able to utilize this strength šŸ’ŖšŸ» of mine during the Arduino Programming process. It is still not something that I enjoy šŸ˜‚, even after many practices. Nevertheless, I'm glad 😁 I've learned the basics since this will be very useful for my final year project šŸŽ¬ and I feel that it'll be very useful for me in the future šŸ”®.

Ā 
Ā 
Ā 

Comments


  • Facebook
  • Twitter
  • LinkedIn

©2022 by eshvin. Proudly created with Wix.com

bottom of page