I can't spot the problem. The new version of the sketch and schematic both look ok.
Try the new code again with this slight change to myDelay:
void myDelay(long t) {
for (long i = 0; i<= t; i++) {
delay(1);
}
}
This should behave just like the old version of the sketch. Does it?