<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>c++ &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Sun, 09 Jul 2023 15:05:29 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>c++ &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[How to make the Watchy vibrate]]></title>
		<link>https://shkspr.mobi/blog/2023/07/how-to-make-the-watchy-vibrate/</link>
					<comments>https://shkspr.mobi/blog/2023/07/how-to-make-the-watchy-vibrate/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 09 Jul 2023 11:34:42 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[watchy]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=46247</guid>

					<description><![CDATA[I am enjoying playing with the eInk Watchy. It is a cute package and is everything I want in a Smart-Watch; geeky, long battery life, and not obnoxious.  But - fuck me! - the documentation is atrocious! Well, that&#039;s a lie. There is no documentation. It has the &#34;Chat to us on Discord&#34; anti-pattern that infects so many otherwise great projects.  So I&#039;m left to figure out how to make the Watchy&#039;s…]]></description>
										<content:encoded><![CDATA[<p>I am enjoying playing with the eInk Watchy. It is a cute package and is everything I want in a Smart-Watch; geeky, long battery life, and not obnoxious.</p>

<p>But - fuck me! - the documentation is atrocious! Well, that's a lie. There is no documentation. It has the "Chat to us on Discord" anti-pattern that infects so many otherwise great projects.</p>

<p>So I'm left to figure out how to make the Watchy's haptics work.</p>

<p>The example watchfaces have a file called <code>settings.h</code> which contains <a href="https://github.com/sqfmi/Watchy/blob/342eb48a497eb3dcb1ec03c5c156937fdec07ba9/examples/WatchFaces/7_SEG/settings.h#L24"><code>.vibrateOClock = true</code></a>. Set that and you'll get a little buzz on the hour, <em>every</em> hour.</p>

<p>But how do you make it buzz when you've hit your step-count goal? Or when the time is 13:37? Or whenever <em>you</em> want?</p>

<p>There's no documentation. And searching the code for "vibrate" or "vibe" or "vibration" yielded nothing.  But I accidentally typo'd my search and entered "vib" - and that did the trick.</p>

<p>In <code>config.h</code> there's this line: <a href="https://github.com/sqfmi/Watchy/blob/342eb48a497eb3dcb1ec03c5c156937fdec07ba9/src/config.h#L25"><code>#define VIB_MOTOR_PIN 13</code></a>.</p>

<p>So, pin 13 is wired in to the vibration motor. We can add that line to our own config file. But how do we turn the buzzer on and off?</p>

<p>With a bit of help from Discord, it became clear:</p>

<pre><code class="language-c">pinMode(VIB_MOTOR_PIN, OUTPUT);     // Set vibration motor pin as an output.
digitalWrite(VIB_MOTOR_PIN, true);  // Enable vibration motor
delay(150);                         // Vibe for 150 ms.
digitalWrite(VIB_MOTOR_PIN, false); // Disable vibration motor.
delay(500);                         // Wait half a second
digitalWrite(VIB_MOTOR_PIN, true);  // Enable vibration motor
delay(250);                         // Vibe for quarter of a second
digitalWrite(VIB_MOTOR_PIN, false); // Stop vibrating
</code></pre>

<p>That's the same as the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate">HTML5 Vibrate API</a> - you can't control the intensity, but you can <a href="https://shkspr.mobi/blog/2014/01/malicious-use-of-the-html5-vibrate-api/">program your own vibration patterns</a>.</p>

<p>I just don't understand why hardware vendors are <em>so</em> crap at writing documentation. Don't they like people using their products?</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=46247&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2023/07/how-to-make-the-watchy-vibrate/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
