Arduino

Arduino as a MIDI/Bluetooth Relay for Windows 8.1 Apps

In my last post I described how a Bluetooth connection between Arduino and a Windows 8.1 device can be established. The next step for me was to connect the Arduino to my electronic drum kit which has both, a MIDI-IN and a MIDI-OUT jack, but any other electronical instrument will do as well. The wiring diagram for an Arduino Uno R3 with MIDI-IN/OUT and the JY-MCU Bluetooth module is shown in Fig.1. NOTE: Occasionally there are MIDI shields available for Arduino, so you might not have to build it on your own. The Arduino code to relay MIDI>Bluetooth and Bluetooth>MIDI is actually quite simple. //======================================================authorship //by Michael Osthege (2013) //======================================================includes #include “SoftwareSerial.h” //======================================================constants const int TX_BT = 10; const int RX_BT = 11; const int MIDI_TX = 1; const int MIDI_RX = 0; //======================================================bluetooth setup SoftwareSerial btSerial(TX_BT, RX_BT); //======================================================initialization void setup() {     Serial.begin(31250);     btSerial.begin(9600);     Serial.println(“Bluetooth initialized”); }…

C#

A Custom (Async) MessageBox for WPF and Windows Phone

The System.Windows.MessageBox provided by .NET is limited to a very small set of MessageBoxButtons (Yes/No/OK/Cancel) which do not allow for custom Button texts. The System.Windows.Forms.MessageBox also blocks the UI thread, which can be an annoying disadvantage as well. The MessageBox on Windows Phone has the same disadvantages. Custom buttons in a MessageBoxe simplify the decision for the user, because they can describe the results of the action: However you need to do this with a custom control, so for WPF as well as Windows Phone I designed a simple method for asynchronously showing a MessageBox with custom buttons. (The WPF implementation based on this control by Evan Wondrasek) So let’s bring some sample code.In WPF you can use multiple custom buttons: And on Windows Phone you’re limited to 2 buttons: To use CustomMessageBox, you need to get TCD.Controls from NuGet: And on Windows Phone 7.x you also need async support,…

Root

DIY laser-shooting range

This is probably the first post on (hopefully) a series of ‘offtopic’ posts covering cool things I’ve done and consider worth sharing. It’s about a side project we did more than two years ago, while working on multitouch tables and IR technology. At first we incorporated a 780 nm infrared laser into a plastic MP5 soft-air toy gun. The laser perfectly fit into the barrel (Fig. 1a). Two 1.5 V batteries were placed inside the hold (Fig. 1b) and wired with a 25 V/470 µF, a switch and the laser (Fig. 2). The idea behind using a capacitor is to prevent continuous firing of the laser, most importantly as a security measure. The assembled MP5 laser gun can then be used to fire light bursts of a few milliseconds. To track the infrared light spots on a projection surface, we used a modified Hercules Classic Silver webcam. It’s a very cheap model (only 320×240 pixels) but it features a M12 lens with integrated IR filter which…

Hardware

2 months Surface RT – some thoughts from scientists perspective

There are countless reviews on the Surface RT already, but I consider myself some kind of non-average user, so I’d like to share my experience too. To understand my argument on the device, you should know: Who I am I am a undergraduate Biology student from Germany with some experience in WPF/Multitouch/Kinect/Windows Phone/Windows 8 development using C#. Most software I write is just for personal use, but I published some of my work (WP7, Win8) as well. Since the launch of the first public beta, I‘ve been using and developing for the Windows 8 platform, so I have a reasonable understanding of what’s going on. The Surface RT is my very first tablet computer. I’ve considered to get other devices (HP ElitePad, Samsung – ARM as well as x86), but decided that the Surface RT was the best fit. Everyday tasks Just like my HTC Mozart, I use the Surface…

C#

Localizing Enums (in a ComboBox)

Enums have many useful applications and are often used in CoboBoxes to let the user select things. In the code behind the enum values are often defined using more or less cryptic text, because neither spaces, special characters, or leading numbers can be used in enum values (for good reasons!). Therefor it is necessary to change the text to something more understandable (language-localized in some cases). One way to achieve this is to create the ComboBox items manually, but it’s much more comfortable to fill the ComboBox items directly with the enum values, because you can get/set the SelectedItem without converting it back and forth from/to the enum value. You can’t override the .ToString() method of the Enum type, so we have to come up with another solution. Just like any other control, the ComboBox uses a Template to create its items. We will replace the default template with one…

Bio

03 Der Needleman-Wunsch-Algorithmus

