Archive for the ‘Development Tools’ Category

Finished Code…

August 21, 2013 Leave a comment

This is the finished code for the Arduino project. I switched the code to use exclusive ORs to flip the settings and added a second switch detection block of code for the second switch. All in all, pretty easy.

I’m still waiting for some parts to arrive before I can construct the finished project but I don’t anticipate any problems other than it not physically fitting in the project box I have ordered!

#include <Bounce.h>

Arduino Uno based stomp box Midi controller for T.C. Electronics M300
Copyright David E. Ellis 2013

Switch one toggle patches 2 and 3
Switch 2 toggles dry and mixed signal


#define PATCH_SWITCH 4            // Pin 4 - Controls patch switch
#define BYPASS_SWITCH 5           // Pin 5 - Controls bypass (wet/dry)
#define PATCH_LED 12              // On=initial patch, off=alternate patch
#define BYPASS_LED 11             // on=bypass on (dry), off=bypass off (wet)
#define ALT_PATCH 3
#define WET 0                     // Hear effect (wet signal) when bypass is off
#define DRY 127                     // dry signal when bypass on

// patch control
byte cur_patch = INITIAL_PATCH;
byte old_patch = ALT_PATCH;
byte cur_patch_led = HIGH;                            // high = led on
byte old_patch_led = LOW;

// bypass control
byte cur_bypass = DRY;                                // initial state for bypass signal is on (dry signal)
byte old_bypass = WET; 
byte cur_bypass_led = HIGH;
byte old_bypass_led = LOW;

Bounce bouncer1 = Bounce(PATCH_SWITCH,5);            // setup 5 ms debounce on switch 1
Bounce bouncer2 = Bounce(BYPASS_SWITCH,5);            // ditto on on switch 2

