My assignment's idea is addition to Week 6 idea.
I decided to add pushbutton and LCD screen and pushbutton to the circuit, so when the pushbutton is pressed counter will start to show on the screen.
All tools/ software used in this week's assignment explained here.
I added to it:
I simulated the circuit first on TinkerCad, then I started by adding main components on the breadboard and wired it accordingly as per the color code ( red for positive and black for negative).
I split the whole project to small parts and decided to write and test every part separately.
P.S: The available LCD on TinkerCad is different from the one I have so, I used Google search to understand wire the LCD on TinkerCad accordingly.
I used this link as reference for wiring the LCD on TinkerCad.
I started the implementation with Red LED. wrote the code and turned it on.
I set the red LED as int in order to don't need to memorize the pin number.
I explained the programming method I followed in details here.
The second part (RGB, LM35 and Buzzer)
I followed the same approach as the previous part.
Wired the related components and build up on the above code.
Now it is time for the LCD (for me it was the hardest part)
I started with adding the LCD and pushbutton to the circuit.
Then, I included the LCD library in the Arduino IDE, added the name of the LCD, added the pushbutton as int.
In the setup section I set the LCD light to off, the pushbutton as input and moved to the loop part.
In the loop part I wanted to print the temperature readings from the LM35 sensor only in case I pressed the pushbutton other than that the LCD will remain off.
For the enclosure, I used the low fidelity prototype cardboard I built in the final project proposal.
In this week assignment, I wanted to add minutes and hours counter to display on the LCD but I didn't manage to do it, Saeed suggested that instead of stop everything and try to do this I should try new thing instead as if I tried to do it, it might take a lot of time to figure out where is the issue and I need every time available since the diploma is not yet done
This week level of complexity was very high.
I faced some challenges in the coding mainly.
First thing was reading from LM35 sensor, when I tried it first before competing the circuit the readings was between 270 and 275 C.
I was pretty sure it is not normal.
I searched on Google a lot with no avail, I even changed the wring and the place of the sensor then I asked on the diploma support channel on Slack and the mistake was in the setup part setting the sensor pin mode.
Instead of setting it as input only I set it as Input_pullup
Second mistake was in the pushbutton condition.
In the condition I asks the Arduino to see the state of the pushbutton if it is low then it should do something and when I uploaded the code it didn't work then I discovered the mistake.
The condition was if the analog read = low however high and low are for digital read and if I wanted analog read I should have added number instead of high and low.
By competing this assignment I can say that my final project is around 70% completed as I did the electronic part in the project in this week's assignment.
The coolest this this week was the state in the condition I learned on the weekly face to face session.
It gave me new perspective and powerful yet small programming line to control things.