Arduino Programming🤓😵💫
Arduino Documentation Blog Entry:
There are 4 tasks that will be explained in this page:
Input devices:
Interface a potentiometer analog input to maker UNO board and measure/show its signal in serial monitor Arduino IDE.
Interface a LDR to maker UNO board and measure/show its signal in serial monitor Arduino IDE
Output devices:
Interface 3 LEDs (Red, Yellow, Green) to maker UNO board and program it to perform something (fade or flash etc)
Include the pushbutton on the MakerUno board to start/stop part 2.a. above
For each of the tasks, I will describe:
The program/code that I have used and explanation of the code. The code is in writable format (not an image).
The sources/references that I used to write the code/program.
The problems I encountered and how I fixed them.
The evidence that the code/program worked in the form of video of the executed program/code.
Finally, I will describe:
My Learning reflection on the overall Arduino programming activities.
a. Input devices: Interface a potentiometer analog input to maker UNO board and measure/show its signal in serial monitor Arduino IDE.
Below are the code/program I have used and the explanation of the code.
Below are the hyperlink to the sources/references that I used to write the code/program.
With the help of Autodesk Tinkercad videos provided in brightspace, I was able to run a simulation with arduino code online then transfer code to the physical arduino board.
Link to video: https://youtu.be/-EDYMQ9lczA
Below are the problems I have encountered and how I fixed them.
It was off to a bad start when the LED light did not shine when the code is uploaded with no error. This could only mean that the source of error is the physical arduino board itself. My team and I tried to tightened if not re plug the jumper wires and resistor but it still could not work. We then found out with the help of the other team that we accidentally placed the LED wrongly. As the LED cathode was just slightly longer than the anode, it did not help us realise the mistake at first, however re installing the LED, it verified the reason why our LED could not shine. Overall it was still an absolute success.
Below is the short video as the evidence that the code/program work.
b. Input devices: Interface a LDR to maker UNO board and measure/show its signal in serial monitor Arduino IDE:
Below are the code/program I have used and the explanation of the code.
Below are the hyperlink to the sources/references that I used to write the code/program.
lesson 9 on bright space Maker Uno Kit. Sadly I am unable to upload a file hence the pictures!
A video by MERT Arduino & Tech on Youtube has also help us understand the meaning of the codes
Link to video:https://youtu.be/4fN1aJMH9mM
They are kind enough to provide us with the Arduino code! Although I did not use it.
Link to code:https://create.arduino.cc/editor/mertarduinotech/40f2d22f-7853-4882-b2a9-1b6d43ac81b0/preview
Below are the problems I have encountered and how I fixed them.
During the initial attempt, the LDRvalue was set to >600 and it was too low. This made it such that even with a bright area, the LED was still lit up. This was due to the lighting of the area I was working in being higher than 900 LDRvalue. Therefore by adapting to the location of work the code was adjusted to be above 950, LDRvalue >950. After trial and error of with different LDRvalues, I was able to make the LED not light up in the lighting condition in the work area. Only when surrounding lights were dimmed (by placing my hand on the LDR sensor) would the LED light up.
Below is the short video as the evidence that the code/program work.
c. Output devices: Interface 3 LEDs (Red, Yellow, Green) to maker UNO board and program it to perform something (fade or flash etc)
Below are the code/program I have used and the explanation of the code.
Below are the hyperlink to the sources/references that I used to write the code/program.
Again with the help of Autodesk Tinkercad videos provided in brightspace, I was able to test out a dry run on the simulation software and transfer it to the arduino board.
Link of video:https://youtu.be/MojSo7OtF9w
Below are the problems I have encountered and how I fixed them.
Initial I had forgotten to change the animation speed which meant that it was at 0. which made an error occur. The LED were also barely visible and was really dim. I tried to reconnect the jumper wires and even used new jumper wire yet nothing changed. I had to redo each step once again and realised the resistor I used was 10 thousand Ohm instead of the 1 thousand one. The red and orange were so similar in colour gradient I mistook the resistor readings.
Below is the short video as the evidence that the code/program work.
d. Output devices: Include pushbutton to start/stop the previous task
Below are the code/program I have used and the explanation of the code.
Below are the hyperlink to the sources/references that I used to write the code/program.
Project 1, interactive traffic light. This can also be found in the brightspace Maker Uno kit file.
Below are the problems I have encountered and how I fixed them.
With the help of the guide it was very easy to operate this traffic light. Together with the previous experience from the above task, I was used to checking the arduino board even before uploading the code. Initially the red light for the traffic light part was not lighting up, however with my habit of checking the board again, I realised it was again placed wrongly where the cathode and anode should switch place. After making changes, everything just clicked and ran very smoothly.
Below is the short video as the evidence that the code/program work.
🧠Below is my Learning Reflection on the overall Arduino Programming activities.🤔💭
Wow I don't even know where to begin. It felt like I have been coding my whole term away. Although it has been only 2 or 3 weeks of intensive coding, the redoing of arduino and bread box coupled with the never ending mess of re-coding really made it feel like eternity😨😫. Goodness me I never thought I would be doing arduino in a course named "chemical engineering" can you? 😭
It is surprisingly not the first time I learnt coding I did it once when I was in secondary 1👀. My little brain cells🧠 and of course the help of my buddies we programmed a small ship that had a sole purpose of catching debris like plastic and rubbish floating on water. It was really fun putting pipes and floatable pool noodles to make that construction as it is latched at the back of my mind very clearly. With this said my coding skills has deteriorated over time and now I have completely forgotten all about it. It was fine though as I had amazing lesson materials to guide me through this project.👍
Although the lesson packages were brimming with content, they were all really logical and helpful. These included resistor readings checking for connectivity, potentiometer mechanism and much more. Not to mention the school was kind enough to provide a arduino kit for a pair of students! I really enjoyed myself so much playing with such delicate pieces of equipment.
Along the coding journey I have made countless of mistake, I think countless is not even the right word to use, anyhow through each experience I learn something new and made sure never to make the same mistake again. Some examples were placing the positive and negative electrode on the wrong end, using improper resistor misplacing a code etc. These mistake made me naturally double and triple check my construction and code before uploading it. It has made me realise the beauty of coding and why so many people are exploring and creating new and awesome codes. This few basic lessons of coding were really just the tip of the iceberg and I am certain there will be never ending trial and error if I were to venture into coding.
Speaking of basics, it has really related me back to chemical engineering especially laboratory skills🧪 and process operation skills. Basic are so important not just in work but in life😉. Applying the basic skills and mastering it build and incredible foundation as seen in coding. I have personally learned and understood many of the coding terms such as voidsetup, voidloop, delay and much more. Knowing the purpose of each code or phrase at one glance really improved the overall efficiency when adjusting a code. Although I have to admit, saying that I understood them all is way to far-fetched as I am just a beginner in coding I still firmly believe it has been enlightening to recap coding and I truly believe it will be of great help in the future. 😎
I really appreciate the teachers who put together the learning resources as it really made an impact🫡. As coding or programming is highly experimental, explaining to students such that they could grasp the basic definitely is more difficult then it sounds😵. I am glad that I got to experience coding again and I hope that my fellow classmates can see and appreciate the complexity of each code.
Thank you guys for sticking around till the end. My journey of coding has sadly ended here for this term but fret not there will definitely be more content to be uploaded so till then peace out!✌
Disclaimer: there will be more coding in my capstone project so don't forget to tune in when that time arrives:)
No comments:
Post a Comment