Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   User code (syntax error, help?) (http://www.chiefdelphi.com/forums/showthread.php?t=68188)

Kuiper 23-06-2008 16:31

User code (syntax error, help?)
 
Right now, I'm trying to create a program that commands a robot to move forward while constantly monitoring the status of two limit switches. If the left limit switch is pressed, the robot backs up and turns right before resuming forward motion, and if the right limit switch is pressed, the robot backs up and turns left before resuming forward motion. This is repeated infinitely (or until 5 stops being equal to 5). Only problem is that I'm getting a compile error:
Quote:

Error[yy] Main.c line# 16 : syntax error
I've tried a various number of permutations of commands to try to download it and it seems that the problem may be with the User Code block (used in lines 15 and 20) in which I assign a value to a variable called "sum" equal to the sum of two variables known as "left" and "right".

Here's the program, both the EasyC window and the C window:





If anyone can shed some light on this matter, it would be much appreciated.

Travis Hoffman 23-06-2008 16:48

Re: User code (syntax error, help?)
 
Pertaining to the syntax error:

Are you missing a semicolon after each "sum = left + right" statement?

Kuiper 23-06-2008 18:33

Re: User code (syntax error, help?)
 
That was exactly the problem, as it turns out. Adding semicolons elliminated the syntax error and made it possible for me to download the program. Thanks!


All times are GMT -5. The time now is 09:00.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi