Programming Optical Shaft Encoder

Well I just recently got a programming kit and a optical shaft encoder. I have tried to program it but i keep getting syntax errors. I only have easy c i know c# pretty well, but i don’t have the compiler so i can only use the easy c. Can you help me?
Attached is my program if u can could u edit it and repost it?
test encoder.zip (1.06 KB)

um, i cant find your code, but to work with the encoders, you need to plug the wires into the interrupt ports.

oops forgot to post it :smiley: it is now posted on the original.

I already have it in the interrupts as u will see in the program.

i see 2 problems on line 9 u have a semi colon that does not need to be there. second where 1000 = getencoder change the 1000 to a name for example distance make sure u add to local variables, then go into ur if statement and change 1000 = getencoder to distance == 1000 and that should fix it. sorry i dont know how to attach a file

what version of EasyC are you using, because i cant open your program?

Version 2.8.0.1

Yeah I can’t delete the semi colon because it is easy c and it automatically put it there. And to attach a file when u post the post there is a paper clip up on the top next to the smiley face. there is the new edited file.
test encoder.zip (202 Bytes)

In EasyC you can replace the automatically generated instructions with user code (or something like that - I forget the exact name of the icon that you drag and drop).

That block let’s you insert/write any arbitrary C code that you can dream up.

Blake

Yeah disregard that i was looking at the wrong line and i had already done that to the correct line. The problem is i din’t replace the “1000=getencoder(1);” to “Distance=Getencoder(1);”
Here is the completed file
but know that it is downloaded the motor won’t start running do u know what is wrong?
test encoder.zip (202 Bytes)

I heard of a problem with EasyC 2.8.0.1. Now i’m using 2.8.0.5.

It appears that Vista Aware version 2.9.0.2 of EasyC 2.x has been Released… It also contains the new Competition Template.

Did you unzip it?
If you didn’t, right click the folder and click extract all. Follow the steps and open the file it gives you when your done.

Jeff.

I’ve been told (after having a failed autonomous mode due to inaccurate timing of motors) to try optical encoders. I have them, but I have no clue how to set them up right in EasyC. I have version 1.1… so I can’t open the previous file. Can someone make a sample file for me?
with motor 3 running on CCW and motor 2 CW for six inches then stopping?

please read the inventors guide insert if you have lost it then its downloadable online, even if easyC V1.1 (i dont have it so i dont know) does not have the optical encoder commands then you can work out a program with simple digital input commands

I have read the Inventor’s Guide, and understand the concept of the Encoder, but it does not tell HOW to program it. If possible and accessible, I’d like to see how someone else has programmed it in.

Here you go, robot should go forward until 500 ticks of the optical encoder.
OpticalEncoderDemo.zip (1.2 KB)

oh and read the easyC help file, sorry thats what i meant i forgot! :o:rolleyes::rolleyes:

Thanks for the file, but I am unable to open it. When loaded into Easy C Version 1.1 it says it cannot read the BDS file.