Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extern/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1124,8 +1124,8 @@ Lang.Blocks = {
EXPANSION_WEATHER_finedust: 'concentration of fine dust(㎍)',
ardublock_motor_forward: 'Forward',
ardublock_motor_backward: 'Backward',
ARDUINO_on: 'On',
ARDUINO_off: 'Off',
ARDUINO_on: 'Turn on',
ARDUINO_off: 'Turn off',
EXPANSION_FESTIVAL_title: 'Title',
EXPANSION_FESTIVAL_area: 'area',
EXPANSION_FESTIVAL_start_date: 'start date',
Expand Down
74 changes: 46 additions & 28 deletions src/playground/blocks/hardware/block_arduino.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,62 +22,62 @@ Entry.Arduino = {
width: 605,
height: 434,
listPorts: {
'2': {
2: {
name: `${Lang.Hw.port_en} 2 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'3': {
3: {
name: `${Lang.Hw.port_en} 3 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'4': {
4: {
name: `${Lang.Hw.port_en} 4 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'5': {
5: {
name: `${Lang.Hw.port_en} 5 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'6': {
6: {
name: `${Lang.Hw.port_en} 6 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'7': {
7: {
name: `${Lang.Hw.port_en} 7 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'8': {
8: {
name: `${Lang.Hw.port_en} 8 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'9': {
9: {
name: `${Lang.Hw.port_en} 9 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'10': {
10: {
name: `${Lang.Hw.port_en} 10 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'11': {
11: {
name: `${Lang.Hw.port_en} 11 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'12': {
12: {
name: `${Lang.Hw.port_en} 12 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
},
'13': {
13: {
name: `${Lang.Hw.port_en} 13 ${Lang.Hw.port_ko}`,
type: 'input',
pos: { x: 0, y: 0 },
Expand Down Expand Up @@ -117,37 +117,55 @@ Entry.Arduino = {
},
};

Entry.Arduino.setLanguage = function() {
Entry.Arduino.setLanguage = function () {
return {
ko: {
template: {
arduino_get_number_sensor_value: '아날로그 %1 번 센서값 ',
arduino_get_digital_value: '디지털 %1 번 센서값 ',
arduino_get_number_sensor_value: '아날로그 %1 번 ',
arduino_get_digital_value: '디지털 %1 번 ',
arduino_toggle_led: '디지털 %1 번 핀 %2 %3',
arduino_toggle_pwm: '디지털 %1 번 핀을 %2 (으)로 정하기 %3',
arduino_convert_scale: '%1 값의 범위를 %2 ~ %3 에서 %4 ~ %5 (으)로 바꾼값 ',
arduino_convert_scale: '%1 값의 범위를 %2 ~ %3 에서 %4 ~ %5 (으)로 바꾼 값',
},
Device: {
arduino: '아두이노',
},
Menus: {
arduino: '아두이노',
},
Helper: {
arduino_get_number_sensor_value: '선택한 핀의 아날로그 값입니다. (0 ~ 1023)',
arduino_convert_scale: '선택한 핀의 아날로그 값을 입력한 범위로 바꾼 값입니다.',
arduino_get_digital_value:
'선택한 핀의 디지털 값입니다. 핀이 켜진 경우 "참"으로 판단합니다.',
arduino_toggle_led: '선택한 핀을 켜거나 끕니다.',
arduino_toggle_pwm: '선택한 핀을 입력한 값으로 정합니다.',
},
},
en: {
template: {
arduino_get_number_sensor_value: 'Analog %1 Sensor value ',
arduino_get_digital_value: 'Digital %1 Sensor value ',
arduino_toggle_led: 'Digital %1 Pin %2 %3',
arduino_toggle_pwm: 'Digital %1 Pin %2 %3',
arduino_convert_scale: 'Map Value %1 %2 ~ %3 to %4 ~ %5 ',
arduino_get_number_sensor_value: 'analog %1 value ',
arduino_get_digital_value: 'Digital %1 value ',
arduino_toggle_led: '%2 digital %1 pin %3',
arduino_toggle_pwm: 'Set digital %1 pin to %2 %3',
arduino_convert_scale: 'mapped value of analog %1 that %2 ~ %3 to %4 ~ %5',
},
Device: {
arduino: 'arduino',
},
Menus: {
arduino: 'Arduino',
},
Helper: {
arduino_get_number_sensor_value:
'Reports the value that analog signal of the selected pin. (0 ~ 1023)',
arduino_convert_scale:
'Reports the value that analog signal of the selected pin mapping original range onto input range.',
arduino_get_digital_value:
'Checks whether the selected pin is turned on. If it turned on, it is judged as "True".',
arduino_toggle_led: 'Turn on or turn off the selected pin.',
arduino_toggle_pwm: 'Set the selected pin to input value.',
},
},
};
};
Expand All @@ -160,7 +178,7 @@ Entry.Arduino.blockMenuBlocks = [
'arduino_convert_scale',
];

Entry.Arduino.getBlocks = function() {
Entry.Arduino.getBlocks = function () {
return {
//region arduino 아두이노
arduino_text: {
Expand Down Expand Up @@ -208,12 +226,12 @@ Entry.Arduino.getBlocks = function() {
{
type: 'Dropdown',
options: [
['0', 'A0'],
['1', 'A1'],
['2', 'A2'],
['3', 'A3'],
['4', 'A4'],
['5', 'A5'],
['A0', 'A0'],
['A1', 'A1'],
['A2', 'A2'],
['A3', 'A3'],
['A4', 'A4'],
['A5', 'A5'],
],
value: 'A0',
fontSize: 11,
Expand Down
64 changes: 42 additions & 22 deletions src/playground/blocks/hardware/block_arduino_ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Entry.ArduinoExt = {
TIMER: 8,
},
toneTable: {
'0': 0,
0: 0,
C: 1,
CS: 2,
D: 3,
Expand All @@ -51,49 +51,66 @@ Entry.ArduinoExt = {
B: 12,
},
toneMap: {
'1': [33, 65, 131, 262, 523, 1046, 2093, 4186],
'2': [35, 69, 139, 277, 554, 1109, 2217, 4435],
'3': [37, 73, 147, 294, 587, 1175, 2349, 4699],
'4': [39, 78, 156, 311, 622, 1245, 2849, 4978],
'5': [41, 82, 165, 330, 659, 1319, 2637, 5274],
'6': [44, 87, 175, 349, 698, 1397, 2794, 5588],
'7': [46, 92, 185, 370, 740, 1480, 2960, 5920],
'8': [49, 98, 196, 392, 784, 1568, 3136, 6272],
'9': [52, 104, 208, 415, 831, 1661, 3322, 6645],
'10': [55, 110, 220, 440, 880, 1760, 3520, 7040],
'11': [58, 117, 233, 466, 932, 1865, 3729, 7459],
'12': [62, 123, 247, 494, 988, 1976, 3951, 7902],
1: [33, 65, 131, 262, 523, 1046, 2093, 4186],
2: [35, 69, 139, 277, 554, 1109, 2217, 4435],
3: [37, 73, 147, 294, 587, 1175, 2349, 4699],
4: [39, 78, 156, 311, 622, 1245, 2849, 4978],
5: [41, 82, 165, 330, 659, 1319, 2637, 5274],
6: [44, 87, 175, 349, 698, 1397, 2794, 5588],
7: [46, 92, 185, 370, 740, 1480, 2960, 5920],
8: [49, 98, 196, 392, 784, 1568, 3136, 6272],
9: [52, 104, 208, 415, 831, 1661, 3322, 6645],
10: [55, 110, 220, 440, 880, 1760, 3520, 7040],
11: [58, 117, 233, 466, 932, 1865, 3729, 7459],
12: [62, 123, 247, 494, 988, 1976, 3951, 7902],
},
highList: ['high', '1', 'on'],
lowList: ['low', '0', 'off'],
BlockState: {},
};

Entry.ArduinoExt.setLanguage = function() {
Entry.ArduinoExt.setLanguage = function () {
return {
ko: {
template: {
arduino_ext_get_analog_value: '아날로그 %1 번 센서값',
arduino_ext_get_analog_value_map: '%1 의 범위를 %2 ~ %3 에서 %4 ~ %5 로 바꾼값',
arduino_ext_get_ultrasonic_value: '울트라소닉 Trig %1 Echo %2 센서값',
arduino_ext_get_ultrasonic_value:
'디지털 %1 번 핀을 Trig에 디지털 %2 핀을 Echo에 연결한 초음파 센서 값',
arduino_ext_toggle_led: '디지털 %1 번 핀 %2 %3',
arduino_ext_digital_pwm: '디지털 %1 번 핀을 %2 (으)로 정하기 %3',
arduino_ext_set_tone: '디지털 %1 번 핀의 버저를 %2 %3 음으로 %4 초 연주하기 %5',
arduino_ext_set_servo: '디지털 %1 번 핀의 서보모터를 %2 의 각도로 정하기 %3',
arduino_ext_set_tone: '디지털 %1 번 핀의 버저를 %2 %3 음으로 %4 초 울리기 %5',
arduino_ext_set_servo: '디지털 %1 번 핀의 서보모터를 %2 도로 정하기 %3',
arduino_ext_get_digital: '디지털 %1 번 센서값',
},
Helper: {
arduino_ext_get_ultrasonic_value: '선택한 핀에 연결한 초음파 센서 값입니다.',
arduino_ext_set_servo: '선택한 핀에 연결한 서보모터의 각도를 정합니다.',
arduino_ext_set_tone:
'선택한 핀에 연결한 버저를 선택한 음으로 입력한 시간 동안 울립니다.',
},
},
en: {
template: {
arduino_ext_get_analog_value: 'Analog %1 Sensor value',
arduino_ext_get_analog_value_map: 'Map Value %1 %2 ~ %3 to %4 ~ %5',
arduino_ext_get_ultrasonic_value: 'Read ultrasonic sensor trig pin %1 echo pin %2',
arduino_ext_get_ultrasonic_value:
'ultrasonic sensor value that connects pin %1 to Trig and pin %2 to Echo',
arduino_ext_toggle_led: 'Digital %1 Pin %2 %3',
arduino_ext_digital_pwm: 'Digital %1 Pin %2 %3',
arduino_ext_set_tone: 'Play tone pin %1 on note %2 octave %3 beat %4 %5',
arduino_ext_set_servo: 'Set servo pin %1 angle as %2 %3',
arduino_ext_set_tone:
'Ring buzzer of pin %1 on note %2 octave %3 for %4 second(s) %5',
arduino_ext_set_servo: 'Set servo motor of pin %1 to %2 degree %3',
arduino_ext_get_digital: 'Digital %1 Sensor value',
},
Helper: {
arduino_ext_get_ultrasonic_value:
'Reports the value of ultrasonic sensor that connects pin.',
arduino_ext_set_servo:
'Set the degree of servo motor that connected with selected pin.',
arduino_ext_set_tone:
'Rings buzzer connected with selected pin during input seconds.',
},
},
};
};
Expand All @@ -110,7 +127,7 @@ Entry.ArduinoExt.blockMenuBlocks = [
];

//region arduinoExt 아두이노 확장모드
Entry.ArduinoExt.getBlocks = function() {
Entry.ArduinoExt.getBlocks = function () {
return {
arduino_ext_analog_list: {
color: EntryStatic.colorSet.block.default.HARDWARE,
Expand Down Expand Up @@ -518,7 +535,10 @@ Entry.ArduinoExt.getBlocks = function() {
params: [
{
type: 'Dropdown',
options: [[Lang.Blocks.ARDUINO_on, 'on'], [Lang.Blocks.ARDUINO_off, 'off']],
options: [
[Lang.Blocks.ARDUINO_on, 'on'],
[Lang.Blocks.ARDUINO_off, 'off'],
],
value: 'on',
fontSize: 11,
bgColor: EntryStatic.colorSet.block.darken.HARDWARE,
Expand Down
Loading