My desktop computer setup has no volume buttons whatsoever. This is a real problem that needs to be solved. But often things don’t get done without deadlines. I only have two hours til a respectable bed time. To make this more fun, I will write updates as they happen without post-editing. Let’s get started:
Research
X:33 – I have a nice potentiometer from Sparkfun that should work well. That with an Arduino would be a nice MVP. Software?
X:42 – NirCmd is a good starting point
X:45 – Looks like pulling data in from the Arduino over a COM port and reading it in a Batch script will work. That’s good enough for me.
Decide
X:49 – Analog pin on an Arduino will read voltage across a potentiometer. Arduino will scale that level up to whatever NirCmd likes to see, then constantly send out that level. A Batch script will run on my PC watching that COM port for a change in the value. When it reads a new value it will set the audio level appropriately
Do
Y:14 – Resistor Divider and Arduino analog input values I should expect to see.
Y:29 – Lost my friendly book of common resistor values. A minor panic ensued. Fortunately my junk bin had plenty of resistors. Hardware is ready to go.
Y:45 – Arduino code done
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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="keywords" content="Arduino IDE, Arduino Integrated Development Environment, Arduino Software (IDE), Arduino web editor, Codebender"> <meta name="description" content="Arduino IDE in the Cloud. Codebender includes a Arduino web editor so you can code, store and manage your Arduino sketches on the cloud, and even compile and flash them."> <meta property="og:site_name" content="Arduino IDE"/> <meta property="og:title" content="Arduino Cloud IDE - Codebender"> <meta property="og:description" content="Arduino IDE in the Cloud. Codebender includes a Arduino web editor so you can code, store and manage your Arduino sketches on the cloud, and even compile and flash them."> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:image" content="https://codebender.cc/images/codebender_social.png?v56"> <meta property="og:url" content="https://codebender.cc/sketch:129292"> <meta property="og:type" content="website"> <meta property="fb:app_id" content="439261962789824"> <link rel="alternate" type="application/json+oembed" href="https://codebender.cc/oembed/?format=json&url=https%3A%2F%2Fcodebender.cc%2Fsketch%3A129292" title="https://codebender.cc/sketch:129292"> <title>AnalogRead for Potentiometer by michael.sizemore.a</title> <link rel="shortcut icon" href="/favicon.ico?v56"> <link rel="stylesheet" href="/cache/css/common.css?v56" /> <link rel="stylesheet" href="/fonts/font-awesome-4.5.0/css/font-awesome.min.css?v56"> <link rel="stylesheet" href="/cache/css/project.css?v56"/> <script type="text/javascript" src="//code.jquery.com/jquery-1.12.0.min.js"></script> <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/magknjdfniglanojbpadmpjlglepnlko"> <!-- Facebook Pixel Code --> <script> !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window,document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '216737015633457'); fbq('track', 'PageView'); </script> <noscript> <img height="1" width="1" src="https://www.facebook.com/tr?id=216737015633457&ev=PageView &noscript=1"/> </noscript> <!-- End Facebook Pixel Code --> <!-- Global Site Tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-122221181-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-122221181-1'); </script> <!-- End Google Analytics --> </head> <body > <section class="navbar navbar-fixed-top"> <div class="navbar-inner"> <a class="brand" href="/"> <!-- <img id="logo_small" src="/images/cb_logo.png?v56"> --> <img alt="Codebender logo" id="logo_small" src="/images/cb-ca_logo.svg?v56"> </a> <ul class="nav"> <li> <form class="navbar-search pull-left" action="/search/find/" method="get" id="searchform"> <input class="typeahead search-query" name="query" type="text" placeholder="Search" id="search" spellcheck="false"/> </form> <i id="search-in-progress" class="icon icon-spinner icon-spin" style="display: none;"></i> </li> </ul> <ul class="nav pull-right"> <li id="signup"> <a href="/register/"> Register </a> </li> <li id="login"> <a href="/login">Log In</a> </li> </ul> </div> <div id="flashbag-container"> </div> </section> <div id="mycontainer" class="container"> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <div id="sketch-view"> <div class="sketch-view-header"> <h1 class="sketch-info-container"> <span class="sketch-name" title="AnalogRead for Potentiometer"> AnalogRead for Potentiometer </span> <span class="owner-text">by</span> <a class="owner-name" title="michael.sizemore.a" href="/user/michael.sizemore.a"> michael.sizemore.a </a> </h1> <h2 class="clone-info-container"> </h2> <div class="share-container"> <div class="addthis_sharing_toolbox"></div> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-543fc4a82ddf244c"></script> <script type="text/javascript"> var currentUrl = 'https://codebender.cc/sketch:129292'; var addThisDefaultDescription = 'Arduino IDE in the Cloud. Codebender includes a Arduino web editor so you can code, store and manage your Arduino sketches on the cloud, and even compile and flash them.'; var documentTitle = document.title; function addthisRefresh() { var ogDescription = addThisDefaultDescription; if (typeof window.shortDescription == 'string' && window.shortDescription.length > 0) { ogDescription = window.shortDescription; } window.addthis_share = window.addthis_share || {}; window.addthis_share.title = document.title; window.addthis_share.description = ogDescription; window.addthis_share.passthrough = { twitter: { text: document.title, via: 'codebender_cc' } }; window.addthis.toolbox('.addthis_sharing_toolbox'); } function addthisInit() { if (typeof window.addthis !== 'undefined') { var $shareModal = $('#share-modal'); if ($shareModal.length > 0) { $shareModal.on('show', addthisRefresh); } addthisRefresh(); } } $(function () { addthisInit(); }); </script> <style type="text/css"> #share-url-container { display: inline-block; height: 20px; border: 1px solid #b2b2b2; color: #b2b2b2; font-size: 12px; font-style: normal; } #share-url-wrapper { display: inline-block; margin: 0 5px; overflow: hidden; } </style> <div id="share-url-container"> <div id="share-url-wrapper"> <div id="share-url">codebender.cc/sketch:129292</div> </div> </div> <script type="text/javascript"> $(function () { $('#share-url').on('copy', function (event) { var url = $(this).text().trim(); event.originalEvent.clipboardData.setData('text/plain', 'https://' + url); event.preventDefault(); }); }); </script> </div> </div> <div id="sketch-view-description"> <div id="short-description-container"> <div id="short-description-placeholder">This sketch is missing a short description</div> </div> <div id="description-container"> <div id="description"> </div> </div> <div id="description-toggle-container"> <img src="/images/trigger.svg?v56"> <a id="description-toggle-button" href="javascript:void(0)"> <div id="description-toggle-button-text">More</div> <i id="description-toggle-button-icon" class="fa fa-arrow-down"></i> </a> </div> </div> <div class="sketch-view-content"> <iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/sketch:129292" frameborder="0"></iframe> <div class="embed-code embed-sketch"> <p class="embed-code-title"> <i class="fa fa-code"></i> Embed This Sketch </p> <p class="embed-code-body">Use the following HTML code to embed the sketch code above in your blog or website.</p> <style type="text/css"> .embed-sketch-share-code { padding: 15px; color: #b2b2b2; font-size: 12px; font-weight: normal; border: 1px solid #b2b2b2; word-wrap: break-word; word-break: break-all; white-space: pre-wrap; } </style> <div class="embed-sketch-share-code"><iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/sketch:129292" frameborder="0"></iframe> </div> </div> <hr class="embed-code-separator"> <iframe style="height: 470px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/serialmonitor" frameborder="0"></iframe> <div class="embed-code embed-serialmonitor"> <p class="embed-code-title"> <i class="fa fa-terminal"></i> Embed The Serial Monitor </p> <p class="embed-code-body">You can also embed the Serial Monitor section! Just use this HTML code.</p> <style type="text/css"> .embed-serialmonitor-share-code { padding: 15px; color: #b2b2b2; font-size: 12px; font-weight: normal; border: 1px solid #b2b2b2; word-wrap: break-word; word-break: break-all; white-space: pre-wrap; } </style> <div class="embed-serialmonitor-share-code"><iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/serialmonitor" frameborder="0"></iframe> </div> </div> </div> </div> <hr class="embed-code-separator"> <div class="row-fluid"> <div class="disqus-container"> <div id="disqus_thread"> </div> <script type="text/javascript"> var disqus_shortname = 'codebender-cc'; var disqus_container_id = 'disqus_thread';var disqus_developer = 1;var disqus_identifier = '/sketch:129292';var disqus_config = function () {this.page.remote_auth_s3 = "eyJpZCI6IiIsInVzZXJuYW1lIjoiIiwiZW1haWwiOiIiLCJhdmF0YXIiOiIiLCJ1cmwiOiIifQ== 488292b4731ba67bf30b8e4166d1fcf0a88e15b8 1618461027"; this.page.api_key = "iB7ulp06wIoZU1PwuvKErX3cnowIkq3hggivs290mMZsFTBwz0GSzxPY63e8gLdO";this.sso = {name: "codebender",icon: "https://codebender.cc/images/[email protected]?v56",button: "https://codebender.cc/images/[email protected]?v56",url: "https://codebender.cc/users/disqus/login",logout: "https://codebender.cc/logout",width: "400",height: "400"};}; /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> </div> </div> </div><!--/span--> </div><!--/row--> </div><!--/.fluid-container--> </div><!--/container--> <style type="text/css"> footer { width: 100%; position: fixed; left: 0; bottom: 0; background: #121212; z-index: 55; } </style> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script> <script type="text/javascript" src="//code.jquery.com/ui/1.11.2/jquery-ui.min.js"></script> <script type="text/javascript" src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script> <script type="text/javascript" src="/js/dropzone.min.js?v56"></script> <!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src=/walkthrough/lawnchair-0.6.4.min.js?v56></script> <script src="/bootstrap-filestyle.min.js?v56" type="text/javascript"></script> <script type="text/javascript"> (function () { var p = [], w = window, d = document, e = f = 0; p.push('ua=' + encodeURIComponent(navigator.userAgent)); e |= w.ActiveXObject ? 1 : 0; e |= w.opera ? 2 : 0; e |= w.chrome ? 4 : 0; e |= 'getBoxObjectFor' in d || 'mozInnerScreenX' in w ? 8 : 0; e |= ('WebKitCSSMatrix' in w || 'WebKitPoint' in w || 'webkitStorageInfo' in w || 'webkitURL' in w) ? 16 : 0; e |= (e & 16 && ({}.toString).toString().indexOf("\n") === -1) ? 32 : 0; p.push('e=' + e); f |= 'sandbox' in d.createElement('iframe') ? 1 : 0; f |= 'WebSocket' in w ? 2 : 0; f |= w.Worker ? 4 : 0; f |= w.applicationCache ? 8 : 0; f |= w.history && history.pushState ? 16 : 0; f |= d.documentElement.webkitRequestFullScreen ? 32 : 0; f |= 'FileReader' in w ? 64 : 0; p.push('f=' + f); p.push('r=' + Math.random().toString(36).substring(7)); p.push('w=' + screen.width); p.push('h=' + screen.height); var s = d.createElement('script'); s.src = '/js/whichbrowser/detect.js?v56?' + p.join('&'); d.getElementsByTagName('head')[0].appendChild(s); })(); function createLog(actionId, metaData, callback) { if (typeof callback === 'function') { callback(); } } function setOperationOutputMessage(message) { var $cbCfOperationOutput = $('#cb_cf_operation_output'); $cbCfOperationOutput.html(message); if (message.length > 0) { $cbCfOperationOutput.removeClass('new-message').width(); $cbCfOperationOutput.addClass('new-message'); } } $(document).on('click', '.close-flash-notice', function (event) { $(event.target).closest('.alert').remove(); }); /** * compilerflasher URLs * @type {String} */ if (typeof window.codebender !== 'object') { window.codebender = {}; } window.codebender.compilerflasher = { staticPlugin: 'https://codebender.cc/static/plugin', pluginMsi: 'https://codebender.cc' + '/Codebendercc.msi', pluginXpi: 'https://codebender.cc' + '/codebender.xpi', utilitiesCompile: "https://codebender.cc/utilities/compile/", bootloader: 'https://codebender.cc' + '/bootloader/', listBoards: "https://codebender.cc/board/listboards", listProgrammers: "https://codebender.cc/board/programmers", bfFirefoxClient: "/embed/bf-firefox-client.js?v56", iframeChromeClient: "/embed/iframe-chrome-client.js?v56", chromeClient: "/embed/chrome-client.js?v56", cbAgent: "/embed/cb-agent.min.js?v56", serialMonitorSection: "\x3Cstyle\x3E\x0A\x20\x20\x20\x20\x23serial_monitor_content\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20display\x3A\x20none\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23serial_hud\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20overflow\x2Dy\x3A\x20auto\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23serial_monitor_hud_and_autoscroll\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20display\x3A\x20inline\x2Dblock\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23serial\x2Dchecboxes\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20display\x3A\x20inline\x2Dblock\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23serial\x2Dchecboxes\x20\x3E\x20label\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20margin\x2Dbottom\x3A\x200\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23autoscroll_label\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20position\x3A\x20relative\x3B\x0A\x20\x20\x20\x20\x20\x20\x20\x20top\x3A\x208px\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23autoscroll_check\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20display\x3A\x20block\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23echo_label\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20position\x3A\x20relative\x3B\x0A\x20\x20\x20\x20\x20\x20\x20\x20top\x3A\x203px\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20.serial\x2Dmonitor\x2Decho\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20display\x3A\x20inline\x2Dblock\x3B\x0A\x20\x20\x20\x20\x20\x20\x20\x20color\x3A\x20\x23FF0000\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x0A\x20\x20\x20\x20\x23serial\x2Dline\x2Dendings\x20\x7B\x0A\x20\x20\x20\x20\x20\x20\x20\x20width\x3A\x20130px\x3B\x0A\x20\x20\x20\x20\x20\x20\x20\x20margin\x2Dbottom\x3A\x2010px\x3B\x0A\x20\x20\x20\x20\x7D\x0A\x3C\x2Fstyle\x3E\x0A\x0A\x3Cdiv\x20class\x3D\x22serial\x2Dmonitor\x2Dcontainer\x22\x3E\x0A\x20\x20\x20\x20\x3Cdiv\x20id\x3D\x22serial_monitor_content\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x3Cdiv\x20id\x3D\x22serial_monitor_hud_and_autoscroll\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x3Cspan\x20id\x3D\x22serial\x2Dchecboxes\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Clabel\x20id\x3D\x22autoscroll_label\x22\x20class\x3D\x22checkbox\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Cinput\x20id\x3D\x27autoscroll_check\x27\x20type\x3D\x22checkbox\x22\x20checked\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Autoscroll\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Flabel\x3E\x0A\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Clabel\x20id\x3D\x22echo_label\x22\x20class\x3D\x22checkbox\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Cinput\x20id\x3D\x27echo_check\x27\x20type\x3D\x22checkbox\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Echo\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Flabel\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fspan\x3E\x0A\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Cselect\x20id\x3D\x22serial\x2Dline\x2Dendings\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Coption\x20value\x3D\x22nle\x22\x3ENo\x20line\x20ending\x3C\x2Foption\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Coption\x20value\x3D\x22nl\x22\x3ENewline\x3C\x2Foption\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Coption\x20value\x3D\x22cr\x22\x3ECarriage\x20return\x3C\x2Foption\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Coption\x20value\x3D\x22nlcr\x22\x20selected\x3D\x22selected\x22\x3EBoth\x20NL\x20\x26\x20CR\x3C\x2Foption\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fselect\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fdiv\x3E\x0A\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x3Cdiv\x20class\x3D\x22input\x2Dappend\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Cinput\x20id\x3D\x22text2send\x22\x20type\x3D\x22text\x22\x20placeholder\x3D\x22Type\x20a\x20message\x22\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20onkeydown\x3D\x22compilerflasher.pluginHandler.serialSendOnEnter\x28event\x29\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3Cbutton\x20id\x3D\x22serial_send\x22\x20onclick\x3D\x22compilerflasher.pluginHandler.serialSend\x28\x29\x22\x20class\x3D\x22btn\x22\x20title\x3D\x22Send\x20Message\x22\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Send\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fbutton\x3E\x0A\x20\x20\x20\x20\x20\x20\x20\x20\x3C\x2Fdiv\x3E\x0A\x20\x20\x20\x20\x3C\x2Fdiv\x3E\x0A\x0A\x20\x20\x20\x20\x3Cpre\x20id\x3D\x22serial_hud\x22\x20class\x3D\x22well\x22\x3E\x3C\x2Fpre\x3E\x0A\x3C\x2Fdiv\x3E\x0A" }; window.codebender.algolia = { applicationKey: 'DA86WRM5TA', searchOnlyKey: '8594006ceb348fc84829b4290adcb0f3', prefix: 'cb_live', image: '/images/algolia.png?v56' }; </script> <script src="/js/algolia.min.js?v56"></script> <script src="/js/typeahead.js?v56"></script> <script src="/js/hogan.js?v56"></script> <script type="text/javascript" src="/cache/js/common.js?v56"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-36583501-1', 'codebender.cc'); ga('send', 'pageview'); </script> <script src="/js/Markdown.Converter.js?v56" type="text/javascript"></script> <script type="text/javascript" src="/cache/js/project.js?v56"></script> <script type="text/javascript"> window.shortDescription = ''; </script> <script type="text/javascript"> setTimeout(function () { var a = document.createElement("script"); var b = document.getElementsByTagName("script")[0]; a.src = document.location.protocol + "//dnn506yrbagrg.cloudfront.net/pages/scripts/0020/3051.js?" + Math.floor(new Date().getTime() / 3600000); a.async = true; a.type = "text/javascript"; b.parentNode.insertBefore(a, b) }, 1); </script> </body> </html> |
2-Hours Up!
Z:38 – Well, I didn’t make the 2-hour deadline. The last hour was spent unsuccessfully fumbling around a Batch script trying to read my COM port. I’m going to check out powershell and give myself some extra time.
1st Overtime
A:05 – PowerShell made it no problem. I now have a working butter-smooth volume knob! Yes it is ugly, but the only criteria was functionality. Plus, I might need another 2-hour project sometime soon.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$oldval = 0 while (1 -eq 1){ $port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one $port.open() $val = $port.ReadLine() If($val -ne $oldval) { ECHO $val $CMD = './nircmd.exe' $arg1 = 'setsysvolume' $arg2 = $val & $CMD $arg1 $arg2 ECHO $CMD $arg1 $arg2 } $oldval = $val $port.Close() } |
My original plan worked out pretty well, with the exception of trying to read a COM port in a Batch script. This was a pretty straightforward and forgiving project to attempt in 2 hours. But it is exactly the kind of project that wouldn’t get done without this kind of push.