If statement with flywheel help

I am looking for the code to do the following though I just don’t know how to make it.

if ( flywheel is at this rpm)

have access to press this button to use the disc slapper to launch the disc

Could someone help me make code for this since I’m not too sure how to make an if statement when a motor is at a specific RPM

The 3000 is just a random number. You can adjust it to what you need.

Blocks
Screenshot 2022-12-02 192251

C++
myVariable = 0

def when_started1():
global myVariable
if Flywheel.velocity(RPM) > 3000:
Disc_Slapper.spin_for(FORWARD, 90, DEGREES, wait=True)
Disc_Slapper.spin_for(REVERSE, 90, DEGREES, wait=True)

when_started1()

Python
myVariable = 0

def when_started1():
global myVariable
if Flywheel.velocity(RPM) > 3000:
Disc_Slapper.spin_for(FORWARD, 90, DEGREES, wait=True)
Disc_Slapper.spin_for(REVERSE, 90, DEGREES, wait=True)

when_started1()

3 Likes