// the setup routine runs once when you press reset:
void setup() {   
  Serial.begin(31250);                              // Set MIDI baud rate:
  selectPatch(INITIAL_PATCH);                       // Set inital patch number
  setBypass(DRY);                                   // Set bypass to on initially (dry signal)
  pinMode(PATCH_SWITCH,INPUT_PULLUP);                // Open switch is normally pulled high
  pinMode(BYPASS_SWITCH,INPUT_PULLUP);                // Open switch is normally pulled high
  pinMode(PATCH_LED, OUTPUT);                         // initialize the led pin as an output.
  digitalWrite(PATCH_LED, cur_patch_led);              // set to current state 
  pinMode(BYPASS_LED, OUTPUT);                         // initialize the led pin as an output.
  digitalWrite(BYPASS_LED, cur_bypass_led);         // set to current state

// the loop routine runs over and over again forever:
void loop() {

  // Switch 1 controls the patch
  if (bouncer1.update()) {                           // returns true if switch state changed (on or off)
    if (! {                          // if switch is pressed (input low)
      cur_patch=cur_patch^old_patch;                 // swap patch
      selectPatch(cur_patch);                        // send it
      cur_patch_led=cur_patch_led^old_patch_led;    // swap led status
      digitalWrite(PATCH_LED,cur_patch_led);        // send it

  // Switch 2 controls bypass (wet/dry mix)
  if (bouncer2.update()) {                           // returns true if switch state changed (on or off)
    if (! {                          // if switch is pressed (input low)
      cur_bypass=cur_bypass^old_bypass;              // swap bypass state
      setBypass(cur_bypass);                           // and set new state
      cur_bypass_led=cur_bypass_led^old_bypass_led;     // swap led status
      digitalWrite(BYPASS_LED, cur_bypass_led);         // and send it

void selectPatch(byte patchNum) {
  Serial.write(0xC0);                    // change patch command
  Serial.write(patchNum-1);              // patch '1' is really zero etc

void setBypass(byte mix) {
  Serial.write(0xB0);                    // CC
  Serial.write(0x51);                    // 81 - Bypass
  Serial.write(mix);                     // by on (127/dry) or off (0/wet)   
Categories: Coding, Development Tools Tags:

As if I don’t have enough projects….

August 14, 2013 Leave a comment

I’ve been playing around with an Arduino micro processor to build a small midi foot controller/stomp box for an effects unit in my synth rack unit. I just need it to be able to make the effects unit flip flop between two patches and also switch from a dry to a mixed signal.

This is the circuit for my prototype (just one switch so far to switch the patches):

ArduinoMidiSwitchCircuitAnd this is the code (oh look, more C!):

#include <Bounce.h>

Midi controller for M300
Switch one toggle patches 2 and 3
Switch 2 toggles dry and mixed signal

#define SWITCH1 4           // header P4, pin 3 - Controls patch switch
#define LED 13              // on board led on pin 13
#define ALT_PATCH 3

  int patch = INITIAL_PATCH;

Bounce bouncer1 = Bounce(SWITCH1,5);    // setup 5 ms debounce on switch 1

// the setup routine runs once when you press reset:
void setup() {   
  Serial.begin(31250);                  //  Set MIDI baud rate:
  selectPatch(INITIAL_PATCH);           // Set inital patch number
  pinMode(SWITCH1,INPUT_PULLUP);        // Open switch is normally pulled high
  pinMode(LED, OUTPUT);                 // initialize the led pin as an output.
  digitalWrite(LED, HIGH);              // led on = initial patch  

// the loop routine runs over and over again forever:
void loop() {

  if (bouncer1.update()) {               // returns true if switch1 state changed (on or off)
    if (! {              // if switch is pressed (input low)
      if (patch == INITIAL_PATCH) {      // if current patch = initial patch
        selectPatch(ALT_PATCH);          // swap to alt patch
        patch=ALT_PATCH;                 // remember it
        digitalWrite(LED, LOW);          // led off = alt patch
      else {                             // current patch = alt patch
        selectPatch(INITIAL_PATCH);      // swap to inital patch
        patch=INITIAL_PATCH;             // remember it
        digitalWrite(LED, HIGH);         // led on = inital patch


void selectPatch(int patchNum) {
  Serial.write(0xC0);                    // change patch command
  Serial.write(patchNum-1);              // patch '1' is really zero etc

I am going to look at using Exclusive ORs to replace the ‘state’ code and LED flip flopping but for now this works very well. Hook up another switch, bit more code and the prototype will be done.

Total turn around time so far to get to this point (including installing the compiler and research), about an hour!

Makes the iPhone programming look ridiculously hard (still trying to figure out how to fix a memory leak. I know where it is, just not how to fix. very frustrating!).

Categories: Coding, Development Tools Tags:

Upgraded my ‘virtual Mac’…

August 4, 2013 1 comment

I’ve been using an Xcode plan from for a little while but now I need to be able to install other software so that I can generate data for my app and the trouble with the Xcode plan is that you don’t have admin authority. They did say they could install anything I needed but there are a number of other limitations with the Xcode plan that mean that while it has been great for getting started with iOS development, it’s now time to upgrade to a more serious plan.

So I’ve gone for one of their Virtual Private Desktop plans. My wife did  say I could go and get a Mac but I figure that since I am still not totally committed to this yet and still in ‘play’ mode pretty much, I could buy a LOT of months on a virtual machine for the price of a new iMac (plus I object to paying a premium for ‘style’). There are other advantages to the new plan too apart from more storage and more memory. I can use TeamViewer to connect to the desktop instead of vanilla VNC. TeamViewer is free for non commercial use (which this definitely is right now), it performs better than VNC and has encryption, something that I was never able to enable using VNC to the Xcode desktop. The new image also has ADMIN privileges so I can install stuff from iTunes! and since it is a personal desktop, not shared like with the Xcode plan, the iOS simulator is no longer shared. not that it was ever an issue for me but I don’t have to shut it down after every use now either.

The hardest part of the whole process was probably transferring my development certificates from the old Xcode machine to this new one. Apple seem to be as useless as everyone else in explaining this whole process in terms a numbskull like me can understand but I seem to have managed it now. I rebuilt my app on the new machine and managed to install it on my iPod and run it so I ‘think’ I am good to go.

Anyway I’ve ‘committed’ to the new environment by cancelling my Xcode plan from the next billing cycle which is  in a few days. After that, if I messed up, I gotta fix it the hard way (or hope I backed it up!).


July 12, 2013 Leave a comment

I have managed to get my very rudimentary iPhone app onto my physical device.  Not the easiest or simplest process in the world since the app icons and launch splash screens gave me a lot of trouble. Some stuff is just not as intuitive as I think it should be and while these things were not an error as such, how the heck was I suppose to know since it did not look ‘right’ (like no application icon when I added the app the iTunes prior to loading it into the device).

Still, I appear to have overcome that hurdle now so I can get back to actually trying to write some real working code. Initially I just want to display some help (seems like a good starting place) and using a PDF seems like a good way to deliver it but the standard way of displaying a PDf in iOS (in a web page) is pretty crappy from a user experience point of view so it looks like I am going to have to investigate some alternative options provided by both free and commercially available frameworks. Such fun!

Categories: Development Tools, iPhone

iPhone Frustrations…

July 9, 2013 Leave a comment

Part of the deployment process for iOS apps is that they must be signed, even just for testing, on a physical device and there’s a whole procedure for creating all the parts you need to do that. The problem is that all the descriptions to do this assume you are using a Mac. As in, a  real, physical mac, which of course I am not.

It’s taken a couple of days but I think I have managed to get all the certificates and keys I need in place so I created the provisioning profile and genned the app and transferred it all to my Windows box so that I could upload it to my iPod since of course that is all I have available to plug my iPod into.

The idea is that you drag the provisioning profile and app into iTunes (on my windows box in my case), connect the iPad and synch it and the app ‘should’ be installed on the device but no, nothing, nada, zilch and no indication as to why. In fact when I drag the app into the iTunes app library I don’t even see my nice artwork as the app icon so who knows what is going on at this stage.

I found lots of stuff on the web on this but in general most of it seems to be what I like to call ‘advanced guessing’ and based on older versions of xcode and iTunes so who knows what he procedure really is at this stage. I’ll try again soon when I’ve had time to find a more up to date solution to the whole issue.

Of course, the real solution would be to go buy a Mac.

Maybe that’s all part of Apple’s evil plan!

Categories: Development Tools

Back to the iPhone programming…

July 5, 2013 Leave a comment

Well, my adventures in iPhone programming continue. It’s not being helped at all by the crappiness of using VNC to access the remote MAC I am using. VNC just does not seem to be able to support some of the basic functions like control and drag that I need to use to get the most out of the xcode IDE. OK, so there are work arounds but even so!

Anyway, so far today I’ve managed to crash the iPhone emulator and completely screw up my simple test app (although I did fix it later).

Given the choice between Microsoft’s IDE and xcode I have to say that so far I think the MS one is far better. Maybe it’s just a matter of familiarity but you have to remember I don’t do this for a living (yet!) but I think I found creating applications using the MS IDE far more intuitive than using xcode, or maybe it’s the quality of the tutorials I am following. Mind you, the iPhone coding is not helped at all by the sheer strangeness of the way they have implemented the C ‘code’. It ‘looks’ like C but is it? Who knows. Certainly seems strange to me!

Anyway, onwards we go!


Categories: Coding, Development Tools

A little ‘light’ reading…

May 14, 2013 Leave a comment

My current reading…


As much as I am not a fan of C (I must do a post to explain why sometime)  and it’s variants I thought I would give it a chance, especially since I am trying to create an iOS app for the iPad (whose development language is more like smalltalk than C but it’s still ‘close’ in style).

So far I am about half way through the C++ book and I will admit that the presence of the string class alone and thus the removal for the need for functions like strcmp (that results in really strange code in my opinion since the return code logic is backwards as equality gives a zero return code which is ‘false’!) and memcpy (which is just plain dangerous in the wrong hands) is a vast improvement.

Unfortunately for me, most of my day to day work is in z/OS assembler or Metal C (mainly just reading it!) so not much opportunity to do ‘real’ code but hey, it’s all good in the end. No harm in learning new stuff.

As for the iOS book, I am still trying to get up to speed with using the xcode development environment on the remote mac system I am using. The main issue  so far has been that most of the xcode tutorials online use the click and drag method to connect things in the IDE but because I am accessing the machine using vnc, that does not work (apparently vnc does not support that) so I have spent most of tonight just finding alternative ways of achieving the same thing.

Who says us geeks are boring… LOL!

Categories: Coding, Development Tools

Developing in the cloud…

I want to create an app for my iPad. Well, to be truthful I was looking for an app to do a particular thing and amazingly, given all the apps out there, I could not find one that does what I wanted.  So it’s time to learn to write an app for the iPad.

Trouble is, I don’t have a Mac and the cheapest Mac Mini is north of $600 and while I ‘could’ go and buy one it just does not seem worth it at this point in time so I looked into virtual Mac’s out there in the cloud.

Turns out there are a few services that provide access in various forms to either ‘virtual’ Macs or to a ‘shared’ box (TSO on z/OS anyone?) and the prices seem pretty reasonable, especially for someone that just want to explore the platform and try a few things before committing to it.

So that’s what I am looking into right now. Well, that and how to develop iPad apps. I figure if kids can do it, I ‘should’ be able to too although there are no guarantees!

Since my app needs to talk to some hardware plugged into my iPad I have to be able to load it up to my iPad to run it so I am sure there a few hoops involved and no doubt Apple wants their pound of flesh as well to let me do that.

Now all I have to do is find a service I can use.

Categories: Coding, Development Tools

The case of the wrong case…

September 18, 2011 Leave a comment

This has been a bit of a detective story so I thought I’d mention it here in case it helps anyone.

As part of my efforts to move my web based ISPF interface to the stand alone IBM HTTP server I needed to run the REXX execs under USS. Now to be honest I rarely ever touch USS on z/OS but that’s where I needed to be so that’s where I am.

I typically write my REXX execs in lower case so I might end up with one exec invoking another with something like this:


Where myfunc is another REXX exec in the standard search order (SYSPROC and SYSEXEC typically). This works fine because even though the function name is written in lower case, REXX converts it to upper case and that matches the member name in the library just fine. Everything works great.

BUT! Move over to USS land and things are not so simple. REXX in USS land is case sensitive. Using the example above, I had created the ‘myfunc’ exec file  in USS with a lower case file name and was surprised when the calling exec could not find it.

Eventually (after two days) I found that by default, REXX makes function names coded like this into UPPER CASE before searching for them (I knew this, I had just forgotten about it) so REXX was searching for a file called ‘MYFUNC’ whilst the file I had created was called ‘myfunc’. Not the same animal in a case sensitive environment.

I could make all my exec file names upper case to address this, but in the event you need to call a lower case function name you can code it like this:


And amazingly it will now find the lower case exec file.

ISPF on the web – Version 2

September 15, 2011 2 comments

Just a quick update, more details and info to follow soon.

My initial iteration of ISPF on the web required the user to still log on to TSO/ISPF on a 3270 and then start the web server inside their TSO/ISPF session before accessing it via a browser.

Whilst this was an interesting exercise and learning experience, obviously it’s about as useful as a chocolate fireguard in practice.

Hence the move to version 2!

The UI experience in the browser is the same but the back end is significantly different, running inside the IBM stand alone HTTP web server.

I am still developing this in my spare time, but as soon as I get a demo up and running I shall be adding more information so stay tuned.