初步增加educore
This commit is contained in:
@@ -1045,4 +1045,91 @@ export const mixbot_actuator_extern_set_addr = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//educore
|
||||
export const PIN_init = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN", Number)
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_AT)
|
||||
.appendField(Blockly.Msg.MIXLY_PIN);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const pin_led_bright = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETTING);
|
||||
this.appendValueInput('pin')
|
||||
.appendField('LED')
|
||||
this.appendValueInput('bright')
|
||||
.appendField(Blockly.Msg.MIXLY_PULSEIN_STAT)
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const servo_PIN_init = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN", Number)
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_SERVO + Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_AT)
|
||||
.appendField(Blockly.Msg.MIXLY_PIN);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const servo_move_angle = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
.appendField(Blockly.Msg.MIXLY_SERVO);
|
||||
this.appendValueInput("angle")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.DRAW_POINTER_ANGLE)
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const parrot_PIN_init = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN", Number)
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_MOTOR + Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_AT)
|
||||
.appendField(Blockly.Msg.MIXLY_PIN);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const parrot_move_speed = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
.appendField(Blockly.Msg.MIXLY_MOTOR);
|
||||
this.appendValueInput("speed")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE +Blockly.Msg.MIXLY_SPEED);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
@@ -1516,4 +1516,167 @@ export const analog_ble_mouse_send_battery = {
|
||||
this.setNextStatement(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//educore actuator
|
||||
export const educore_buzzer = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MIDI);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
|
||||
export const educore_buzzer_play_tone = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("buzzer");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_TONE);
|
||||
this.appendValueInput('pitch')
|
||||
.setCheck(Number)
|
||||
.appendField(Blockly.Msg.MIXLY_FREQUENCY);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_buzzer_play_tone_time = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("buzzer");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_TONE);
|
||||
this.appendValueInput('pitch')
|
||||
.setCheck(Number)
|
||||
.appendField(Blockly.Msg.MIXLY_FREQUENCY);
|
||||
this.appendValueInput('time')
|
||||
.setCheck(Number)
|
||||
.appendField(Blockly.Msg.MIXLY_DURATION);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_buzzer_stop = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("buzzer")
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_Turn_off_display);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_rgb_light = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_RGB);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
|
||||
export const educore_neopixel_rgb = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("rgb");
|
||||
this.appendValueInput("_LED_")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_RGB_NUM);
|
||||
this.appendValueInput("RVALUE")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_RGB_R);
|
||||
this.appendValueInput("GVALUE")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_RGB_G);
|
||||
this.appendValueInput("BVALUE")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_RGB_B);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
// const boardKey = Boards.getSelectedBoardKey();
|
||||
// switch (boardKey) {
|
||||
// case 'micropython:esp32c3:mixgo_cc':
|
||||
// this.setTooltip(Blockly.Msg.MIXLY_RGB_NUM_R_G_B_MIXGOCC);
|
||||
// break;
|
||||
// case 'micropython:esp32s2:mixgo_ce':
|
||||
// this.setTooltip(Blockly.Msg.MIXLY_RGB_NUM_R_G_B_MIXGOCC);
|
||||
// break;
|
||||
// case 'micropython:esp32c3:mixgo_me':
|
||||
// this.setTooltip(Blockly.Msg.MIXLY_RGB_NUM_R_G_B_MIXGOME);
|
||||
// break;
|
||||
// case 'micropython:esp32:mPython':
|
||||
// this.setTooltip(Blockly.Msg.MIXLY_RGB_NUM_R_G_B_MPYTHON);
|
||||
// break;
|
||||
// default:
|
||||
// this.setTooltip(Blockly.Msg.MIXLY_RGB_NUM_R_G_B_MIXGOME);
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_neopixel_clear = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("rgb");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_Turn_off_display)
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_ble_sensor_init = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("name")
|
||||
.appendField(Blockly.Msg.LISTS_SET_INDEX_SET + Blockly.Msg.MIXLY_BLUETOOTH+ Blockly.Msg.MIXLY_MICROBIT_JS_SYSTEM_DEVICE_NAME + Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_AS);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_ble_sensor_connected = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
.appendField(Blockly.Msg.MIXLY_BLUETOOTH);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_BE_CONNETCED)
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_ble_keyboard_input = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
.appendField(Blockly.Msg.MIXLY_BLUETOOTH + Blockly.Msg.ANALOG + Blockly.Msg.MIXLY_KEYBOARD);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SEND_KEYBOARD);
|
||||
this.appendValueInput('general');
|
||||
// this.appendDummyInput()
|
||||
// .appendField(Blockly.Msg.MIXLY_RELEASE)
|
||||
// .appendField(new Blockly.FieldDropdown([
|
||||
// [Blockly.Msg.MICROPYTHON_DISPLAY_YES, "True"],
|
||||
// [Blockly.Msg.MICROPYTHON_DISPLAY_NO, "False"]
|
||||
// ]), 'release');
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
@@ -315,4 +315,81 @@ export const ce_go_pin_light = {
|
||||
return mode0 + mode1
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//educore car
|
||||
export const educore_car = {
|
||||
init: function () {
|
||||
this.setColour(MEGO_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_CAR);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
|
||||
export const educore_car_stepper_keep = {
|
||||
init: function () {
|
||||
this.setColour(MEGO_HUE);
|
||||
this.appendValueInput('car');
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.blockpy_forward, "forward"],
|
||||
// [Blockly.Msg.blockpy_backward, "B"],
|
||||
[Blockly.Msg.blockpy_left, "turn_left"],
|
||||
[Blockly.Msg.blockpy_right, "turn_right"]
|
||||
]), "VAR");
|
||||
this.appendValueInput('speed')
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_SETTING + Blockly.Msg.MIXLY_SPEED);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
|
||||
export const educore_car_stepper_stop = {
|
||||
init: function () {
|
||||
this.setColour(MEGO_HUE);
|
||||
this.appendValueInput('car');
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MOTOR_P, "stop"]
|
||||
// [Blockly.Msg.MOTOR_N, "N"]
|
||||
]), "VAR");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
|
||||
export const educore_car_pin_near_line = {
|
||||
init: function () {
|
||||
this.setColour(MEGO_HUE);
|
||||
this.appendValueInput('car');
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "1"],
|
||||
// [Blockly.Msg.MIXGO_LEFT_MID, "[1]"],
|
||||
// [Blockly.Msg.MIXGO_RIGHT_MID, "[2]"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "2"]
|
||||
// [Blockly.Msg.MIXLY_ALL, ""]
|
||||
]), "key")
|
||||
.appendField(Blockly.Msg.MIXGO_LINE_SENSOR_VAL);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_car_pin_near = {
|
||||
init: function () {
|
||||
this.setColour(MEGO_HUE);
|
||||
this.appendValueInput('car');
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+Blockly.Msg.MIXGO_PROXIMITY_SENSOR);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
@@ -571,3 +571,114 @@ export const requests_attribute2 = {
|
||||
this.setOutput(true, String);
|
||||
}
|
||||
};
|
||||
|
||||
//educore_networke
|
||||
export const educore_wifi_connect = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_IOT_CONNECT_WIFI);
|
||||
this.appendValueInput('WIFINAME')
|
||||
.setCheck(String)
|
||||
.appendField(Blockly.Msg.HTML_NAME);
|
||||
this.appendValueInput('PASSWORD')
|
||||
.setCheck(String)
|
||||
.appendField(Blockly.Msg.HTML_PASSWORD);
|
||||
this.appendValueInput('TIMEOUT')
|
||||
.setCheck(Number)
|
||||
.appendField(Blockly.Msg.MIXLY_IR_TIMEOUT);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MILLIS)
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_IOT_WIFI_CONNECT_TOOLTIP);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const educore_mqtt_connect = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_IOT_EMQX_CONNECT_TOOLTIP);
|
||||
this.appendValueInput('SERVER')
|
||||
.setCheck(String)
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_SERVER)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
this.appendValueInput('PORT')
|
||||
.setCheck(Number)
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_PORT)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
this.appendValueInput('CLIENT_ID')
|
||||
.setCheck(String)
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_CLIENT_ID)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
this.appendValueInput('USERNAME')
|
||||
.setCheck(String)
|
||||
.appendField(Blockly.Msg.MIXLY_WIFI_USERNAME)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
this.appendValueInput('PASSWORD')
|
||||
.setCheck(String)
|
||||
.appendField(Blockly.Msg.MIXLY_IOT_PASSWORD)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_mqtt_subscribe_message = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendValueInput('TOPIC')
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_SUBSCRIBE + Blockly.Msg.MIXLY_MICROBIT_MSG)
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_TOPIC);
|
||||
this.appendValueInput('MESSAGE')
|
||||
.appendField(Blockly.Msg.blockpy_set_of);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_mqtt_topic_subscribe = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField("mqtt")
|
||||
this.appendValueInput('TOPIC')
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_SUBSCRIBE + Blockly.Msg.MIXLY_MICROBIT_MSG)
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_TOPIC);
|
||||
this.appendValueInput('METHOD')
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_SET_METHOD);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_mqtt_topic_publish = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField("mqtt")
|
||||
this.appendValueInput('TOPIC')
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_NEW)
|
||||
.appendField(Blockly.Msg.MIXLY_EMQX_PUBLISH_TOPIC);
|
||||
this.appendValueInput('MSG')
|
||||
.appendField(Blockly.Msg.HTML_BODY);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_mqtt_connect_success = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField("mqtt"+Blockly.Msg.MIXLY_EMQX_IS_CONNECT)
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
@@ -2033,3 +2033,142 @@ export const sensor_weather_solo_rain = {
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
//educore sensor_extern
|
||||
export const educore_body_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_BODY_SENSOR);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_soilhum_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_SOILHUM_SENSOR);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_temphum_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_TEMP_AND_HUMIDITY_SENSOR);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_infrared_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_Infrared_pyroelectric_sensor);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_button_sensor_extern = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.HTML_BUTTON);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const sensor_read_humiture = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_set_of)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_TEMPERATURE,"0"],
|
||||
[Blockly.Msg.MIXLY_Humidity,"1"]
|
||||
]),"key");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_ultrasonic_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_EXTERN_SONAR);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const ultrasonic_sensor_read_distance = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_set_of+Blockly.Msg.ME_GO_HALL_SENSOR_DISTANCE);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_temp_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_TEMP + Blockly.Msg.MIXLY_DS18B20);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_camera_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_SMARTCAMERA);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const camera_sensor_init = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
.appendField(Blockly.Msg.MIXLY_SMARTCAMERA);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_PROCCED)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_AipFace,"FACE_RECOGNIZE"],
|
||||
[Blockly.Msg.MIXLY_FACE_CLASSIFIER,"FACE_DETECT"]
|
||||
]),"key");
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const camera_sensor_result = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
.appendField(Blockly.Msg.MIXLY_SMARTCAMERA);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_set_of + Blockly.Msg.MIXLY_RECOGNIZED_RESULT);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
@@ -1374,4 +1374,142 @@ export const sensor_pin_near = sensor_mixgo_pin_near;
|
||||
export const sensor_light = sensor_mixgo_light;
|
||||
export const dht11 = sensor_dht11;
|
||||
export const sensor_field_strength = sensor_mpu9250_field_strength;
|
||||
export const sensor_temperature = sensor_mpu9250_temperature
|
||||
export const sensor_temperature = sensor_mpu9250_temperature
|
||||
|
||||
//educore sensor_onboard
|
||||
export const educore_voice_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_EXTERN_SOUND);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const sensor_read = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_set_of + Blockly.Msg.MIXLY_MICROBIT_JS_I2C_VALUE);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_light_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_LIGHT_SENSOR);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_gyroscope_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_GYROSCOPE_SENSOR);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_gyroscope_sensor_read = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_Horizontal_inclination, "X"],
|
||||
["y", "[1]"],
|
||||
["z", "[2]"]
|
||||
]), "key");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_gyroscope_sensor_shake = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_BE_SHAKED)
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_button_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_BUTTON)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["a", "a"],
|
||||
["b", "b"],
|
||||
["c", "c"]
|
||||
]), "btn");
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_button_was_pressed = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_BUTTON);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_WAS_PRESSED);
|
||||
this.setOutput(true, Boolean);
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_SENOR_WAS_PRESSED);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_rfid_sensor = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendValueInput("PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_INITIAL);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_rfid_sensor_scan = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_READ);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const educore_rfid_sensor_scan_data = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendValueInput("SUB")
|
||||
.appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_READ + Blockly.Msg.MIXLY_COMMUNICATION_DATA_FROM);
|
||||
this.appendDummyInput('')
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_SERIAL_NUMBER,"serial_number"]
|
||||
]),"key");
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user