Random call sign buzzer

It took a while, but the code for making my Netduino generate random call signs is finally working. I kept getting randomly occuring argument out of bounds errors. With a bit of help, I finally realized the cause of my problem was in the 0-based array and me not counting the elements properly. Duh.

The code finally works, and now my Netduino will sit there and buzz out random “call signs” forever.

Now to work out how to implement some kind of mode selection for buzzing out Morse code.

Charleston Eats: Sunae’s Korean and Japanese Hibachi Grill

Stopped in to check out the relatively new Korean/Japanese restaurant that opened up on Johns Island in what used to be a fried chicken joint. It’s a very unassuming place and doesn’t look like much. The food was very good though. The bibimbop bowl was hot and very tasty with a spicy red hot sauce you can have on the dish or on the side.

Sunaes01.jpg

The beef bulgogi was pretty good, flavourful but a little bit on the dry side and lacking a bit in colour. 

Sunaes02.jpg

The usual side dishes that accompany many Korean side dishes (banchan) were very good as well.

Sunaes03.jpg

Definitely worth checking out if you’re in the area, and nice to see a little more diversity coming to the Johns Island eating scene.

Morse code buzzer

I mashed together my Morse Blinker code with the noise making code from the Getting Started with Netduino book to make my Netduino buzz out text in Morse code.

Like the Morse Blinker program, it takes a string provided in the morseText variable and buzzes it out on the little speaker that comes with the kit. Morse code speed is adjusted by changing the beatsPerMinute variable. I haven’t done any testing to figure out how the beatsPerMinute value translates to Morse code words per minute (wpm), but a value of 500 sounds to me like something around 20 wpm.


using System;
using System.Threading;
using System.Collections;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
namespace MorseBuzzer
{
public class Program
{
public static void Main()
{
// Text to Morse code conversion table
Hashtable morse = new Hashtable();
morse.Add('a', "a1a3");
morse.Add('b', "a3a1a1a1");
morse.Add('c', "a3a1a3a1");
morse.Add('d', "a3a1a1");
morse.Add('e', "a1");
morse.Add('f', "a1a1a3a1");
morse.Add('g', "a3a3a1");
morse.Add('h', "a1a1a1a1");
morse.Add('i', "a1a1");
morse.Add('j', "a1a3a3a3");
morse.Add('k', "a3a1a3");
morse.Add('l', "a1a3a1a1");
morse.Add('m', "a3a3");
morse.Add('n', "a3a1");
morse.Add('o', "a3a3a3");
morse.Add('p', "a1a3a3a1");
morse.Add('q', "a3a3a1a3");
morse.Add('r', "a1a3a1");
morse.Add('s', "a1a1a1");
morse.Add('t', "a3");
morse.Add('u', "a1a1a3");
morse.Add('v', "a1a1a1a3");
morse.Add('w', "a1a3a3");
morse.Add('x', "a3a1a1a3");
morse.Add('y', "a3a1a3a3");
morse.Add('z', "a3a3a1a1");
morse.Add('0', "a3a3a3a3a3");
morse.Add('1', "a1a3a3a3a3");
morse.Add('2', "a1a1a3a3a3");
morse.Add('3', "a1a1a1a3a3");
morse.Add('4', "a1a1a1a1a3");
morse.Add('5', "a1a1a1a1a1");
morse.Add('6', "a3a1a1a1a1");
morse.Add('7', "a3a3a1a1a1");
morse.Add('8', "a3a3a3a1a1");
morse.Add('9', "a3a3a3a3a1");
morse.Add(' ', " ");
morse.Add('.', "a1a3a1a3a1a3");
morse.Add(',', "a3a3a1a1a3a3");
morse.Add('?', "a1a1a3a3a1a1");
morse.Add('!', "a3a1a3a1a3a3");
morse.Add('/', "a3a1a1a3a1");
// Hashtable to store the notes
Hashtable scale = new Hashtable();
scale.Add("c", 1915u);
scale.Add("d", 1700u);
scale.Add("e", 1519u);
scale.Add("f", 1432u);
scale.Add("g", 1275u);
scale.Add("a", 1136u);
scale.Add("b", 1014u);
scale.Add("C", 956u);
scale.Add("D", 851u);
scale.Add("E", 758u);
scale.Add("h", 0u);
// Text to play in Morse code. Change this to whatever you want
string morseText = "ab4ug";
int beatsPerMinute = 500;
int beatTimeInMilliseconds = 60000 / beatsPerMinute;
int pauseTimeInMilliseconds = (int)(beatTimeInMilliseconds * 0.1);
PWM speaker = new PWM(Pins.GPIO_PIN_D5);
while (true)
{
foreach (char c in morseText)
{
// Get the Morse "song" corresponding to the current letter
string song = (string)morse[c];
for (int i = 0; i < song.Length; i += 2)
{
// Extract the note from the string
string note = song.Substring(i, 1);
int beatCount = int.Parse(song.Substring(i + 1, 1));
uint noteDuration = (uint)scale[note];
// Play the note
speaker.SetPulse(noteDuration * 2, noteDuration);
Thread.Sleep(beatTimeInMilliseconds * beatCount - pauseTimeInMilliseconds);
// pause for 1/10th of a beat
speaker.SetDutyCycle(0);
Thread.Sleep(pauseTimeInMilliseconds);
}
// Pause for one beat between each character
speaker.SetDutyCycle(0);
Thread.Sleep(beatTimeInMilliseconds);
}
// Pause for five beats before repeating
speaker.SetDutyCycle(0);
Thread.Sleep(beatTimeInMilliseconds * 5);
}
}
}
}

The latest version is over in my Github. I’ll probably spend some time redoing Morse code translation table to make changing the tone easier.

CyanogenMod 10.2 first impressions

First day with CyanogenMod 10.2 on the phone and it’s gone pretty well so far. There are a few things I miss from Samsung’s UI on Andriod, like being able to drop app icons into folders, but I can live without that. Just means an extra tap and swipe or two to find an app, and I’ll need to think about what application icons and widgets I want on the front screens.

Performance seems to be reasonably decent so far, without the slowness and lag I was experiencing before. Could still be from having a freshly wiped unit, so I’ll have to wait and see how things are a few months down the road. No issues with any of the applications I’ve installed yet. Everything runs and overall my Galaxy S2 is much more responsive, like it felt when I first got it.

The battery seems to drain faster, although that could be a combination of an aging battery and me playing with it more because it’s shiny and new. Something I’ll have to keep an eye on over the next little while.

Moving applications to the SD card seems quite a bit slower. Where it might have taken a few seconds with Samsung’s version, some applications took a minute or two before the move to the SD card finished. Not sure what the problem behind that is yet. On the other hand, clearing the application caches can be done with just one tap, which is a whole lot easier than going through each application individually.

Upgrading to Cyanogenmod

With my Galaxy S2 abandoned at Android 4.1.2 by both Samsung and T-Mobile, and performance starting to deteriorate, I decided it was time to bite the bullet and head into the world of custom ROMs. Decided to go with CyanogenMod because of their new simple installer.

Ran the Windows installer, connected the phone and after a few butt-clenching moments, the phone was booting into CM10.2 (Android 4.3.1).

It’s a little different, but so far seems to be working pretty well. Feels faster and more responsive, but that could just be from having a freshly wiped device. Will see how things go as I proceed with reinstalling apps and rearranging the screens to the way I like them.