Thanks Robin2, tried your suggestions but it still only takes one photo and doesn't do a repeat photo every 6 sec.
Note that I had to comment out #include "dl_lib.h" as it doesn't compile unless this is done.
Also I had to copy the line camera_fb_t * fb = NULL; into my takepic function.
Maybe when you get some time you might find a solution. In the meantime I will persevere with it.