2022年12月18日

google calendar連結

 https://calendar.google.com/calendar/render?action=TEMPLATE&text=Birthday&dates=20180201T090000/20180201T180000&sprop=&sprop=name:

text=主題

dates=起時間/終時間


https://calendar.google.com/calendar/render?action=TEMPLATE&text=Example+Google+Calendar+Event&details=More+help+see:+https://support.google.com/calendar/thread/81344786&dates=20201231T160000/20201231T170000&recur=RRULE:FREQ%3DWEEKLY;UNTIL%3D20210603&ctz=America/Toronto


https://github.com/InteractionDesignFoundation/add-event-to-calendar-docs/blob/main/services/google.md

2022年6月14日

scratch3增加擴充積木(進階)

30天通github

https://github.com/doggy8088/Learn-Git-in-30-days

java script快速入門播放清單

https://youtube.com/playlist?list=PLxNBsYH_m6ywXdOfpVgibRbJzidecajoX

scratch-vm index.js結構

 //require基本架構

const ArgumentType = require('../../extension-support/argument-type');
const BlockType = require('../../extension-support/block-type');
const formatMessage = require('format-message');
const msg = require('./translation');

 

物件

class 物件名稱 {

//物件架構

  constructor(runtime) {
        the_locale = this._setLocale();
        this.runtime = runtime;
    }

//物件資料

  getInfo() {
        the_locale = this._setLocale();
        return {
            id: 'mqtt',
            color1: '#003D79', //'#0C5986',
            color2: '#34B0F7',
            name: 'MQTT',
            blockIconURI: 'data:image/png;base64,',
            blocks: [
                {

               }

}

function(){

}

module.exports = 物件名稱;


語系

方法1:

在index.js中有

const msg = require('./translation');

物件中要有function定義語系

_setLocale() {
        let now_locale = '';
        switch (formatMessage.setup().locale) {
            case 'zh-tw':
                now_locale = 'zh-tw';
                break;
            default:
                now_locale = 'en';
                break;
        }
        return now_locale;
    } 

物件架構是呼叫function定義語系

constructor(runtime) {
        the_locale = this._setLocale();
        this.runtime = runtime;
    }

使用方法:

msg.disconnect[the_locale];

在資料夾下,要有translation.js

 檔案內容:

export const disconnect = {
    'en': 'disconnected',
    'zh-tw': '未連線',
};

方法2:

在index.js中加入語系物件

const formatMessage = require('format-message');

const FormLcdShow = {
    'en': 'LCD show text [VALUE] at [ROW] row',
    'zh-tw': 'LCD顯示文字[VALUE]在第[ROW]列',
};

在物件中加入架構

constructor(runtime,util) {
        the_locale = this._setLocale();
        this.runtime = runtime;
    }

需要有function _setLocale()

_setLocale () {
        let now_locale = '';
        switch (formatMessage.setup().locale){
            case 'en':
                now_locale='en';
                break;
            case 'zh-tw':
                now_locale= 'zh-tw';
                break;
            default:
                now_locale='en';
                break;
        }
        return now_locale;
    }

使用方法

FormLcdShow [the_locale]


積木表示

在物件中使用陣列blocks: [ ]包括所有積木。

每個積木為一物件{}。內容為

opcode: 'digital_write',
                    blockType: BlockType.COMMAND,
                    text: FormDigitalWrite[the_locale],
                    arguments: {
                        PIN: {
                            type: ArgumentType.NUMBER,
                            defaultValue: 'D2',
                            menu: "digital_pins"
                        },

                     }

方法3:

/src/lib/libraries/extensions/index.jsx的

翻譯檔案在/node_modules/scratch-l10n/locales/editor-msgs.js

中文語系在最後面。

格式範例:

"gui.extension.microbitMore.description":"玩轉 micro:bit 的所有功能。(v2-0.2.4)",


2022年3月22日

npm build apk

産生金鑰檔

keytool -genkey -v -keystore 檔名.keystore -alias 別名osep -keyalg RSA -keysize 2048 -validity 10000
 
sudo npm install -g androidjs-builder
web data html file save to dir 
mkdir dir
cd dir  
androidjs init
npm install 
npm run start:dev 
npm run build
  
androidjs build --release
 
apk in dist direction  

2022年1月31日

esp32 arduino編譯LedControl.h錯誤

 #include <LedControl.h>

少了pgmspace.h這個檔案,但LedControl套件沒有avr資料夾。

 

拜神,找到,這裡有https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/pgmspace.h

把它放入LedControl套件裡(先建avr資料夾)。

編譯就成功了。

2022年1月25日

uno當bootloader

 遇到ch340燒錄死機。

解決方法:

1.找另一張正常的uno,當bootloader主板

2.接法:11 、12、13、5V、GND對接。usb線接在好的uno上,好的uno D10要接到有問題的uno reset孔。

3.好的uno燒錄範例檔Arduino ISP。

4.arduino ide 讀出要燒的ino

5.檢查arduino ide 的設定 board 和port 

6.按著好的uno 板子上的reset按鈕,滑鼠點下草稿碼/以燒錄器上傳,等約5-10秒,放掉reset按鈕,就看到開始燒錄。

接法可以參考網址:

https://forum.arduino.cc/t/uno-to-uno-bootloader/554994/4


如果bootloader可以燒成功,就可以回春了。

亂試一下,碰巧成功。做法如下

燒錄器先選AVR ISP,按著reset鈕不放,工具/燒錄bootloader,10秒左右放掉,這時會出現錯誤訊息,再把燒錄器選回Arduino as ISP,再按著reset鈕不放,工具/燒錄bootloader,10秒左右放開,就有機會燒成功,的板子我做了好幾次才成功,但把故障的板子啟回來,還不賴。