Skip to content

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
Update neopixel dep
  • Loading branch information
xmeow committed Sep 25, 2018
1 parent c044eb7 commit 2e06510
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 160 deletions.
14 changes: 7 additions & 7 deletions .gitignore
@@ -1,7 +1,7 @@
built
node_modules
yotta_modules
yotta_targets
pxt_modules
*.db
*.tgz
built
node_modules
yotta_modules
yotta_targets
pxt_modules
*.db
*.tgz
18 changes: 18 additions & 0 deletions .header.json
@@ -0,0 +1,18 @@
{
"target": "microbit",
"targetVersion": "1.1.40",
"name": "robotbit",
"meta": {},
"editor": "tsprj",
"pubId": "",
"pubCurrent": false,
"_rev": null,
"id": "c95ea169-4faa-4917-0c9c-80a8e8a0d6e7",
"recentUse": 1531137545,
"modificationTime": 1531137545,
"blobId": null,
"blobVersion": null,
"blobCurrent": false,
"isDeleted": false,
"path": "pxt-robotbit"
}
36 changes: 18 additions & 18 deletions .vscode/settings.json
@@ -1,19 +1,19 @@
{
"editor.formatOnType": true,
"files.autoSave": "afterDelay",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/built/**": true,
"**/node_modules/**": true,
"**/yotta_modules/**": true,
"**/yotta_targets": true,
"**/pxt_modules/**": true
},
"search.exclude": {
"**/built": true,
"**/node_modules": true,
"**/yotta_modules": true,
"**/yotta_targets": true,
"**/pxt_modules": true
}
{
"editor.formatOnType": true,
"files.autoSave": "afterDelay",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/built/**": true,
"**/node_modules/**": true,
"**/yotta_modules/**": true,
"**/yotta_targets": true,
"**/pxt_modules/**": true
},
"search.exclude": {
"**/built": true,
"**/node_modules": true,
"**/yotta_modules": true,
"**/yotta_targets": true,
"**/pxt_modules": true
}
}
72 changes: 36 additions & 36 deletions .vscode/tasks.json
@@ -1,36 +1,36 @@

