Motospeed CK62 – DO NOT BUY THIS KEYBOARD

I recently had the misfortune of buying the Motospeed CK62 (available on Aliexpress). It cost me 50 USD at the time of buying and was supposed to be my gateway in to the exotic world of 60% keyboards.

Looking at the features (Mechanical keyboard, RGB lighting, Bluetooth etc), this keyboard seems almost too good to be true. However, there’s one thing missing in this keyboard, COMMON SENSE!

Let me explain how 60% keyboards normally work. To save space and reduce the number of keys on the keyboard (~60 instead of 104), many of the keys serve multiple functions via what is known as Layers which can be activated by pressing a special modifier key called the function key (Fn key).

For example, it is normal in 60% keyboards to do away with the function keys and just have a row of keys for numbers. The function keys are on another “Layer” and to access them you press the Fn + 1. Similarly to access the up arrow key in a pinch, you press the Fn + W key.

That’s how most 60% keyboards do it. This one however only allows access to the other layers by toggling them. How you ask? BY PRESSING THE FN+1 KEYS AND HOLDING FOR 5 SECONDS!!!

To toggle it back, you press the keys and hold them again FOR 5 SECONDS!!! This renders the keyboard absolutely useless for pretty much all purposes. I don’t know who designed the firmware on this keyboard, but I bet there’s a special place in hell for people like her/him.

If you want to try a 60% budget mechanical keyboard, I would recommend the Anne Pro 2. It is a bit more expensive but isn’t made by Satan himself. It has very good reviews on Youtube as well.

tl;dr – DO NOT BUY THE MOTOSPEED CK62.

PS: The CK61 isn’t as bad as the CK62 as in it toggles the layers as soon as you press the combinations, but it’s still a bad user experience as it only allows for toggling. It doesn’t allow you to simply use the modifier key to switch the layers. I would not recommend the motospeed CK61 either.

KiCAD – Creating a custom component with the same name as an existing component

Short Answer – change the name to be unique!

Long Answer – I was creating my own version of the 74HC595 shift register in KiCad and named it exactly that. When adding it to my own library, and using it in my schema, it kept showing me the stock version. So the fix to this was to right-click on the name in the component editor and change it to something else – “MY74HC595” and save. Hey presto! Problem solved ๐Ÿ™‚

Android and Arduino Serial Bluetooth App – BlueSerial

I’ve finally been able to figure out the entire Bluetooth API of Android and I felt it was more difficult than writing Arduino code in Assembly. In it’s current avatar, I think it’s ready for a Beta release. Based on the feedback I receive, I’ll make a few changes and release the code and put it on the Android Play Store (for which I still need to register a developer account).

A quick how-to about the app – The app can be used to communicate with serial (RX-TX/UART) bluetooth devices. This largely includes devices that are used to control microcontrollers and other electronic projects which use bluetooth to send and receive information. I developed this app to use with a bluetooth enabled robot that I had been dying to build for quite some time now. I think it’s pretty self-explanatory and if it’s not, then I need to work a bit more on it. Continue reading

Check if Binary tree is balanced or not

A quick interview exercise is to write code that checks whether a binary tree is balanced or not. Since a binary tree just begs for recursion, I decided to try it out in Scala. Takes less number of lines than I thought it would and it works. Logic works like this:

  1. If left node and right node are empty, tree is balanced
  2. If neither node is empty, just check that both left and right nodes are balanced
  3. If left node is empty, then right node can go down at most one more level
  4. If right node is empty, then left node can go down at most one more level

Hereโ€™s the code for it:

class Tree(val left: Tree, val right: Tree)

def isBalanced(tree: Tree): Boolean = {
  if (tree.left == null && tree.right == null)
    true
  else if (tree.left != null && tree.right != null) {
    isBalanced(tree.left) && isBalanced(tree.right)
  } else if (tree.left != null && tree.right == null) {
    tree.left.left == null && tree.left.right == null
  } else {
    tree.right.left == null && tree.right.right == null
  }

}   

 

How to kill a vbscript running the sendkeys command

It is nearly impossible to stop a wild VBScript running amuck with the sendkeys command on windows. To be sure you can always attempt to open windows taskbar and try to kill the process, if you know its name and if the script gives you enough time to open the taskbar and kill it. But in my experience its impossible to do that without creating a whole mess with sendkeys and sometimes, the only way out is to quickly open or switch to a text editor and wait patiently until it ends.

Scripts that I run frequently, I usually put them in my Quick launch bar so I can kick them off without having to switch windows. The AppActivate() command activates the right window for the script to work on. AppActivate unfortunately doesn’t restore windows if they are minimized. You might have realised this the hard way, as did I, when minimizing all windows and trying to trigger the script from the desktop.

Since VBScript doesn’t provide it’s own way to kill runaway sendkeys commands, it’s up to us to stop it. Every script that I write looks for a file called ‘stopscript.txt’ on the desktop, once every few times the sendkeys is called. If the file exists, it stops and no more sendkeying after that. To create that file, I’ve written another script whose only job is to create an empty file called ‘stopscript.txt’ on the desktop if it doesn’t exist. This script is also placed in my quick launch so it can be started quite easily. So whenever a sendkeys script starts behaving weird, I just start this script and the other one terminates instantly. I’ve found this technique to be a lifesaver in many situations. However, it does require that you be careful and call the file checking function at the right places when developing your script.

Also, always have an empty notepad window open when working with sendkeys. If it goes amuck, you can capture most of the bad commands by bringing the notepad window into focus. This is just another precaution :). Also, you can have your main script delete the stopscript.txt file at the very beginning so that you don’t have to manually switch to the desktop and delete it yourself. To stop it again, click on the stopping script.

VBScript is by no means a great solution for sendkeys automation. There are several professional tools available which can achieve the same. But VBScript comes for free on a windows machine. And when working with clients, sometimes you’re not allowed to install anything on the system and that’s when VBScript comes in handy as the poor man’s automation tool!

Links:

Checking if a file exists and creating it in VBScript

LED Sequencing using Arduino Uno

I’ve recently taken an interest in Hobby Electronics after reading a lot about Arduino. Being a software guy, I’ve always had difficulty getting my head around practical electronics. But after searching a bit around, I came across these two lecture series on Youtube:

Jeremy Blum’s Arduino tutorials

Prof. T S Natarajan’s Basic Electronics tutorials

And bit-by-bit I’m able to make sense of electronics.

Anyways, the best part of Arduino is that is very programmer friendly. Easier to program all this stuff than to do it using hardware components. Here’s a video of LED Sequencing using Arduino Uno. It consists of 12 LEDs connected to 1K/220 Ohm resistors to pins 1-12 on the Arduino. Setting up the breadboard and connections is very straightforward.

You can download the Arduino source code from here:ย View/Download code for LED Sequencing