Here’s my solution to this week’s Riddler Express question from FiveThirtyEight. Here’s the question: “You place 100 coins heads up in a row and number them by position, with the coin all the way on the left No. 1 and the one on the rightmost edge No. 100. Next, for every number N, from 1 to 100, you flip over every coin whose position is a multiple of N. For example, first you’ll flip over all the coins, because every number is a multiple of 1. Then you’ll flip over all the even-numbered coins, because they’re multiples of 2. Then you’ll flip coins No. 3, 6, 9, 12 … And so on. What do the coins look like when you’re done? Specifically, which coins are heads down?”
A few years ago I was working on a project using a multi-rotor UAS to monitor weather. While out in the field, the user needed to be able to see the location of the UAS on a satellite map. The UAS had a GPS and was capable of transmitting that back to the laptop running custom ground station software; however, a constant connection to the internet would be necessary to get satellite maps from Google and many places this would be used won’t have a reliable signal. So I rolled my own solution to fetch the map from Google ahead of time and save it as an image file, which works fine since the location would be known in advance. The challenge was that I needed to have GPS coordinates associated with the image. Instead of having the GPS coordinates in a separate file, I decided to alter the pixels in the image to store the GPS coordinates so that only one file was necessary.
Over at One Mile At A Time, they did an analysis of the recent IHG Priceless Surprises Promotion where you could mail in 94 entrees and get back 94 plays in an online game. Most entrees only won 500 points but some won 1000, 2000, 5000, and a few won free nights or gift cards. I liked his analysis and it got me thinking about possible wins and the distribution. Instead of doing a bunch of math, it was easier to create a Monte Carlo Simulation and the results were a little surprising.
The best tip I can give for thesis writing is to use Latex. For large documents it will be far easier to use and look much better in the end. However, there is a bit of a learning curve with Latex and it does so much that it can sometimes be difficult to even know all the cool things it can do. This posts will cover some of the Latex tips and tricks I’ve learned while writing my thesis over the past
month year way too long. I’m not going to include all the stuff you usually see like how to include a figure or how to make things bold. I assume that you know how to use google and there are thousands of pages of tutorials for those common items. I’m just going to be discussing the lesser known tips that I found helpful for long documents like a thesis or dissertation.
I’ve been using I2C a lot lately and something that keeps popping up is the need to send large numbers. I2C normally only sends a single byte at a time so you are limited to 255 as the largest number. This post will show you how I break large numbers apart to send them over I2C and reassemble them on the other side.
I ran into a bit of a weird problem a little while back when using I2C on Arduinos. I friend also had the problem recently so I figured maybe it was common enough that this post could help other people. The problem occurs when you have the master request a certain number of bytes from the slave. Except when the slave sends the bytes back, they all show up as -1 except for the last one. Here is some example code and a workaround solution.
One of the most popular posts on my blog is this post about using rotary encoders on the attiny85. Unfortunately that post is mostly things I tried that didn’t work. A few months after writing that post I realized why it didn’t work and posted about that. And finally, I’ve figured out the solution, which you can see below. Continue reading “Rotary Encoder on the ATtiny85 – Part 2”