Skip to content

Commit

Permalink
Merge pull request #220 from OpenBCI/docusaurus-3.7.0
Browse files Browse the repository at this point in the history
Update project to Docusaurus 3.7.0
  • Loading branch information
retiutut authored Jan 8, 2025
2 parents 9ad9026 + 68f80e4 commit 044bd9a
Show file tree
Hide file tree
Showing 17 changed files with 18,271 additions and 262 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/deploy-docs-v2.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- master
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

defaults:
run:
shell: bash
working-directory: ./website

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
30 changes: 30 additions & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test deployment

on:
pull_request:
branches:
- master
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

defaults:
run:
shell: bash
working-directory: ./website

jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Test build website
run: npm run build
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ website/build/
website/yarn.lock
website/node_modules
website/i18n/*
website/package-lock.json
.env


Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cSpell.words": ["openbci"]
}
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@

This is the current repository for the official OpenBCI Documentation!

Now using Docusaurus v2.
Now using Docusaurus v3.

https://docusaurus.io

## Best practices and Guidelines for making changes

This process is important for large changes, creating new docs, and editing Docusaurus settings or the sidebar.

1. Download VSCode
2. Download NodeJS
3. Clone this repository
4. In the integrated terminal in VSCode, type:
- `cd website`
- `npm install`
- `npm start`

- `cd website`
- `npm install`
- `npm start`

5. The website should now be running locally in your default web browser from `localhost:3000`
6. Resolve any errors you may see in the integrated terminal or web browser. If you're unsure of how to fix it, just ask your favorite search engine.
7. You can now edit one of the files. Click control/command+s to save the file. The site will quickly rebuild and you can view the changes in your web browser.
8. When you have made a meaningful change to a Doc or other part of this repo, go ahead and make a commit using best practices.
- https://www.pullrequest.com/blog/mastering-the-art-of-git-commit-messages/

- https://www.pullrequest.com/blog/mastering-the-art-of-git-commit-messages/

9. When you have fully resolved an issue, make a Pull Request.
10. While waiting for your Pull Request to be reviewed, enjoy a coffee or a nice walk!
11. Participate in code review while carefully considering feedback from your code reviewer.
Expand Down
34 changes: 17 additions & 17 deletions website/docs/Cyton/07-External_Trigger_Cyton_Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
id: CytonExternal
title: External Trigger on OpenBCI Cyton Board
---

Sometimes, when studying EEG or other biopotential signals, you will want to have precise timing between external events or stimulus and the data stream. For example, if you are working with P300 waves it is necessary to know the exact time that the signal was presented to the subject in order to look for the tell-tale brain wave that happens about 300mS after the stimulus.

This tutorial will cover a couple of ways to add an external trigger to the OpenBCI data stream on our 32bit Board. Normally, the Cyton board reads from the Accelerometer at 25 Hz. When we change board mode to `Analog` or `Digital` mode, we read from the external pins at same rate as the signal pins (e.g. 250 Hz)! This is what allows for the precise timing needed for external triggers.
Expand All @@ -24,16 +25,15 @@ You can verify the digital read widget is working by pressing the "PROG" button

When you use a Cyton USB dongle, you get up to 5 digital IO pins to read from: D11, D12, D13, D17 and D18! If there appears to be a delay between when you press the button and when the digital read widget in the GUI shows the button pressed, then you may want to lower your serial port latency. Checkout the guides for lowering serial port latency [Windows](Troubleshooting/04-FTDI_Fix_Windows.md) and [macOS](Troubleshooting/05-FTDI_Driver_Fix_Mac.md), and [Linux](Troubleshooting/03-FTDI_Fix_Linux.md)!


### Programmatically Setting Board Mode

Firmware 3.x.x brings a long requested out-of-the-box ability to read from analog or digital inputs with the default firmware. Allowing you to simply read from the analog input (sending `/2`) or digital input (sending `/3`) with the type of two ascii commands. The default board is activated by default, and can always be achieved again by sending a `/0`.

Learn more about board modes in the [Cyton SDK](Cyton/04-OpenBCI_Cyton_SDK.md#firmware-v300-new-commands-board-mode).
Learn more about board modes in the [Cyton SDK](Cyton/04-OpenBCI_Cyton_SDK.md#board-mode).

### External Triggering The Easy Way (Firmware 2.x.x)

Update to firmware version 3.x.x using the tutorial [**here**](Cyton/05-Cyton_Board_Programming_Tutorial.md)! May all your troubles disappear!
Update to firmware version 3.x.x using the tutorial [**here**](Cyton/05-Cyton_Board_Programming_Tutorial.md)! May all your troubles disappear!

### Sample Code Links

Expand Down Expand Up @@ -67,12 +67,12 @@ void setup(){
```

// you can set EITHER useAccel or useAux to true
// if you want both, you MUST set and clear one of the variables every sample
OBCI.useAccel = false; // option to add/remove accelerometer data to stream
OBCI.useAux = true; // option to add/remove auxiliary data to stream
// more stuff...
{"}"}
// you can set EITHER useAccel or useAux to true
// if you want both, you MUST set and clear one of the variables every sample
OBCI.useAccel = false; // option to add/remove accelerometer data to stream
OBCI.useAux = true; // option to add/remove auxiliary data to stream
// more stuff...
{"}"}

Then, in the loop, we want to check for the rising edge of the button press, make note of it in the auxData array, and set the write-to-SD flag (if you like). Finally, we want to get the button press event into the data stream. (Reference the [OpenBCI Data Format Doc](03-Cyton_Data_Format.md) for data packet anatomy) There are 6 bytes available in each data packet, and the default format is to read them as three 16bit integers (aka 'words' or 'shorts'). You can decide to add your flags into the auxData array any way you choose. In this example, we are setting each short to the value 0x6620. That's because our [OpenBCI GUI](https://github.com/OpenBCI/OpenBCI_Processing) converts these variables to Gs (the GUI is expecting accelerometer data) and 0x6620 converts to PI (3.14). Our sample rate of 250SPS gives us a 4mS resolution on external trigger events like the rising edge of the PROG button press.

Expand All @@ -82,7 +82,7 @@ pushButtonValue = digitalRead(pushButton); // feel the PROG button
if (pushButtonValue != lastPushButtonValue){ // if it's changed,
if (pushButtonValue == HIGH){ // if it's gone from LOW to HIGH
// 0x6220 converts to PI in GUI
OBCI.auxData[0] = OBCI.auxData[1] = OBCI.auxData[2] = 0x6220;
OBCI.auxData[0] = OBCI.auxData[1] = OBCI.auxData[2] = 0x6220;
addAuxToSD = true; // add Aux Data to the SD card if it's there
state = !state; // toggle the state variable
digitalWrite(LED,state); // toggle the LED for user useability
Expand Down Expand Up @@ -155,12 +155,12 @@ void setup(){
```

// you can set EITHER useAccel or useAux to true
// if you want both, you MUST set and clear one of the variables every sample
OBCI.useAccel = false; // option to add/remove accelerometer data to stream
OBCI.useAux = true; // option to add/remove auxiliary data to stream
// more stuff...
{"}"}
// you can set EITHER useAccel or useAux to true
// if you want both, you MUST set and clear one of the variables every sample
OBCI.useAccel = false; // option to add/remove accelerometer data to stream
OBCI.useAux = true; // option to add/remove auxiliary data to stream
// more stuff...
{"}"}

```
Expand All @@ -183,4 +183,4 @@ triggerValue = digitalRead(triggerPin); // feel the trigger pin
```

As always, help can be found at support@openbci.com and [openbci.com/forum](openbci.com/forum).
As always, help can be found at support@openbci.com and [openbci.com/forum](https://www.openbci.com/forum).
28 changes: 14 additions & 14 deletions website/docs/Deprecated/08-OpenBCI_Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
id: Python
title: Python and OpenBCI
---

**THIS DOCUMENT HAS BEEN DEPRECATED. PLEASE REFER TO ["FOR DEVELOPERS"](ForDevelopers/01-SoftwareDevelopment.md) SECTION FOR INFORMATION ON [BRAINFLOW-PYTHON](https://brainflow.readthedocs.io/en/stable/BuildBrainFlow.html#python).**

OpenBCI has a Python software library designed to work with OpenBCI hardware. To use it, download our OpenBCI Python github repository: https: **DEPRECATED**. This Python code is meant to be used by people familiar with Python and programming in general. Its purpose is to allow for programmers to interface with OpenBCI technology directly, both to acquire data and to write programs that can use that data in a live setting, using Python.The OpenBCI-Python repo is still live but it is not longer being mantained by OpenBCI.
Expand All @@ -14,21 +15,21 @@ This repo has been designed to be a more beginner friendly version of the [OpenB

Using this repo provides a building block for developing with Python. The goal for the Python library is to **_provide a stable Python driver for all OpenBCI Biosensors_**, that:

- Allows Python users to install one module and use any board they choose
- Provides examples of using Python to port data to other apps like lab streaming layer
- Performs the heavy lifting when extracting and transforming raw binary byte streams
- Provides a base for the beginner users to use Python to process their OpenBCI data
- Allows Python users to install one module and use any board they choose
- Provides examples of using Python to port data to other apps like lab streaming layer
- Performs the heavy lifting when extracting and transforming raw binary byte streams
- Provides a base for the beginner users to use Python to process their OpenBCI data

## To Do

- Add Ganglion Aux Data
- Add Ganglion Aux Data

## Requirements

- Python 2.7 or 3.4+
- Currently the Cyton works on Windows, Linux, and MacOS.
- Ganglion works on Linux only (Linux VM with enabled Bluetooth works as well).
- The WiFi shield is known to have reliability issues across different computer configurations. Using it effectively requires advanced technical skills and programming knowledge. Note that the code avaiable here has not been tested accross all platforms.
- Python 2.7 or 3.4+
- Currently the Cyton works on Windows, Linux, and MacOS.
- Ganglion works on Linux only (Linux VM with enabled Bluetooth works as well).
- The WiFi shield is known to have reliability issues across different computer configurations. Using it effectively requires advanced technical skills and programming knowledge. Note that the code avaiable here has not been tested accross all platforms.

## Installation

Expand Down Expand Up @@ -109,7 +110,7 @@ board = OpenBCIWifi(shield_name='OpenBCI-2254', sample_rate=200)

### Sending commands

Once you initialize the board you can use the commands on the OpenBCI SDKs ([Ganglion](Ganglion/06-OpenBCI_Ganglion_SDK.md), [Cyton](Cyton/CytonSDK), [Wifi Shield](ThirdParty/WiFiShield/08-OpenBCI_Wifi_SDK.md)) to send commands to the board using python (make sure your commands are strings).
Once you initialize the board you can use the commands on the OpenBCI SDKs ([Ganglion](Ganglion/06-OpenBCI_Ganglion_SDK.md), [Cyton](Cyton/04-OpenBCI_Cyton_SDK.md), [Wifi Shield](ThirdParty/WiFiShield/08-OpenBCI_Wifi_SDK.md)) to send commands to the board using python (make sure your commands are strings).

```python

Expand Down Expand Up @@ -148,9 +149,9 @@ board.start_stream(callback)

The output of the start_stream function is the OpenBCISample on the callback function. The OpenBCISample object has the following attributes:

- packet_id = The ID of the incomming packet.
- channels_data = The raw EEG data of each channel. 4 for the Ganglion, 8 for the Cyton, and 16 for the Cyton + Daisy.
- aux_data = Accelerometer data.
- packet_id = The ID of the incomming packet.
- channels_data = The raw EEG data of each channel. 4 for the Ganglion, 8 for the Cyton, and 16 for the Cyton + Daisy.
- aux_data = Accelerometer data.

Because the channels_data and aux_data is the raw data in counts read by the board, we need to multiply the data by a scale factor. There is a specific scale factor for each board:

Expand Down Expand Up @@ -282,4 +283,3 @@ MIT
[link_shop_cyton](https://shop.openbci.com/collections/frontpage/products/cyton-biosensing-board-8-channel)

[link_shop_cyton_daisy](https://shop.openbci.com/collections/frontpage/products/cyton-daisy-biosensing-boards-16-channel)

Loading

0 comments on commit 044bd9a

Please sign in to comment.