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”
Pin Change interrupts on the Arduino have eluded me for awhile so when I finally figured them out last week, I also started messing with Pin Change Interrupts on the ATtiny. Unlike with the ATmega chips, examples are much harder to find for the ATtiny interrupts and even when you find them, I don’t think the quality is quite as good. So here is a simple guide to working with Pin Change Interrupts on the ATtiny85. Continue reading “Pin Change Interrupts on ATtiny85”
I recently needed to do some work with Pin Change Interrupts and it was a bit of a learning experience for me. As it turns out, they’re actually pretty easy. I’m posting this so that when I need to look it up in the future, I can easily find it and maybe I can help somebody else out too. Continue reading “Arduino Pin Change Interrupts”
I just got done wasting 10 very frustrating hours on a Interrupt Service Routine problem. In this case it was a pin change interrupt that causes the chip/board to reset. It turned out to be a simple capitalization error but luckily I also discovered some info about the AVR default ISR. I wanted to post it here in case somebody accidentally found it useful. Continue reading “AVR (& Arduino) Default ISR – Resetting Pin Change Interrupt Problem”