2019-09-10 16:34:51 Kotlin

FRCのJAVAのコード

Copy Copied! Full
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot import edu.wpi.first.wpilibj.Joystick import edu.wpi.first.wpilibj.PWMVictorSPX import edu.wpi.first.wpilibj.TimedRobot import edu.wpi.first.wpilibj.Timer import edu.wpi.first.wpilibj.drive.DifferentialDrive /** * 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. */ class Robot : TimedRobot() { val m_robotDrive: DifferentialDrive =DifferentialDrive(PWMVictorSPX(0),PWMVictorSPX(1))) val m_stick:Joystick = Joystick(0) val m_timer:Timer = Timer() override fun robotInit() { } override fun robotPeriodic() {} override fun autonomousInit() { m_timer.reset() m_timer.start() } override fun autonomousPeriodic() { if(m_timer.get()<2.0){ m_robotDrive.arcadeDrive(0.5,0.0) }else{ m_robotDrive.stopMotor() } } override fun teleopInit() {} override fun teleopPeriodic() { m_robotDrive.arcadeDrive(m_stick.getY(),m_stick.getY()) } override fun testInit() {} override fun testPeriodic() {} }
FRCのJAVAのコード
Kotlinです('◇')ゞ