Skip to content

Commit

Permalink
Added USV Library
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam0Brien committed Mar 7, 2024
1 parent d068fcb commit 95c0ffe
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 1 deletion.
131 changes: 131 additions & 0 deletions USV/USV-lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
namespace USVSensorPod {


export enum direction {
//% block="Forward Fast"
FullSpeedForward = 120,
//% block="Backward Fast"
FullSpeedBackwards = 60,
//% block="Forward Slow"
HalfSpeedForward = 105,
//% block="Backward Slow"
HalfSpeedBackward = 75,
//% block="Stop"
Stop = 89,
}

export enum Motors {
//%blockId=usv_motor_one
//% block="Left Motor"
Motor1 = 0,
//%blockId=usv_motor_two
//% block="Right Motor"
Motor2 = 1
}

/**
* Configure the USV Motors.
*/
//% weight=50
//% color=#7F74D5
//% subcategory=USV
//% group="Movement"
//% blockId=USV_Motor block="Move |%Motor|%speed"
//% speed.min=60 speed.max=120
//% index.fieldEditor="gridpicker" index.fieldOptions.columns=2
export function USV_Motor(index: Motors, speed: direction): void {

if (index == 0) {
// turn left motor
}
if (index == 1) {
// turn right motor
}

}


//% blockId=stopMotors
//% block="Stop Motors"
//% weight=50
//% color=#7F74D5
//% subcategory=USV
//% group="Movement"
export function stopMotors(): void {

}


export enum Crane {
//%blockId=crane_down
//% block="Down"
down = 0,
//%blockId=crane_up
//% block="Up"
up = 1
}


/**
* Configure the USV Crane.
*/
//% weight=50
//% color=#29D215
//% subcategory=USV
//% group="Crane"
//% blockId=USV_Crane block="Bring Crane |%Motor"
//% index.fieldEditor="gridpicker" index.fieldOptions.columns=2
export function craneDirection(index: Crane): void {

if (index == 0) {
// crane down
}
if (index == 1) {
// crane up
}

}


//% blockId=calculateTempC
//% block="Sensor Pod Temperature °C"
//% subcategory=Sensor Pod
//% color=#442FDE
//% group="Sensors"
export function calculateTempC(): number {
// Ask sensor pod for temperature through radio
return 0
}

//% blockId=calculateTempF
//% block="Sensor Pod Temperature °F"
//% subcategory=Sensor Pod
//% color=#442FDE
//% group="Sensors"
export function calculateTempF(): number {
// Ask sensor pod for temperature
return 0
}

//% blockId=calculatePh
//% block="Sensor Pod pH"
//% subcategory=Sensor Pod
//% color=#442FDE
//% group="Sensors"
export function calculatePh(): number {
// Ask sensor pod for pH
return 0
}

//% blockId=Sensor Pod Light
//% block="Sensor Pod Light"
//% subcategory=Sensor Pod
//% color=#442FDE
//% group="Sensors"
export function getLight(): number {
// Ask sensor pod for LDR reading
return 0
}

}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To get started with the USV-Lir Sensor Pod, follow these steps:

<img src="/img/getting-started2.png" class="center" width="600" height="400">

- Paste the code from https://github.com/Adam0Brien/USV-LIR-Microbit-Abstraction/blob/main/sensor-pod/sensorPod.ts
- Paste the code from https://github.com/Adam0Brien/USV-LIR-Microbit-Abstraction/blob/main/USV/sensor-pod/sensorPod.ts

<img src="/img/getting-started3.png" class="center" width="600" height="400">

Expand Down

0 comments on commit 95c0ffe

Please sign in to comment.