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

Pololu Forum

When im coding for my zumo on Arduino im constantly getting errors

i have a zumo 32u4 and when im coding for it on arduiuno it wont stop giving me errors this is my code

#include <Zumo32U4.h>
Zumo32U4Motors motors;
Zumo32U4LCD lcd;
Zumo32U4ButtonA ButtonA;

const uint16_t motorSpeed = 300;

void setup() {
  // put your setup code here, to run once:
lcd.clear();
lcd.gotoXY(0,0);
lcd.print("Press A");
}
void loop ()(
bool buttonPress = 'ButtonA.PushbuttonBase::()'
if (buttonPress) (
 delay (1000);


  motors.setSpeed(motorSpeed, MotorSpeed);
  delay(2000);

  motors.setSpeed(0, 0);
  delay(500);

  motors.setSpeed(-motorSpeed, -motorSpeed);
  delay(2000)

   motors.setSpeed(0, 0);
   delay(500);

    motors.setSpeed(-motorSpeed, motorSpeed);

     motors.setSpeed(0, 0);
}
}

Hello.

It looks like you are assigning your buttonPress variable incorrectly in bool buttonPress = 'ButtonA.PushbuttonBase::()'. If you want to check if the button is pressed, use the method isPressed(). For example, ButtonA.isPressed(). Also, the ( at the end of if (buttonPress) ( should be {.

If you are still having problems, can you turn on verbose output in the Arduino IDE and post the output that you get at the bottom of the IDE after trying to upload your sketch? You can turn on verbose output by selecting Preferences from the File menu in the Arduino IDE, and then checking the “compilation” and “upload” boxes next to “Show verbose output during:”.

By the way, it seems like you might be new to programming. If that is the case, I recommend looking at the “Language Reference” page on the official Arduino website.

- Amanda