I get this error (The method start() is undefined for the type Compressor) but everything looks ok

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot;

import edu.wpi.first.wpilibj.TimedRobot;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.Joystick;


/**
 * The VM is configured to automatically run this class, and to call the functions corresponding to
 * each mode, as described in the TimedRobot documentation. If you change the name of this class or
 * the package after creating this project, you must also update the build.gradle file in the
 * project.
 */
public class Robot extends TimedRobot {
  /**
   * This function is run when the robot is first started up and should be used for any
   * initialization code.
   */

   private CANSparkMax rightFront = new CANSparkMax(0, MotorType.kBrushed);
   private CANSparkMax rightBack = new CANSparkMax(1, MotorType.kBrushed);
   private CANSparkMax leftFront = new CANSparkMax(2, MotorType.kBrushed);
   private CANSparkMax leftBack = new CANSparkMax(3, MotorType.kBrushed);

   private CANSparkMax armMotor = new CANSparkMax(0, MotorType.kBrushless);
   private CANSparkMax handMotor = new CANSparkMax(1, MotorType.kBrushless);

   private Compressor comp = new Compressor(PneumaticsModuleType.REVPH);
   private DoubleSolenoid solenoid = new DoubleSolenoid(PneumaticsModuleType.REVPH, 0, 1);


   // Controller

   private Joystick joystick = new Joystick(0);

  @Override
  public void robotInit() {
    comp.close();
  }

  @Override
  public void robotPeriodic() {}

  @Override
  public void autonomousInit() {}

  @Override
  public void autonomousPeriodic() {}

  @Override
  public void teleopInit() {
    comp.start();
  }

  @Override
  public void teleopPeriodic() {
    if (joystick.getRawButton(5)) {

      solenoid.set(DoubleSolenoid.Value.kForward);

    } else if (joystick.getRawButton(4)) {

      solenoid.set(DoubleSolenoid.Value.kReverse);

    }
    if (joystick.getRawButton(2)) {
      
    }
  }

  @Override
  public void disabledInit() {}

  @Override
  public void disabledPeriodic() {}

  @Override
  public void testInit() {}

  @Override
  public void testPeriodic() {}

  @Override
  public void simulationInit() {}

  @Override
  public void simulationPeriodic() {}
}

Are you sure that Compressor has a start() method? I’m sure it doesn’t, and going based on the compiler error, the compiler agrees with me.

Also, Compressor.close() doesn’t do what you think it does, and using it can cause issues.

Read the docs.

im sorry for my stupidness im a rookie coder and i dont know how to start the compressor in docs it says setClosedLoopControl(int, boolean) can you show me how to use it

You shouldn’t need to create an instance of compressor at all unless you want to be able to deactivate it at certain times. The .close() is probably causing problems

Try getting rid of the compressor instance, the .close and .start. Also, double check the wiring especially pressure switch. The compressor wont start if the pressure switch is not correctly wired into the pneumatics hub.

Once you confirm it’s working, you can add a compressor instance and try enabling/ disabling it using the methods shown here.

This is a learning experience for you. When you read the docs, you need to read all of them.

Here’s the introduction paragraphs for the Compressor documentation.

This documentation explicitly tells you that you shouldn’t even need this instantiation, unless you really know what you’re doing. It’s obvious you don’t really know what you’re doing, so you probably aren’t in need of any special case.

So, as long as your wiring is correct, instantiating a Solenoid (or DoubleSolenoid) is more than enough to get your compressor running in closed-loop mode.