-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek6.html
156 lines (144 loc) · 10.2 KB
/
week6.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Demircan Tas - How to Make Almost Anything</title>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">Demircan Tas</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="final.html">Final - Rover</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week1.html">Week 1 - Cutting</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week2.html">Week 2 - PCB's</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week3.html">Week 3 - 3D Scan & Print</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week4.html">Week 4 - Circuit Board Design</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week5.html">Week 5 - CNC Machining</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week6.html">Week 6 - Embedded Programming</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week7.html">Week 7 - Molding and Casting</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week8.html">Week 8 - Inputs</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week9.html">Week 9 - Outputs</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week10.html">Week 10 - Networking</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="week11.html">Week 11 - Interfaces</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"><span
class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<li class="nav-item active"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#!">Link</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#!">Action</a>
<a class="dropdown-item" href="#!">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#!">Something else here</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page content-->
<div class="container-fluid">
<h1 class="mt-4">Week 6 - Embedded Programming</h1>
<h2>Programming my board!</h2>
<button class="collapsible">Debugging the board from Week 4</button>
<div class="content">
<p>My DC11 board with an LED and switch would only function when it was connected to the Atmel ICE programmer via the 2x5 pin connector. This week, it did not finction at all.</p>
<p>Upon closer inspection, I noticed that the solder joints for the button were a bit sketchy. Moreover, recalling an insight from Raghav, I found out that it is a better idea to bend the legs of the button out before soldering.</p>
<p>Upon resoldering the button, the board began to function through USB. The microcontroller already had a bootloader, and I managed to upload sample programs with the Arduino IDE.</p>
<img src="assets/week6/IMG_20211022_175801.jpg" alt="Neil's blink code", width="640">
<p>The next issue was with the LED. I learned from Kim that I could use Arduino IDE's sample blink program to test my LED. The LED was connected to PA 04 on my microcontroller, although it did not respond.</p>
<p>I tried to figure out Neil's sketch instead, and suspected issues with soldering. Just to be safe, I also connected the LED to PA 05 (same port as Neil's design) to no avail.</p>
<p>To check if the LED unit functioned, I used the power source in Archshops. Then I found out that there was a tiny gap in the copper trace near the resistor. Using the wire from PA 05, I soldered directly to the resistor, and now my board blinks!</p>
<video width="720" height="405" autoplay muted loop>
<source src="assets/week6/blinking.mp4" type="video/mp4">
</video>
</div>
<button class="collapsible">Playing with the blink and blutton</button>
<div class="content">
<p>Starting from example code, I created a button push to light program.</p>
<p>I implemented pulse width modulation by using up time and down time variables as arguments for the delay function after switching the LED on and off (respectively).</p>
<video width="720" height="405" autoplay muted loop>
<source src="assets/week6/fast_blink.mp4" type="video/mp4">
</video>
<video width="720" height="405" autoplay muted loop>
<source src="assets/week6/faster_blink.mp4" type="video/mp4">
</video>
<video width="720" height="405" autoplay muted loop>
<source src="assets/week6/pwm_changing_blink.mp4" type="video/mp4">
</video>
<p>I later found out that a similar example already exists in Arduino IDE's library that results in smoother transitions.</p>
<video width="720" height="405" autoplay muted loop>
<source src="assets/week6/pwm_example.mp4" type="video/mp4">
</video>
</div>
<button class="collapsible">Creating a state machine</button>
<div class="content">
<p>To extend my single button input, I started investigating counting sequential button pushes. Googling this idea got me into state machines. I found a simple implementations that uses modulus operations on a variable that increases on each button push. Using this, I got my LED to light up on every fourt push of the button.</p>
<video width="720" height="405" autoplay muted loop>
<source src="assets/week6/simple_state_machine.mp4" type="video/mp4">
</video>
<p>At this point, my board stopped responding, for the third time. I replaced the wire, and rechecked the solder joints with no result.</p>
</div>
<button class="collapsible">Code</button>
<div class="content">
<a href="assets/week6/code/PWM/PWM.ino" download>PWM</a><br>
<a href="assets/week6/code/Oscillating_PWM/Oscillating_PWM.ino" download>PWM oscillating</a><br>
<a href="assets/week6/code/Board_state/Board_state.ino" download>Board with states - Work in Progress</a><br>
<a href="assets/week6/code/Board_state_example/Board_state_example.ino" download>Board with states - Example code</a>
</div>
<!--
><p>
Make sure to keep all page content within the
<code>#page-content-wrapper</code>
. The top navbar is optional, and just for demonstration. Just create an element with the
<code>#sidebarToggle</code>
ID which will toggle the menu when clicked.
</p>
-->
</div>
</div>
</div>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function () {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight) {
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
</script>
</body>
</html>