Einführung in die Bioinformatik Vorbereiten der Software Grundlagen der objektorientierten Programmierung Einfaches Codebeispiel – manipulieren eines strings Referenzieren einzelner Zeichen in einem string Generieren einer zufälligen Aminosäure-Sequenz Scoring von Alignments Prüfen auf Identität Bewerten von Mutationen – Substitution Matrix Bewerten eines Alignments Der Needleman-Wunsch-Algorithmus Die F-Matrix (abstrakt) Auswählen des Alignments (abstrakt) F-Matrix (Code) Auswählen des Alignments (Code) Die F-Matrix (abstrakt) Der Needleman-Wunsch-Algorithmus geht bei der Berechnung des idealen Alignements in zwei Schritten vor, um exponentiell skalierende Rechenzeit zu vermeiden. Zunächst wird die sogenannte F-Matrix berechnet, aus welcher anschließend das ideale Alignment zusammengesetzt wird. Zur Veranschaulichung alignen wir die Sequenzen GACFC und GCFHC. Jedes Feld in der Matrix (jede Zelle der Tabelle) beinhaltet einen Score. Diese Punktzahl ist jene, die auf dem Weg zur Berechnung des Feldes gesammelt wurde. Zur Berechnung einer Zelle sind immer die Felder links oben, oben und links notwendig: Unter den drei Feldern wird jenes gewählt, durch…

Bio

02 Scoring von Alignments

Einführung in die Bioinformatik Vorbereiten der Software Grundlagen der objektorientierten Programmierung Einfaches Codebeispiel – manipulieren eines strings Referenzieren einzelner Zeichen in einem string Generieren einer zufälligen Aminosäure-Sequenz Scoring von Alignments Prüfen auf Identität Bewerten von Mutationen – Substitution Matrix Bewerten eines Alignments Der Needleman-Wunsch-Algorithmus Die F-Matrix (abstrakt) Auswählen des Alignments (abstrakt) F-Matrix (Code) Auswählen des Alignments (Code) — coming soon Prüfen auf Identität Die einfachste Art, zwei Sequenzen miteinander zu vergleichen ist, zu prüfen, ob sie identisch sind. Dazu müssen jeweils die 0. Position der ersten Sequenz mit der 0. Position der zweiten, die 1. der ersten mit der 1. der zweiten und so weiter vergleichen werden: Der folgende Code macht genau das gleiche, verwendet dabei jedoch statt einer for-Schleife eine while-Schleife: Das Ergebnis einer solchen Prüfung kann offensichtlich nur zwei Werte annehmen: true oder false. Sowohl Mutationen, als auch Rasterverschiebungen führen bei dieser Methode zu einem ‘false‘: APFELSAFT APPELSAFT…

Bio

01 Einführung in die Bioinformatik

Gerade Biologen/Biotechnologen ohne Vorkenntnisse aus der Informatik, haben oft Probleme beim Verständnis grundlegender Verfahren der Bioinformatik. In einer kleinen Serie von Tutorials, werde ich versuchen, dieser Zielgruppe den Einstieg zu erleichtern. Die Codebeispiele folgen der Syntax der Programmiersprache C#, die abstrakten Verfahren können aber auf andere objektorientierte Programmiersprachen übertragen werden. (z.B. Java, C++, VisualBasic…) Die Theorie zu lesen ist zwar schön und gut, doch am Besten verstehen, was vor sich geht kann man, indem man es selbst macht. Ich empfehle jedem, die Codebeispiele nachzubauen, bzw. in echt nachzuvollziehen! Keine Sorge, du musst nicht alles selbst machen. Im folgenden findest du zunächst eine Anleitung, wie du dir die notwendige Software installierst. Anschließend kannst du ein bereits vorbereitetes Projekt herunterladen. Einführung in die Bioinformatik Vorbereiten der Software Grundlagen der objektorientierten Programmierung Einfaches Codebeispiel – manipulieren eines strings Referenzieren einzelner Zeichen in einem string Generieren einer zufälligen Aminosäure-Sequenz Scoring von Alignments Prüfen auf…

Root

Q&A App

Hey, When my professor put a machine-readable quiz on his website, I made an app for my Phone to do the quiz.. Today I ported it to the desktop and I’d like to share it: Download Q&A App.zip It requires .NET Framework 4.0. To feed it with questions, you need a text file (preferable in UTF-8 encoding) that follows these simple rules: question-answer blocks are separated by one empty line question-lines begin with ‘Q: ’ answer-lines begin with ‘A: ‘ category-lines begin with ‘C: ‘ multiple Q/A/C-lines per block are allowed There’s a sample file in the *.zip. You can load a file from your computer, or from a remote location (eg. a textfile in a public dropbox folder). have fun!

Root

Sync specific Folders with SkyDrive

Some of you may know, that I’m a huge fan of Dropbox, Windows Live Mesh and SkyDrive alltogether. Each of them has some exclusive features that I find most useful. This is the public sharing using a single URL of Dropbox, the cross-platform Features of SkyDrive (WP7…) and the feature to ‘select and sync’ any folder on your hard drive with Windows Live Mesh (in contrast to the quite unflexible syncing of just one folder). Well today on reddit, I came across a link to a blogpost… This guy, Jan Hannemann, had a genious idea: In the NTFS file system you can hard-link folders in a way that and application (such as Windows Explorer, or Windows Live Mesh) thinks that the folder is really there. These links are called folder-junctions and can be created using the command line. Fortunately he created an extension to the Explorers context menu that lets you do this in just two…