Skip to content
Open
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
2 changes: 1 addition & 1 deletion extensions/apds9960/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const apds9960 = formatMessage => ({
extensionId: 'apds9960',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266'],
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/apds9960.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/chineseTTS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const chineseTTS = formatMessage => ({
extensionId: 'chineseTTS',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266'],
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/chineseTTS.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/cooperativeScheduler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const cooperativeScheduler = formatMessage => ({
}),
extensionId: 'cooperativeScheduler',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo', 'arduinoMega2560'],
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo', 'arduinoMega2560', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/cooperativeScheduler.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/dht/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const dht = formatMessage => ({
extensionId: 'dht',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266'],
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/dht.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/ds18b20/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ds18b20 = formatMessage => ({
extensionId: 'ds18b20',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266'],
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/ds18b20.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/eightDigitDisplay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const eightDigitDisplay = formatMessage => ({
extensionId: 'eightDigitDisplay',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32'],
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/eightDigitDisplay.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/eitghtTimesEightMatirxDisplay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const eitghtTimesEightMatirxDisplay = formatMessage => ({
extensionId: 'eitghtTimesEightMatirxDisplay',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32'],
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/eitghtTimesEightMatirxDisplay.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/fourDigitClockDisplay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fourDigitClockDisplay = formatMessage => ({
extensionId: 'fourDigitClockDisplay',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32'],
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/fourDigitClockDisplay.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/insertSourceCode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const insertSourceCode = formatMessage => ({
extensionId: 'insertSourceCode',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266'],
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/insertSourceCode.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/irRemoteReceiver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const irRemoteReceiver = formatMessage => ({
extensionId: 'irRemoteReceiver',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266'],
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/irRemoteReceiver.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/l298n/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const l298n = formatMessage => ({
extensionId: 'l298n',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp8266'],
'arduinoMega2560', 'arduinoEsp8266', 'lgt8f328pNano'],
author: 'Liang',
iconURL: `assets/l298n.png`,
description: formatMessage({
Expand Down
2 changes: 1 addition & 1 deletion extensions/lcd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const lcd = formatMessage => ({
extensionId: 'lcd',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32'],
'arduinoMega2560', 'arduinoEsp8266', 'arduinoEsp32', 'lgt8f328pNano'],
author: 'ArthurZheng',
iconURL: `assets/lcd.png`,
description: formatMessage({
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
175 changes: 175 additions & 0 deletions extensions/lcd_keypad_shield/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/* eslint-disable func-style */
/* eslint-disable max-len */
/* eslint-disable require-jsdoc */
function registerBlocks (Blockly) {
const colour = '#BBBB00';
const secondaryColour = '#888800';

Blockly.Blocks.lcd_init = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_INIT,
colour: colour,
secondaryColour: secondaryColour,
extensions: ['shape_statement']
});
}
};

Blockly.Blocks.lcd_setCursorPosition = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_SETCURSORPOSITION,
args0: [
{
type: 'input_value',
name: 'X'
},
{
type: 'input_value',
name: 'Y'
}
],
colour: colour,
secondaryColour: secondaryColour,
extensions: ['shape_statement']
});
}
};

Blockly.Blocks.lcd_print = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_PRINT,
args0: [
{
type: 'input_value',
name: 'DATA'
}
],
colour: colour,
secondaryColour: secondaryColour,
extensions: ['shape_statement']
});
}
};

Blockly.Blocks.lcd_clear = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_CLEAR,
colour: colour,
secondaryColour: secondaryColour,
extensions: ['shape_statement']
});
}
};

Blockly.Blocks.lcd_setBackLight = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_SETBACKLIGHT,
args0: [
{
type: 'field_dropdown',
name: 'STATE',
options: [
[Blockly.Msg.LCD_SATE_ON, 'on'],
[Blockly.Msg.LCD_SATE_OFF, 'off']
]
}
],
colour: colour,
secondaryColour: secondaryColour,
extensions: ['shape_statement']
});
}
};

Blockly.Blocks.lcd_setCursorStyle = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_SETCURSORSTYLE,
args0: [
{
type: 'field_dropdown',
name: 'STATE',
options: [
[Blockly.Msg.LCD_SATE_DISPLAY, 'display'],
[Blockly.Msg.LCD_SATE_HIDE, 'hide']
]
},
{
type: 'field_dropdown',
name: 'STYLE',
options: [
[Blockly.Msg.LCD_STYLE_BLINK, 'blink'],
[Blockly.Msg.LCD_STYLE_NOBLINK, 'onBlink']
]
}
],
colour: colour,
secondaryColour: secondaryColour,
extensions: ['shape_statement']
});
}
};

Blockly.Blocks.lcd_left = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_LEFT,
colour: colour,
secondaryColour: secondaryColour,
extensions: ['output_boolean']
});
}
};

Blockly.Blocks.lcd_right = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_RIGHT,
colour: colour,
secondaryColour: secondaryColour,
extensions: ['output_boolean']
});
}
};

Blockly.Blocks.lcd_select = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_SELECT,
colour: colour,
secondaryColour: secondaryColour,
extensions: ['output_boolean']
});
}
};

Blockly.Blocks.lcd_up = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_UP,
colour: colour,
secondaryColour: secondaryColour,
extensions: ['output_boolean']
});
}
};

Blockly.Blocks.lcd_down = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.LCD_DOWN,
colour: colour,
secondaryColour: secondaryColour,
extensions: ['output_boolean']
});
}
};
return Blockly;
}

exports = registerBlocks;
80 changes: 80 additions & 0 deletions extensions/lcd_keypad_shield/generator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* eslint-disable func-style */
/* eslint-disable max-len */
/* eslint-disable require-jsdoc */
function registerGenerators (Blockly) {
Blockly.Arduino.lcd_init = function () {
Blockly.Arduino.includes_.lcd_init = `#include <Wire.h>\n#include <LiquidCrystal.h>
#define __lcdks_pressed(x,y)({int value = analogRead(A0);value>x && value < y;})`;
Blockly.Arduino.definitions_.lcd_init = `LiquidCrystal lcd( 8, 9, 4, 5, 6, 7);`;

return `lcd.begin(16, 2);\n`;
};

Blockly.Arduino.lcd_setCursorPosition = function (block) {
const x = Blockly.Arduino.valueToCode(block, 'X', Blockly.Arduino.ORDER_ATOMIC);
const y = Blockly.Arduino.valueToCode(block, 'Y', Blockly.Arduino.ORDER_ATOMIC);

return `lcd.setCursor(${x}, ${y});\n`;
};

Blockly.Arduino.lcd_print = function (block) {
const data = Blockly.Arduino.valueToCode(block, 'DATA', Blockly.Arduino.ORDER_ATOMIC);

return `lcd.print(${data});\n`;
};

Blockly.Arduino.lcd_clear = function () {
return `lcd.clear();\n`;
};

Blockly.Arduino.lcd_setBackLight = function (block) {
const state = block.getFieldValue('STATE');

if (state === 'on') {
return `lcd.backlight();\n`;
}
return `lcd.noBacklight();\n`;
};

Blockly.Arduino.lcd_setCursorStyle = function (block) {
const state = block.getFieldValue('STATE');
const style = block.getFieldValue('STYLE');

let code = '';

if (state === 'display') {
code += `lcd.cursor();\n`;
} else {
code += `lcd.noCursor();\n`;
}

if (style === 'blink') {
code += `lcd.blink();\n`;
} else {
code += `lcd.noBlink();\n`;
}

return code;
};

Blockly.Arduino.lcd_right = function (block) {
return [`__lcdks_pressed(0,60)`, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.lcd_up = function (block) {
return [`__lcdks_pressed(60,200)`, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.lcd_down = function (block) {
return [`__lcdks_pressed(200,400)`, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.lcd_left = function (block) {
return [`__lcdks_pressed(400,600)`, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.lcd_select = function (block) {
return [`__lcdks_pressed(600,800)`, Blockly.Arduino.ORDER_ATOMIC];
};


return Blockly;
}

exports = registerGenerators;
27 changes: 27 additions & 0 deletions extensions/lcd_keypad_shield/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const lcd = formatMessage => ({
name: formatMessage({
id: 'lcdks.name',
default: 'LCD Keypad Shield'
}),
extensionId: 'lcdks',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoLeonardo',
'arduinoMega2560'],
author: 'Kautism',
iconURL: `assets/lcd_keypad_shield.png`,
description: formatMessage({
id: 'lcdks.description',
default: '1602 liquid crystal display with keypad contains 5 keys.'
}),
featured: true,
blocks: 'blocks.js',
generator: 'generator.js',
toolbox: 'toolbox.js',
translations: 'translations.js',
library: 'lib',
official: true,
tags: ['display'],
helpLink: 'https://wiki.dfrobot.com/LCD_KeyPad_Shield_For_Arduino_SKU__DFR0009'
});

module.exports = lcd;
Loading