> For the complete documentation index, see [llms.txt](https://learn.frcturkey.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.frcturkey.org/frc-yazilim/javavec/baslangic-icin-oernek-kodlar.md).

# Başlangıç için örnek kodlar

### **Robotunuz için örnek değişkenlerinizin tanımlanması.**

```java
//Programın ihtiyac duydugu diger dosyalari ice aktarir
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;

public class Robot extends IterativeRobot {

//Robot classimiz icin degiskenler tanimlar
     RobotDrive myRobot;
     Joystick stick;
     Timer timer;

//Robot init yönetimindeki degiskenleri cagirir robot basladiginda ilk bu komutlar calisir
     public void robotInit() {
          myRobot = new RobotDrive(0,1); //myRobot adinda robotumuzu haraket ettirecek kutuphaneyi cagirdik 0,1 robotumuzun tekerleklerinin bagli oldugu pwm numaralaridir 4 teker kullanıyorsanız 0,1,2,3 seklinde degistirebilirsiniz
          stick = new Joystick(1); //stick adinda joystick veya xbox kullanmamiza olanak saglayacak kutuphaneyi cagiriyoruz 1 kullandiginiz kolun takili oldugu usb portudur driver station uzerinden gorebilir ve ayarlayabilirsiniz
          timer = new Timer(); // timer adinda bir zamanlayici kullanmamiza olanak saglayacak kutuphaneyi cagiriyoruz
     }
}
```

### **Robotunuz için örnek otonom kodu**

```java
public void autonomousInit() { //Bu metod her zaman robot otonom moda girdiginde baslar
     timer.reset(); // zamanlayiciyi resetle
     timer.start(); // saymaya başla
}

public void autonomousPeriodic() { //Bu metod robot otonom modun enable olduguna dair bir paket aldiginda calismaya baslar
     // 2 saniye boyunca robotu sur
     if (timer.get() < 2.0) {
          myRobot.drive(-0.5, 0.0); // robotu yarim hizda ileri sur
     } else {
          myRobot.drive(0.0, 0.0); // Robotu durdur
     }
}
```

### Teleoperation için kolay robot sürme kodu <a href="#easy-arcade-drive-for-teleoperation" id="easy-arcade-drive-for-teleoperation"></a>

```java
public void teleopInit() {// teleopInit metodu her zaman teleop moduna girdiginizde cagrilir
}

public void teleopPeriodic() { // teleperiodic metodu robotun enable olduguna dair bir paket aldiginda calismaya baslar
     myRobot.arcadeDrive(stick); //Bu kod robota tanimladiginiz joystick ile motorlari surmenizi saglar
}

```

### **Test Modu**

```java
public void testPeriodic() {
     LiveWindow.run();
}
//Test Modu, robot işlevselliğini test etmek için kullanılır.Programımızın test modu LiveWindow'u çalıştırır. LiveWindow, Robot Test Modundayken, robot üzerindeki kontrol panelindeki girişleri ve kontrol çıkışlarını görmenizi sağlayan SmartDashboard'un bir parçasıdır.SmartDashboard bölümünde LiveWindow hakkında daha fazla bilgi edinebilirsiniz.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.frcturkey.org/frc-yazilim/javavec/baslangic-icin-oernek-kodlar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