// A task runner that calls the PXT compiler and
{
"version": "0.1.0",

// The command is pxt. Assumes that PXT has been installed using npm install -g pxt
"command": "pxt",

// The command is a shell script
"isShellCommand": true,

// Show the output window always.
"showOutput": "always",

"tasks": [{
"taskName": "deploy",
"isBuildCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}, {
"taskName": "build",
"isTestCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}, {
"taskName": "clean",
"isTestCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}, {
"taskName": "serial",
"isTestCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}]
}

// A task runner that calls the PXT compiler and
{
"version": "0.1.0",

// The command is pxt. Assumes that PXT has been installed using npm install -g pxt
"command": "pxt",

// The command is a shell script
"isShellCommand": true,

// Show the output window always.
"showOutput": "always",

"tasks": [{
"taskName": "deploy",
"isBuildCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}, {
"taskName": "build",
"isTestCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}, {
"taskName": "clean",
"isTestCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}, {
"taskName": "serial",
"isTestCommand": true,
"problemMatcher": "$tsc",
"args": [""]
}]
}
38 changes: 19 additions & 19 deletions LICENSE
@@ -1,20 +1,20 @@
The MIT License (MIT)

Copyright (c) 2017 Riven

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
The MIT License (MIT)
Copyright (c) 2017 Riven
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 10 additions & 10 deletions Makefile
@@ -1,10 +1,10 @@
all: deploy

build:
pxt build

deploy:
pxt deploy

test:
pxt test
all: deploy

build:
pxt build

deploy:
pxt deploy

test:
pxt test
78 changes: 39 additions & 39 deletions README.md
@@ -1,40 +1,40 @@
# robotbit

Extension for Kittenbot Robotbit

## Feature

- Designed for robotic projects over microbit
- On board battery source
- Drive 8x servos and 4x DC motors and the same time (with 3.7v battery source to VM)
- Drive 2x Micro Stepper Motors
- On board buzzer
- On board 4x RGB Neo Pixels

# Blocks Preview
![image](https://user-images.githubusercontent.com/3390845/34512193-b3e0ffdc-f09b-11e7-839f-0c9c3563ac94.png)

# Hardware Preview
## Front
![image](https://user-images.githubusercontent.com/3390845/34511999-4b3fdef4-f09a-11e7-960e-5661268b0ba7.png)

## Back
![image](https://user-images.githubusercontent.com/3390845/34512098-04fecc1a-f09b-11e7-9ec6-62fcc0780773.png)


----------

For more infomation please visit [http://kittenbot.cc/bbs/](http://kittenbot.cc/bbs/ "Kittenbot BBS")

## License

MIT

## Supported targets

* for PXT/microbit
(The metadata above is needed for package search.)

```package
robotbit=github:Kittenbot/pxt-robotbit
# robotbit

Extension for Kittenbot Robotbit

## Feature

- Designed for robotic projects over microbit
- On board battery source
- Drive 8x servos and 4x DC motors and the same time (with 3.7v battery source to VM)
- Drive 2x Micro Stepper Motors
- On board buzzer
- On board 4x RGB Neo Pixels

# Blocks Preview
![image](https://user-images.githubusercontent.com/3390845/34512193-b3e0ffdc-f09b-11e7-839f-0c9c3563ac94.png)

# Hardware Preview
## Front
![image](https://user-images.githubusercontent.com/3390845/34511999-4b3fdef4-f09a-11e7-960e-5661268b0ba7.png)

## Back
![image](https://user-images.githubusercontent.com/3390845/34512098-04fecc1a-f09b-11e7-9ec6-62fcc0780773.png)


----------

For more infomation please visit [http://kittenbot.cc/bbs/](http://kittenbot.cc/bbs/ "Kittenbot BBS")

## License

MIT

## Supported targets

* for PXT/microbit
(The metadata above is needed for package search.)

```package
robotbit=github:Kittenbot/pxt-robotbit
```
30 changes: 15 additions & 15 deletions _locales/zh/robotbit-strings.json
@@ -1,16 +1,16 @@
{
"robotbit.Servo|block": "舵机|%index|角度 %degree",
"robotbit.StepperDegree|block": "步进 28BYJ-48|%index|角度 %degree",
"robotbit.StepperTurn|block": "步进 28BYJ-48|%index|圈数 %turn",
"robotbit.StepperDual|block": "双步进(角度) |M1 %degree1| M2 %degree2",
"robotbit.StpCarMove|block": "步进小车 前进 |距离(cm) %distance|轮直径(mm) %diameter",
"robotbit.StpCarTurn|block": "步进小车 转向 |角度 %turn|轮直径(mm) %diameter|轮距(mm) %track",
"robotbit.MotorRun|block": "电机|%index|速度 %speed",
"robotbit.MotorRunDual|block": "电机|%motor1|速度 %speed1|%motor2|速度 %speed2",
"robotbit.MotorRunDelay|block": "电机|%index|速度 %speed|延时 %delay|s",
"robotbit.MotorStop|block": "电机 停止|%index|",
"robotbit.MotorStopAll|block": "停止所有电机",
"robotbit.Ultrasonic|block": "超声波|引脚 %pin",
"robotbit.MatrixDraw|block": "LED矩阵 描点|X %x|Y %y",
"robotbit.MatrixClear|block": "LED矩阵 清空"
{
"robotbit.Servo|block": "舵机|%index|角度 %degree",
"robotbit.StepperDegree|block": "步进 28BYJ-48|%index|角度 %degree",
"robotbit.StepperTurn|block": "步进 28BYJ-48|%index|圈数 %turn",
"robotbit.StepperDual|block": "双步进(角度) |M1 %degree1| M2 %degree2",
"robotbit.StpCarMove|block": "步进小车 前进 |距离(cm) %distance|轮直径(mm) %diameter",
"robotbit.StpCarTurn|block": "步进小车 转向 |角度 %turn|轮直径(mm) %diameter|轮距(mm) %track",
"robotbit.MotorRun|block": "电机|%index|速度 %speed",
"robotbit.MotorRunDual|block": "电机|%motor1|速度 %speed1|%motor2|速度 %speed2",
"robotbit.MotorRunDelay|block": "电机|%index|速度 %speed|延时 %delay|s",
"robotbit.MotorStop|block": "电机 停止|%index|",
"robotbit.MotorStopAll|block": "停止所有电机",
"robotbit.Ultrasonic|block": "超声波|引脚 %pin",
"robotbit.MatrixDraw|block": "LED矩阵 描点|X %x|Y %y",
"robotbit.MatrixClear|block": "LED矩阵 清空"
}
16 changes: 12 additions & 4 deletions main.ts
Expand Up @@ -139,7 +139,10 @@ namespace robotbit {
function setPwm(channel: number, on: number, off: number): void {
if (channel < 0 || channel > 15)
return;

//serial.writeValue("ch", channel)
//serial.writeValue("on", on)
//serial.writeValue("off", off)

let buf = pins.createBuffer(5);
buf[0] = LED0_ON_L + 4 * channel;
buf[1] = on & 0xff;
Expand Down Expand Up @@ -294,7 +297,7 @@ namespace robotbit {
* @param distance Distance to move in cm; eg: 10, 20
* @param diameter diameter of wheel in mm; eg: 48
*/
//% blockId=robotbit_stpcar_move block="Car Forward|Diameter(cm) %distance|Wheel Diameter(mm) %diameter"
//% blockId=robotbit_stpcar_move block="Car Forward|Distance(cm) %distance|Wheel Diameter(mm) %diameter"
//% weight=88
export function StpCarMove(distance: number, diameter: number): void {
if (!initialized) {
Expand Down Expand Up @@ -403,6 +406,9 @@ namespace robotbit {
//% weight=79
//% blockGap=50
export function MotorStopAll(): void {
if (!initialized) {
initPCA9685()
}
for (let idx = 1; idx <= 4; idx++) {
stopMotor(idx);
}
Expand All @@ -416,7 +422,9 @@ namespace robotbit {
initializedMatrix = true;
}
let idx = y * 2 + x / 8;
matBuf[idx + 1] |= (1 << (x % 8));
let tmp = matBuf[idx + 1];
tmp |= (1 << (x % 8));
matBuf[idx + 1] = tmp;
matrixShow();
}

Expand Down Expand Up @@ -469,7 +477,7 @@ namespace robotbit {
ret = distanceBuf;
}
distanceBuf = d;
return ret*10/6/58;
return Math.floor(ret*10/6/58);
}


Expand Down
4 changes: 2 additions & 2 deletions pxt.json
@@ -1,11 +1,11 @@
{
"name": "robotbit",
"version": "0.2.4",
"version": "0.2.5",
"description": "Extension for Kittenbot Robotbit",
"license": "MIT",
"dependencies": {
"core": "*",
"neopixel": "github:microsoft/pxt-neopixel#v0.6.2"
"neopixel": "github:microsoft/pxt-neopixel#v0.6.9"
},
"files": [
"README.md",
Expand Down
2 changes: 1 addition & 1 deletion test.ts
@@ -1 +1 @@
// tests go here; this will not be compiled when this package is used as a library
// tests go here; this will not be compiled when this package is used as a library

0 comments on commit 2e06510

Please sign in to comment.