# Code Examples

## Start, Walk & Sit

in following code example you connect to bysense, show the E-Stop button, activate its joints, standup, walk for 120 sec in x direction, sit down and deactivate its joints.

{% code title="python" lineNumbers="true" %}

```python
#import the SDK module
import bysense_sdk as bysense
import time

# Create a boolean connection variable of the start class
bysense_connection = bysense.start.connect()
walking_vector = (0.5, 0.0, 0.0)

if bysense_connection.is_connected():

    #print successfull connection
    print(bysense_connection.lastlog())
    
    #open UI in a seperate process to be able to use it
    bysense.start.estop_UI()
    
    #once estop is avaible the joints can be activated
    bysense_active_joints = bysense.start.activate_joints()
    
    #stantup bysense
    bysense.movs.standup()
    
    #turn on the walk bling function with given vector
    bysense.movs.walkblind(walking_vector)
    
    #walk for 120 seconds
    time.sleep(120.0)
    
    #sitdown bysense
    bysense.movs.sitdown()
    
    #once estop is avaible the joints can be activated
    bysense_deactive_joints = bysense.start.deactive_joints()
    

else:
    print(bysense_connection.lastlog())
    # Handle connection failure as needed
```

{% endcode %}

With this python code you have written your first application to bring your sensors to walk!


---

# Agent Instructions: 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:

```
GET https://bywerks.gitbook.io/bysense/mission-development/code-examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
