Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Why do 32U4 based Robot have programming problems!

Hi all,
Not sure if this is software Windows!! problem. But last year I got a Sparki robot this was based on the 32U4 controller and it worked fine for a few days, then I just couldn’t upload any code to it. I had installed all the right drivers, boards, etc.
Now I have had my NEW Zumo 2304led and the same has happened again!! The code compiles OK but then I try to upload the code I get a message saying I don’t have access to the com port (USB/COM) Access denided!!! or programmer not found. I am the only user of this PC, Again thibk I’ve got the drivers right, etc.

Any help would be very useful…


Hello, Mel.

I cannot speak for the Sparki robot since we do not make or carry that (and the similar problems you are having with it might have nothing to do with the ATmega 32U4 in particular), but have you tried any of the methods described in the “Reviving an unresponsive Zumo 32U4” section of the Zumo 32U4 Robot user’s guide to see if you can get the Zumo working again? The most straight forward method is probably “The uploading-before-bootloader method” in the “Reviving using the Arduino IDE” section.

If you try that and it does not work, could you explain what happens when you go through it and where it goes wrong? If you receive any error messages a screen shot would probably be useful.


Hi Brendon,
Thanks for your help!! The first method worked after a couple of tries, that is wait for the download and hit the reseta couple of times. I was then able to re-install the OLED demo program.
But now I must start on a new coding project to get this Zumo doing something, all good fun when it’s FUN otherwise a pain in the…

Regards to all.


Hi All,
Well it wasn’t the Zumo or the PC but my coding, there was a for/next loop with an ERROR so it never ended!!

If I have a variable float like bv, how can I format the result to only have 3 decimal places like 5.583 Volts?
Any help most welcome.



Thank you for letting us know you found the problem.

I probably need more context to give you the most helpful answer, but there aren’t any native functions for rounding or truncating a floating point to a certain number of decimal places. I generally recommend avoiding floating point numbers if you do not have a specific need for them since they are harder for the microcontroller to process and take much longer. If you only want the resolution of 3 decimal places anyway, you are probably better off just multiplying everything by 1000 and using integers.

If you do need to use floating points for some reason, you can truncate it to 3 decimal places with a little creativity like this:

float bv = 5.583284;  //example of a floating point value
float x = long(bv * 1000)/1000.0; //truncate the floating point value after 3 decimal places

This code essentially multiplies your floating point by 1000 and casts it as a long integer, which truncates any trailing decimal places, then divides it by a 1000.0 to get it back into a floating point value with the correct order of magnitude.


Hi Brendon,
Many thanks for your help, once again! Yes that did the trick. On the old Zumo which had a 2x16 LCD it was not a problem, but the Oled version is only 8 char$ wide, not wide enough.
My code is not very elegent but it works:

void BattCheck()
 // float x = long(bv * 1000)/1000.0; //truncate the floating point value after 3 decimal 

  unit = 0.00488;                 // 4.88mV per analoge step. 5.00V/1023
  val = analogRead(A1);     //Analogue value. reads 1/2 of battery level
  val = val * 2;                      // 2x=100%
  bv = val*unit ;                   // 0.00488*Analogue value=Volts
  display.gotoXY(0, 0);
  display.gotoXY(1, 1);
  display.print(" V");




PS. I know there is a function to return battery volts in Millivolts, but used my old code, modified!!