## Detecting a Waggle

I spent a long while thinking and discussing with others how a waggle could be detected. Two I guess opposite ideas were proposed:

1. Sine wave mapping : This involves smoothing in the incoming data of "delta X" values and then mapping a sine wave to it, if the two overlap within a degree of tolerance, then a waggle exists.
2. Simple Threshold : This is simply, if the "delta X" value passes a set threshold then we are in a waggle.

There are issues with both approaches, firstly the Sine wave mapping sounds good, but if the user speeds up the waggle then the frequency of the wave changes, and the mapping doesn't work. Secondly the simple threshold value doesn't work, we'd need multiples of the them, as the "delta X" values go from positive to negative. We'd also need to account of the time difference between the two. So it is not as simple as we first thought. Another solution is required.

# Temporarily a bit True

When a bit is roughly true, some of the time.

Imagine a jar, the top of the jar is completely open and sand can flow into it. The bottom of the jar has a small exit through which the sand must pass. Now imagine that upon this jar there is a line, a threshold. If the sand is above this line, then the jar is said to be true. If the sand is below this line, then the Jar is said to be false.

If we used, say 5 sand jars to record the waggle thresholds we would record in the first jar the fact that the "delta X" threshold has been passed by filling the jar up to it's brim. We'd then move on to the next Jar and wait for the "delta X" to pass the opposite threshold. If the first jar was filled because the "delta X" value was above the positive threshold, then the next jar will only be filled if the "delta X" threshold passes the negative threshold.

We would continue to do this for each of the 5 jars, when we reach the last jar, we would move back to the first and repeat.

If we were to watch all the jars and if any three of the five jars where above the threshold, and true. Then we could say that 'Yes, we are in a waggle'.

This approach is the time dependant threshold approach. Right now it's a concept, and now I have to code it and check to see if works...

# Getting the Waggle On

Development of the Waggle My Mouse application has been going well. I've over come a number of issues, I can now track the mouse pointer, and can capture the quick changes in the mouse pointers location. Two outstanding technical issues arise. These are:

1. How do draw a highlighted shape over the mouse pointer?
2. How do I know when the mouse has been waggled?

## Detecting a Mouse Waggle

I've done some Windows programming before and I've a fairly good idea that I can draw a shape over the mouse pointer. The biggest unknown after that was trying to determine what a waggle is, and recognising when I saw one. I've a little test bed win32 application that I've been playing it. I've been using this application to complete my investigations on the practical ability I have to write a mouse waggle utility. I modified this test bed tool to record the mouse pointer locations, and the Delta-X; the difference in the position between the X coordinate of the mouse pointer now, and when it was last recorded. I managed to capture a bucket load of data describing what a mouse shake (or waggle) looks like. I imported this data into excel to let me visualise the waggle.

The shape of the waggle became really quite easy to see. The next question is "How do I write a bit of code which can detect that waggle?". - Or at least that's what I thought the question was.

# Sharing the Waggle

I've a big fan of Justin Jackson with the Mega Maker podcast and Rob Walling and Mike Taber with the Startups for the Rest of Us podcast, and I was listening to them recently, when both shows made two really good points:

1. "How will I let people know about my idea?"

and

2. "How do I know what people think about my idea?"

That got me thinking.. "I really need to Share my Waggle". So I bought wagglemymouse.com. Feel free to check it out, there is nothing there right now. My next job is to create some content which concisely describes my idea and why it is a good thing, and encourages people to sign up to an email list, or follow me on twitter for updates. That's going to be my focus until the next Waggle my Mouse blog post.