So I have to design this for a school project, and no one around me seems to understand how or why the program won’t run, any ideas?

It’s supposed to move forward for 5 counts, turn around, resent the count, and repeat, but the code won’t even start. I compiled multiple times and it shows to compiler errors, can someone help?

Welcome, can you give us the Compiler Errors? Next time to get a faster response follow these steps - Help us help you

This looks like RobotC. If I remember right the code to run the motors with a Cortex brain is the following.

//The motors should be defined at the top
#pragma config(Motor,  port1,          RightMotor,    tmotorVex393_HBridge, openLoop)
#pragma config(Motor,  port10,         LeftMotor,     tmotorVex393_HBridge, openLoop, reversed)

//To make them spin use:
motor(RightMotor) = 60;
motor(LeftMotor) = 60;

Put your movement code in a while True loop.


Does your task main have a closing curly bracket? }

The brain only runs through your code once.

  1. count = 0
  2. if count < 5: Brain says: Yes, count < 5; continue on
  3. start motors
  4. wait 2 seconds
  5. count = count+1 Brain says: count = 1
  6. else: Brain says: if was true; not running else; skip else
  7. Brain says: end of program

Try using a loop; a forever loop.

count = 0
while (true) {
  if (count < 5) {
    start motors;
  else {
    spin motors back;
    count = 0;

Thank you! this helped me a lot

I hope you understood the logic and didn’t just copy the code? If you don’t think through the code, you won’t learn anything for next time.