How do you program formulas in easyc v2?

I am wondering how i can program formulas in easy c so that the robot can automatically make the calculations and report the product back to the computer.

I want to make a speed sensor that has 2 red lasers on either side and 2 light sensors on either side and an ultrasonic sensor to sense incoming rc cars. When you break the first beam it starts a timer and when you hit the second beam it stops the timer. I want the robot to take the time that it took and the distance (which i will have to measure) and find the speed of the rc car. If the speed is to fast a set of metal barriers will pop up and cause the rc car to crash, but if it is obeying the speed limit it will allow the robot to pass through.

I really want to get green lasers for this, but red lasers will have to do.

I also do not have 2 light sensors, i only have 1 but i think that i can have the first beam be the laser and for the second a set of limit switches or bumper switches under a thin plate that the car would drive over thus tripping the speed trap.

Basically what i really want to know is.

How do i take 2 integer variables in the program and put them in a formula for multiplication, as far as i know there is no function block that allows this to happen in easy c v2. Can i program in c in easy cv2 because i know how to do it in c, i have made many programs that calculate differnt things.

What you will have to use is the “User Code” block. You will then have to type in your own equation using the correct operators. Make sure you set a variable equal to the equation. Example, adding and then multiplying:


answer = (int1 + int2)*3;
1 Like

Thank you so much, you should see what i am going to buy i found 2 variable power lasers that go from 1mw to 5mw for only $11 each but i am only going to get one.

if you can find a good deal i would get both, besides you could blow the other one :rolleyes: