Merge branch 'master' into development

This commit is contained in:
Mario Pesch 2022-02-17 11:15:24 +01:00
commit 2609e56953
53 changed files with 2426 additions and 41616 deletions

2
.env
View File

@ -1,4 +1,4 @@
REACT_APP_COMPILER_URL=https://compiler.sensebox.de
REACT_APP_COMPILER_URL=https://test.compiler.sensebox.de
REACT_APP_BOARD=sensebox-mcu
REACT_APP_BLOCKLY_API=https://api.blockly.sensebox.de

40302
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
"@monaco-editor/react": "^4.3.1",
"@sentry/react": "^6.0.0",
"@sentry/tracing": "^6.0.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.22.0",
"blockly": "^7.20211209.0",

View File

@ -1,4 +1,11 @@
import { VISIT, LANGUAGE, RENDERER, STATISTICS, PLATFORM } from "./types";
import {
VISIT,
LANGUAGE,
RENDERER,
SOUNDS,
STATISTICS,
PLATFORM,
} from "./types";
export const visitPage = () => (dispatch) => {
dispatch({
@ -30,6 +37,13 @@ export const setRenderer = (renderer) => (dispatch) => {
});
};
export const setSounds = (sounds) => (dispatch) => {
dispatch({
type: SOUNDS,
payload: sounds,
});
};
export const setStatistics = (showStatistics) => (dispatch) => {
dispatch({
type: STATISTICS,

View File

@ -45,6 +45,7 @@ export const VISIT = "VISIT";
export const LANGUAGE = "LANGUAGE";
export const PLATFORM = "PLATFORM";
export const RENDERER = "RENDERER";
export const SOUNDS = "SOUNDS";
export const STATISTICS = "STATISTICS";
// messages

View File

@ -76,6 +76,7 @@ class BlocklyWindow extends Component {
this.props.trashcan !== undefined ? this.props.trashcan : true
}
renderer={this.props.renderer}
sounds={this.props.sounds}
maxInstances={getMaxInstances()}
zoom={{
// https://developers.google.com/blockly/guides/configure/web/zoom
@ -127,11 +128,13 @@ BlocklyWindow.propTypes = {
onChangeWorkspace: PropTypes.func.isRequired,
clearStats: PropTypes.func.isRequired,
renderer: PropTypes.string.isRequired,
sounds: PropTypes.string.isRequired,
language: PropTypes.string.isRequired,
};
const mapStateToProps = (state) => ({
renderer: state.general.renderer,
sounds: state.general.sounds,
language: state.general.language,
});

View File

@ -18,9 +18,11 @@ import "./audio";
import "./math";
import "./map";
import "./procedures";
import "./serial";
import "./time";
import "./variables";
import "./lists";
import "./watchdog";
import "./webserver";
import "../helpers/types";

View File

@ -4,6 +4,7 @@ import { getColour } from "../helpers/colour";
Blockly.Blocks["sensebox_phyphox_init"] = {
init: function () {
this.setColour(getColour().phyphox);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_phyphox_init)
.appendField(new Blockly.FieldTextInput("Geräte Name"), "devicename");
@ -37,6 +38,7 @@ Blockly.Blocks["sensebox_phyphox_experiment"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_experiment_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@ -77,6 +79,7 @@ Blockly.Blocks["sensebox_phyphox_graph"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_graph_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@ -86,6 +89,7 @@ Blockly.Blocks["sensebox_phyphox_timestamp"] = {
this.appendDummyInput().appendField(Blockly.Msg.sensebox_phyphox_timestamp);
this.setOutput(true);
this.setTooltip(Blockly.Msg.sensebox_phyphox_timestamp_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@ -107,6 +111,7 @@ Blockly.Blocks["sensebox_phyphox_channel"] = {
this.setOutput(true);
this.setTooltip(Blockly.Msg.sensebox_phyphox_channel_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@ -129,6 +134,7 @@ Blockly.Blocks["sensebox_phyphox_sendchannel"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_sendchannel_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};
@ -141,5 +147,6 @@ Blockly.Blocks["sensebox_phyphox_experiment_send"] = {
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.sensebox_phyphox_experiment_send_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_phyphox_helpurl);
},
};

View File

@ -158,7 +158,8 @@ Blockly.Blocks["sensebox_lora_ttn_mapper"] = {
this.appendValueInput("Fix Type").appendField("Fix Type").setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tip);
this.setTooltip(Blockly.Msg.sensebox_lora_ttn_mapper_tip);
this.setHelpUrl(Blockly.Msg.sensebox_lora_ttn_mapper_helpurl);
},
};
@ -299,3 +300,21 @@ Blockly.Blocks["sensebox_lora_cayenne_gps"] = {
},
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
};
Blockly.Blocks["sensebox_lora_cayenne_concentration"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_LoRa_cayenne_concentration_tip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendValueInput("Value").appendField(
Blockly.Msg.senseBox_LoRa_cayenne_concentration
);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_LoRa_cayenne_channel)
.appendField(new Blockly.FieldTextInput("1"), "CHANNEL");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
LOOP_TYPES: ["sensebox_lora_cayenne_send"],
};

View File

@ -1,202 +1,199 @@
import * as Blockly from 'blockly/core';
import { getColour } from '../helpers/colour';
import * as Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
import store from '../../../store';
import store from "../../../store";
var boxes = store.getState().auth.user ? store.getState().auth.user.boxes : null;
var boxes = store.getState().auth.user
? store.getState().auth.user.boxes
: null;
store.subscribe(() => {
boxes = store.getState().auth.user ? store.getState().auth.user.boxes : null;
boxes = store.getState().auth.user ? store.getState().auth.user.boxes : null;
});
var selectedBox = '';
var selectedBox = "";
Blockly.Blocks["sensebox_osem_connection"] = {
init: function () {
var ssl = "TRUE";
this.setTooltip(Blockly.Msg.senseBox_osem_connection_tip);
this.setHelpUrl(Blockly.Msg.senseBox_osem_connection_helpurl);
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_osem_connection)
.appendField("SSL")
.appendField(new Blockly.FieldCheckbox(ssl), "SSL");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_osem_restart)
.appendField(new Blockly.FieldCheckbox("TRUE"), "RESTART");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_exposure)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_osem_stationary, "Stationary"],
[Blockly.Msg.senseBox_osem_mobile, "Mobile"],
]),
"type"
);
if (!boxes) {
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldTextInput("senseBox ID"), "BoxID");
} else {
var dropdown = [];
for (var i = 0; i < boxes.length; i++) {
dropdown.push([boxes[i].name, boxes[i]._id]);
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldDropdown(dropdown), "BoxID");
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_access_token)
.appendField(new Blockly.FieldTextInput("access_token"), "access_token");
this.appendStatementInput("DO")
.appendField(Blockly.Msg.senseBox_sensor)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.getField("type").setValidator(
function (val) {
this.updateShape_(val === "Mobile");
}.bind(this)
);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
Blockly.Blocks['sensebox_osem_connection'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_osem_connection_tip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_osem_connection)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_osem_host, '"ingress.opensensemap.org"'], [Blockly.Msg.senseBox_osem_host_workshop, '"ingress.workshop.opensensemap.org"']]), "host")
.appendField('SSL')
.appendField(new Blockly.FieldCheckbox("TRUE"), "SSL");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_exposure)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_osem_stationary, 'Stationary'], [Blockly.Msg.senseBox_osem_mobile, 'Mobile']]), "type");
if (!boxes) {
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldTextInput("senseBox ID"), "BoxID");
} else {
var dropdown = []
for (var i = 0; i < boxes.length; i++) {
dropdown.push([boxes[i].name, boxes[i]._id])
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("senseBox ID")
.appendField(new Blockly.FieldDropdown(dropdown), 'BoxID');
}
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_osem_access_token)
.appendField(new Blockly.FieldTextInput("access_token"), "access_token");
this.appendStatementInput('DO')
.appendField(Blockly.Msg.senseBox_sensor)
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
/**
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
selectedBox = this.getFieldValue('BoxID');
if (selectedBox !== '' && boxes) {
var accessToken = boxes.find(element => element._id === selectedBox).access_token
if (accessToken !== undefined) {
this.getField('access_token').setValue(accessToken)
} else {
this.getField('access_token').setValue('access_token')
}
}
},
mutationToDom: function () {
var container = document.createElement('mutation');
var input = this.getFieldValue('type');
this.updateShape_(input);
container.setAttribute('type', input);
return container;
},
domToMutation: function (xmlElement) {
var connections = xmlElement.getAttribute('connections');
this.updateShape_(connections);
},
/**
* Modify this block to have the correct number of pins available.
* @param {boolean}
* @private
* @this Blockly.Block
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
updateShape_: function () {
var extraFieldExist = this.getFieldValue('gps');
var input = this.getFieldValue('type');
if ((input === 'Mobile') && extraFieldExist === null) {
this.appendValueInput('lat', 'Number')
.appendField(Blockly.Msg.senseBox_gps_lat, 'gps');
this.appendValueInput('lng', 'Number')
.appendField(Blockly.Msg.senseBox_gps_lng);
this.appendValueInput('altitude', 'Number')
.appendField(Blockly.Msg.senseBox_gps_alt);
this.appendValueInput('timeStamp', 'Number')
.appendField(Blockly.Msg.senseBox_gps_timeStamp);
}
if (input === 'Stationary' && extraFieldExist !== null) {
this.removeInput('lat');
this.removeInput('lng');
this.removeInput('altitude');
this.removeInput('timeStamp');
}
},
LOOP_TYPES: ['sensebox_interval_timer']
selectedBox = this.getFieldValue("BoxID");
if (selectedBox !== "" && boxes) {
var accessToken = boxes.find(
(element) => element._id === selectedBox
).access_token;
if (accessToken !== undefined) {
this.getField("access_token").setValue(accessToken);
} else {
this.getField("access_token").setValue("access_token");
}
}
},
updateShape_(isMobile) {
if (isMobile) {
if (this.getInput("lat") == null) {
this.appendValueInput("lat", "Number").appendField(
Blockly.Msg.senseBox_gps_lat,
"gps"
);
this.appendValueInput("lng", "Number").appendField(
Blockly.Msg.senseBox_gps_lng
);
this.appendValueInput("altitude", "Number").appendField(
Blockly.Msg.senseBox_gps_alt
);
this.appendValueInput("timeStamp", "Number").appendField(
Blockly.Msg.senseBox_gps_timeStamp
);
}
} else {
this.removeInput("lat", true);
this.removeInput("lng", true);
this.removeInput("altitude", true);
this.removeInput("timeStamp", true);
}
},
LOOP_TYPES: ["sensebox_interval_timer"],
};
Blockly.Blocks['sensebox_send_to_osem'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_send_to_osem_tip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_send_to_osem);
if (boxes) {
this.appendValueInput('Value')
.appendField('Phänomen')
.appendField(new Blockly.FieldDropdown(
this.generateOptions), 'SensorID');
} else {
this.appendValueInput('Value')
.setAlign(Blockly.ALIGN_LEFT)
.appendField('Phänomen')
.appendField(new Blockly.FieldTextInput(
'sensorID'), 'SensorID')
Blockly.Blocks["sensebox_send_to_osem"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_send_to_osem_tip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_send_to_osem);
if (boxes) {
this.appendValueInput("Value")
.appendField("Phänomen")
.appendField(
new Blockly.FieldDropdown(this.generateOptions),
"SensorID"
);
} else {
this.appendValueInput("Value")
.setAlign(Blockly.ALIGN_LEFT)
.appendField("Phänomen")
.appendField(new Blockly.FieldTextInput("sensorID"), "SensorID");
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
generateOptions: function () {
var dropdown = [["", ""]];
var boxID = selectedBox;
if (boxID !== "" && boxes) {
let box = boxes.find((el) => el._id === boxID);
if (box !== undefined) {
for (var i = 0; i < box.sensors.length; i++) {
dropdown.push([box.sensors[i].title, box.sensors[i]._id]);
}
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
generateOptions: function () {
var dropdown = [['', '']];
var boxID = selectedBox;
if (boxID !== '' && boxes) {
let box = boxes.find(el => el._id === boxID);
if (box !== undefined) {
for (var i = 0; i < box.sensors.length; i++) {
dropdown.push([box.sensors[i].title, box.sensors[i]._id])
}
}
if (dropdown.length > 1) {
var options = dropdown.slice(1)
return options
} else {
return dropdown
}
}
return dropdown
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function () {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
/**
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
LOOP_TYPES: ['sensebox_osem_connection']
}
if (dropdown.length > 1) {
var options = dropdown.slice(1);
return options;
} else {
return dropdown;
}
}
return dropdown;
},
/**
* Called whenever anything on the workspace changes.
* Add warning if block is not nested inside a the correct loop.
* @param {!Blockly.Events.Abstract} e Change event.
* @this Blockly.Block
*/
onchange: function () {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
/**
* List of block types that are loops and thus do not need warnings.
* To add a new loop type add this to your code:
* Blockly.Blocks['controls_flow_statements'].LOOP_TYPES.push('custom_loop');
*/
LOOP_TYPES: ["sensebox_osem_connection"],
};

View File

@ -129,48 +129,35 @@ Blockly.Blocks["sensebox_sd_osem"] = {
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
mutationToDom: function () {
var container = document.createElement("mutation");
var input = this.getFieldValue("type");
this.updateShape_(input);
container.setAttribute("type", input);
return container;
this.getField("type").setValidator(
function (val) {
this.updateShape_(val === "Mobile");
}.bind(this)
);
},
domToMutation: function (xmlElement) {
var connections = xmlElement.getAttribute("connections");
this.updateShape_(connections);
},
/**
* Modify this block to have the correct number of pins available.
* @param {boolean}
* @private
* @this Blockly.Block
*/
updateShape_: function () {
var extraFieldExist = this.getFieldValue("gps");
var input = this.getFieldValue("type");
if (input === "Mobile" && extraFieldExist === null) {
this.appendValueInput("lat", "Number").appendField(
Blockly.Msg.senseBox_gps_lat,
"gps"
);
this.appendValueInput("lng", "Number").appendField(
Blockly.Msg.senseBox_gps_lng
);
this.appendValueInput("altitude", "Number").appendField(
Blockly.Msg.senseBox_gps_alt
);
}
if (input === "Stationary" && extraFieldExist !== null) {
this.removeInput("lat");
this.removeInput("lng");
this.removeInput("altitude");
updateShape_(isMobile) {
if (isMobile) {
if (this.getInput("lat") == null) {
this.appendValueInput("lat", "Number").appendField(
Blockly.Msg.senseBox_gps_lat,
"gps"
);
this.appendValueInput("lng", "Number").appendField(
Blockly.Msg.senseBox_gps_lng
);
this.appendValueInput("altitude", "Number").appendField(
Blockly.Msg.senseBox_gps_alt
);
}
} else {
this.removeInput("lat", true);
this.removeInput("lng", true);
this.removeInput("altitude", true);
}
},
};
Blockly.Blocks["sensebox_sd_save_for_osem"] = {
init: function () {
this.setTooltip(Blockly.Msg.sensebox_sd_save_for_osem_tip);

View File

@ -2,6 +2,7 @@ import Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
import { selectedBoard } from "../helpers/board";
import { FieldGridDropdown } from "@blockly/field-grid-dropdown";
/**
* HDC1080 Temperature and Humidity Sensor
@ -106,8 +107,8 @@ Blockly.Blocks["sensebox_sensor_sds011"] = {
.appendField(Blockly.Msg.senseBox_value)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_sds011_pm25, "Pm25"],
[Blockly.Msg.senseBox_sds011_pm10, "Pm10"],
[Blockly.Msg.senseBox_sds011_pm25, "pm25"],
[Blockly.Msg.senseBox_sds011_pm10, "pm10"],
]),
"NAME"
)
@ -156,50 +157,23 @@ Blockly.Blocks["sensebox_sensor_pressure"] = {
this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.senseBox_pressure_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_pressure_helpurl);
this.getField("NAME").setValidator(
function (val) {
this.updateShape_(val === "Altitude");
}.bind(this)
);
},
/**
* Parse XML to restore the number of pins available.
* @param {!Element} xmlElement XML storage element.
* @this Blockly.Block
*/
domToMutation: function (xmlElement) {
xmlElement.getAttribute("port");
},
/**
* Create XML to represent number of pins selection.
* @return {!Element} XML storage element.
* @this Blockly.Block
*/
mutationToDom: function () {
var container = document.createElement("mutation");
var input = this.getFieldValue("NAME");
this.updateShape_(input);
container.setAttribute("NAME", input);
return container;
},
/**
* Modify this block to have the correct number of pins available.
* @param {boolean}
* @private
* @this Blockly.Block
*/
updateShape_: function () {
var extraFieldExist = this.getFieldValue("referencePressure");
var input = this.getFieldValue("NAME");
if (input === "Altitude" && extraFieldExist === null) {
this.appendDummyInput("extraField")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_pressure_referencePressure)
.appendField(new Blockly.FieldTextInput("1013"), "referencePressure")
.appendField(Blockly.Msg.senseBox_pressure_referencePressure_dim);
}
if (
(input === "Pressure" || input === "Temperature") &&
extraFieldExist !== null
) {
this.removeInput("extraField");
updateShape_(isAltitude) {
if (isAltitude) {
if (this.getInput("extraField") == null) {
this.appendDummyInput("extraField")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_pressure_referencePressure)
.appendField(new Blockly.FieldTextInput("1013"), "referencePressure")
.appendField(Blockly.Msg.senseBox_pressure_referencePressure_dim);
}
} else {
this.removeInput("extraField", true);
}
},
};
@ -245,9 +219,7 @@ Blockly.Blocks["sensebox_sensor_ultrasonic_ranger"] = {
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (
option
) {
var dropdown = new FieldGridDropdown(dropdownOptions, function (option) {
var input = option === "A" || option === "B" || option === "C";
this.sourceBlock_.updateShape_(input);
});
@ -268,6 +240,10 @@ Blockly.Blocks["sensebox_sensor_ultrasonic_ranger"] = {
new Blockly.FieldDropdown(selectedBoard().digitalPins),
"ultrasonic_echo"
);
this.appendDummyInput("maxDistance")
.appendField(Blockly.Msg.senseBox_ultrasonic_maxDistance)
.appendField(new Blockly.FieldTextInput("250"), "maxDistance")
.appendField("cm");
this.setOutput(true, Types.NUMBER.typeName);
this.setTooltip(Blockly.Msg.senseBox_ultrasonic_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_ultrasonic_helpurl);
@ -355,6 +331,7 @@ Blockly.Blocks["sensebox_button"] = {
[Blockly.Msg.senseBox_button_isPressed, "isPressed"],
[Blockly.Msg.senseBox_button_wasPressed, "wasPressed"],
[Blockly.Msg.senseBox_button_switch, "Switch"],
[Blockly.Msg.senseBox_button_longPress, "longPress"],
]),
"FUNCTION"
)
@ -366,6 +343,24 @@ Blockly.Blocks["sensebox_button"] = {
this.setOutput(true, Types.BOOLEAN.typeName);
this.setColour(getColour().sensebox);
this.setTooltip(Blockly.Msg.senseBox_button_tooltip);
this.getField("FUNCTION").setValidator(
function (val) {
this.updateShape_(val === "longPress");
}.bind(this)
);
},
updateShape_(isLongPress) {
if (isLongPress) {
if (this.getInput("extraField") == null) {
this.appendDummyInput("extraField")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_button_longPress_time)
.appendField(new Blockly.FieldTextInput("1000"), "time")
.appendField("ms");
}
} else {
this.removeInput("extraField", true);
}
},
};
@ -519,3 +514,54 @@ Blockly.Blocks["sensebox_soundsensor_dfrobot"] = {
this.setHelpUrl(Blockly.Msg.senseBox_soundsensor_dfrobot_helpurl);
},
};
/**
* Infineon DPS310 Pressure Sensor
*
*/
Blockly.Blocks["sensebox_sensor_dps310"] = {
init: function () {
var dropdownOptions = [
[Blockly.Msg.senseBox_pressure, "Pressure"],
[Blockly.Msg.senseBox_temp, "Temperature"],
[Blockly.Msg.senseBox_gps_alt, "Altitude"],
];
var dropdown = new Blockly.FieldDropdown(dropdownOptions, function (
option
) {
var input =
option === "Pressure" ||
option === "Temperature" ||
option === "Altitude";
this.sourceBlock_.updateShape_(input);
});
this.appendDummyInput().appendField(Blockly.Msg.senseBox_sensor_dps310);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_value)
.appendField(dropdown, "NAME");
this.setColour(getColour().sensebox);
this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.senseBox_sensor_dps310_tooltip);
this.setHelpUrl(Blockly.Msg.senseBox_sensor_dps310_helpurl);
this.getField("NAME").setValidator(
function (val) {
this.updateShape_(val === "Altitude");
}.bind(this)
);
},
updateShape_(isAltitude) {
if (isAltitude) {
if (this.getInput("extraField") == null) {
this.appendDummyInput("extraField")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.senseBox_pressure_referencePressure)
.appendField(new Blockly.FieldTextInput("1013"), "referencePressure")
.appendField(Blockly.Msg.senseBox_pressure_referencePressure_dim);
}
} else {
this.removeInput("extraField", true);
}
},
};

View File

@ -1,60 +1,153 @@
import Blockly from 'blockly';
import { getColour } from '../helpers/colour'
import Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
Blockly.Blocks['sensebox_wifi'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_tooltip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_wifi_connect);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_output_password)
.appendField(new Blockly.FieldTextInput("Password"), "Password");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ['arduino_functions'],
Blockly.Blocks["sensebox_wifi"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_tooltip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_connect);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_output_password)
.appendField(new Blockly.FieldTextInput("Password"), "Password");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
onchange: function (e) {
var legal = false;
// Is the block nested in a loop?
var block = this;
do {
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
legal = true;
break;
}
block = block.getSurroundParent();
} while (block);
if (legal) {
this.setWarningText(null);
} else {
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
}
},
LOOP_TYPES: ["arduino_functions"],
};
Blockly.Blocks['sensebox_startap'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_startap_tooltip);
this.setHelpUrl('');
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_wifi_startap);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
Blockly.Blocks["sensebox_startap"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_startap_tooltip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_startap);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(Blockly.Msg.senseBox_wifi_ssid)
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
};
Blockly.Blocks["sensebox_ethernet"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_ethernet_tooltip);
this.setHelpUrl("");
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_ethernet)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_ethernet_dhcp, "Dhcp"],
[Blockly.Msg.senseBox_ethernet_manuel_config, "Manual"],
]),
"dhcp"
);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_ethernet_mac)
.appendField(
new Blockly.FieldTextInput("0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED"),
"mac"
);
this.setHelpUrl(Blockly.Msg.senseBox_ethernet_helpurl);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.getField("dhcp").setValidator(
function (val) {
this.updateShape_(val === "Manual");
}.bind(this)
);
},
updateShape_(isManual) {
if (isManual) {
this.appendDummyInput("ip-field")
.appendField(Blockly.Msg.senseBox_ethernet_ip)
.appendField(new Blockly.FieldTextInput("192.168.1.100"), "ip");
this.appendDummyInput("subnetmask-field")
.appendField(Blockly.Msg.senseBox_ethernet_subnetmask)
.appendField(new Blockly.FieldTextInput("255.255.255.0"), "subnetmask");
this.appendDummyInput("gateway-field")
.appendField(Blockly.Msg.senseBox_ethernet_gateway)
.appendField(new Blockly.FieldTextInput("192.168.1.1"), "gateway");
this.appendDummyInput("dns-field")
.appendField(Blockly.Msg.senseBox_ethernet_dns)
.appendField(new Blockly.FieldTextInput("8.8.8.8"), "dns");
} else {
this.removeInput("ip-field", true);
this.removeInput("subnetmask-field", true);
this.removeInput("gateway-field", true);
this.removeInput("dns-field", true);
}
};
},
};
Blockly.Blocks["sensebox_ethernetIp"] = {
init: function () {
this.appendDummyInput().appendField(Blockly.Msg.senseBox_ethernet_ip);
this.setColour(getColour().sensebox);
this.setHelpUrl(Blockly.Msg.senseBox_ethernetIp_helpurl);
this.setTooltip(Blockly.Msg.senseBox_ethernet_ip_tooltip);
this.setOutput(true, null);
}
};
Blockly.Blocks["sensebox_wifi_status"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_status_tooltip);
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_status);
this.setOutput(true, Types.BOOLEAN.typeName);
this.setHelpUrl(Blockly.Msg.senseBox_wifi_status_helpurl);
},
};
Blockly.Blocks["sensebox_get_ip"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_ip_tooltip);
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_ip);
this.setOutput(true, Types.TEXT.typeName);
this.setHelpUrl(Blockly.Msg.senseBox_wifi_ip_helpurl);
},
};
Blockly.Blocks["sensebox_wifi_rssi"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_wifi_rssi_tooltip);
this.setColour(getColour().sensebox);
this.appendDummyInput().appendField(Blockly.Msg.senseBox_wifi_rssi);
this.setOutput(true, Types.NUMBER.typeName);
this.setHelpUrl(Blockly.Msg.senseBox_wifi_rssi_helpurl);
},
};

View File

@ -0,0 +1,47 @@
import * as Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
import { selectedBoard } from "../helpers/board";
Blockly.Blocks["init_serial_monitor"] = {
init: function () {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setColour(getColour().serial);
this.setHelpUrl("http://arduino.cc/en/Serial/Begin");
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_SERIAL_SETUP)
.appendField(
new Blockly.FieldDropdown(selectedBoard().serial),
"SERIAL_ID"
)
.appendField(Blockly.Msg.ARD_SERIAL_SPEED)
.appendField(
new Blockly.FieldDropdown(selectedBoard().serialSpeed),
"SPEED"
)
.appendField(Blockly.Msg.ARD_SERIAL_BPS);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.ARD_SERIAL_SETUP_TIP);
},
};
Blockly.Blocks["print_serial_monitor"] = {
init: function () {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setColour(getColour().serial);
this.setHelpUrl("http://www.arduino.cc/en/Serial/Print");
this.appendDummyInput()
.appendField(
new Blockly.FieldDropdown(selectedBoard().serial),
"SERIAL_ID"
)
.appendField(Blockly.Msg.ARD_SERIAL_PRINT);
this.appendValueInput("CONTENT");
this.appendDummyInput()
.appendField(new Blockly.FieldCheckbox("TRUE"), "NEW_LINE")
.appendField(Blockly.Msg.ARD_SERIAL_PRINT_NEWLINE);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.ARD_SERIAL_PRINT_TIP);
},
};

View File

@ -8,123 +8,135 @@
* The arduino built in functions syntax can be found in
* http://arduino.cc/en/Reference/HomePage
*/
import Blockly from 'blockly';
import { getColour } from '../helpers/colour'
import * as Types from '../helpers/types'
import Blockly from "blockly";
import { getColour } from "../helpers/colour";
import * as Types from "../helpers/types";
Blockly.Blocks['time_delay'] = {
/**
* Delay block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Delay');
this.setColour(getColour().time);
this.appendValueInput('DELAY_TIME_MILI')
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_MS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_TIP);
}
Blockly.Blocks["time_delay"] = {
/**
* Delay block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Delay");
this.setColour(getColour().time);
this.appendValueInput("DELAY_TIME_MILI")
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_TIP);
},
};
Blockly.Blocks['time_delaymicros'] = {
/**
* delayMicroseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/DelayMicroseconds');
this.setColour(getColour().time);
this.appendValueInput('DELAY_TIME_MICRO')
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_DELAY_MICROS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_MICRO_TIP);
}
Blockly.Blocks["time_delaymicros"] = {
/**
* delayMicroseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/DelayMicroseconds");
this.setColour(getColour().time);
this.appendValueInput("DELAY_TIME_MICRO")
.setCheck(Types.NUMBER.checkList)
.appendField(Blockly.Msg.ARD_TIME_DELAY);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_DELAY_MICROS);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_MICRO_TIP);
},
};
Blockly.Blocks['time_millis'] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Millis');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_MILLIS);
this.setOutput(true, Types.LARGE_NUMBER.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
/** @return {string} The type of return value for the block, an integer. */
getBlockType: function () {
return Blockly.Types.LARGE_NUMBER;
}
Blockly.Blocks["time_millis"] = {
/**
* Elapsed time in milliseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Millis");
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MILLIS);
this.setOutput(true, Types.LARGE_NUMBER.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
},
/** @return {string} The type of return value for the block, an integer. */
getBlockType: function () {
return Blockly.Types.LARGE_NUMBER;
},
};
Blockly.Blocks['time_micros'] = {
/**
* Elapsed time in microseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('http://arduino.cc/en/Reference/Micros');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_MICROS);
this.setOutput(true, Types.LARGE_NUMBER.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MICROS_TIP);
},
/**
* Should be a long (32bit), but for for now an int.
* @return {string} The type of return value for the block, an integer.
*/
getBlockType: function () {
return Types.LARGE_NUMBER;
}
Blockly.Blocks["time_micros"] = {
/**
* Elapsed time in microseconds block definition
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("http://arduino.cc/en/Reference/Micros");
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_MICROS);
this.setOutput(true, Types.LARGE_NUMBER.typeId);
this.setTooltip(Blockly.Msg.ARD_TIME_MICROS_TIP);
},
/**
* Should be a long (32bit), but for for now an int.
* @return {string} The type of return value for the block, an integer.
*/
getBlockType: function () {
return Types.LARGE_NUMBER;
},
};
Blockly.Blocks['infinite_loop'] = {
/**
* Waits forever, end of program.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl('');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.ARD_TIME_INF);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setTooltip(Blockly.Msg.ARD_TIME_INF_TIP);
}
Blockly.Blocks["infinite_loop"] = {
/**
* Waits forever, end of program.
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl("");
this.setColour(getColour().time);
this.appendDummyInput().appendField(Blockly.Msg.ARD_TIME_INF);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setTooltip(Blockly.Msg.ARD_TIME_INF_TIP);
},
};
Blockly.Blocks['sensebox_interval_timer'] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_interval_timer_tip);
this.setInputsInline(true);
this.setHelpUrl('');
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_interval_timer);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField(new Blockly.FieldTextInput("10000"), "interval")
.appendField(Blockly.Msg.senseBox_interval);
this.appendStatementInput('DO')
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
}
// Blockly.Blocks["sensebox_interval_timer"] = {
// init: function () {
// this.setTooltip(Blockly.Msg.senseBox_interval_timer_tip);
// this.setInputsInline(true);
// this.setHelpUrl("");
// this.setColour(getColour().time);
// this.appendDummyInput().appendField(Blockly.Msg.senseBox_interval_timer);
// this.appendDummyInput()
// .setAlign(Blockly.ALIGN_LEFT)
// .appendField(new Blockly.FieldTextInput("10000"), "interval")
// .appendField(Blockly.Msg.senseBox_interval);
// this.appendStatementInput("DO").setCheck(null);
// this.setPreviousStatement(true, null);
// this.setNextStatement(true, null);
// },
// };
Blockly.Blocks["sensebox_interval_timer"] = {
init: function () {
this.setTooltip(Blockly.Msg.senseBox_interval_timer_tip);
this.setInputsInline(true);
this.setHelpUrl("");
this.setColour(getColour().time);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_interval_timer)
.appendField(new Blockly.FieldTextInput("Interval"), "name");
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_interval_time)
.setAlign(Blockly.ALIGN_LEFT)
.appendField(new Blockly.FieldTextInput("10000"), "interval")
.appendField(Blockly.Msg.senseBox_interval);
this.appendStatementInput("DO").setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
},
};

View File

@ -0,0 +1,28 @@
import Blockly from "blockly/core";
import { getColour } from "../helpers/colour";
Blockly.Blocks["watchdog_enable"] = {
init: function () {
this.appendDummyInput()
.appendField("Watchdog aktivieren")
.appendField(new Blockly.FieldTextInput("10000"), "TIME")
.appendField("ms");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().io);
this.setTooltip("");
this.setHelpUrl("");
},
};
Blockly.Blocks["watchdog_reset"] = {
init: function () {
this.appendDummyInput().appendField("Watchdog zurücksetzen");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(getColour().io);
this.setTooltip("");
this.setHelpUrl("");
},
};

View File

@ -62,9 +62,7 @@ Blockly["Arduino"].addReservedWords(
"pulseIn,millis,micros,delay,delayMicroseconds,min,max,abs,constrain," +
"map,pow,sqrt,sin,cos,tan,randomSeed,random,lowByte,highByte,bitRead," +
"bitWrite,bitSet,bitClear,ultraSonicDistance,parseDouble,setNeoPixelColor," +
"bit,attachInterrupt,detachInterrupt,interrupts,noInterrupts",
"short",
"isBtnPressed"
"bit,attachInterrupt,detachInterrupt,interrupts,noInterrupts,short,isBtnPressed"
);
/**

View File

@ -19,7 +19,9 @@ import "./map";
import "./io";
import "./audio";
import "./procedures";
import "./serial";
import "./time";
import "./variables";
import "./lists";
import "./watchdog";
import "./webserver";

View File

@ -1,52 +1,77 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/**
* MQTT Blocks
*/
* MQTT Blocks
*/
let service;
Blockly.Arduino.sensebox_mqtt_setup = function () {
var server = this.getFieldValue('server');
var port = this.getFieldValue('port');
var username = this.getFieldValue('username');
var pass = this.getFieldValue('password');
service = this.getFieldValue('service');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_['library_adafruitmqtt'] = '#include "Adafruit_MQTT.h"';
Blockly.Arduino.libraries_['library_adafruitmqttclient'] = '#include "Adafruit_MQTT_Client.h"';
Blockly.Arduino.definitions_['mqtt_server'] = '#define SERVER "' + server + '"';
Blockly.Arduino.definitions_['mqtt_port'] = '#define SERVERPORT ' + port + '';
Blockly.Arduino.definitions_['mqtt_username'] = '#define USERNAME "' + username + '"';
Blockly.Arduino.definitions_['mqtt_pass'] = '#define PASS "' + pass + '"';
Blockly.Arduino.definitions_['wifi_client'] = 'WiFiClient client;';
Blockly.Arduino.definitions_['mqtt_client'] = 'Adafruit_MQTT_Client mqtt(&client, SERVER, SERVERPORT, USERNAME, PASS);'
var code = '';
return code;
var server = this.getFieldValue("server");
var port = this.getFieldValue("port");
var username = this.getFieldValue("username");
var pass = this.getFieldValue("password");
service = this.getFieldValue("service");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_adafruitmqtt"] =
'#include "Adafruit_MQTT.h //http://librarymanager/All#Adafruit_MQTT_Library"';
Blockly.Arduino.libraries_["library_adafruitmqttclient"] =
'#include "Adafruit_MQTT_Client.h"';
Blockly.Arduino.definitions_["mqtt_server"] =
'#define SERVER "' + server + '"';
Blockly.Arduino.definitions_["mqtt_port"] =
"#define SERVERPORT " + port + "";
Blockly.Arduino.definitions_["mqtt_username"] =
'#define USERNAME "' + username + '"';
Blockly.Arduino.definitions_["mqtt_pass"] =
'#define PASS "' + pass + '"';
Blockly.Arduino.definitions_["wifi_client"] = "WiFiClient client;";
Blockly.Arduino.definitions_["mqtt_client"] =
"Adafruit_MQTT_Client mqtt(&client, SERVER, SERVERPORT, USERNAME, PASS);";
var code = "";
return code;
};
Blockly.Arduino.sensebox_mqtt_publish = function (block) {
var feedname = this.getFieldValue('publishfeed');
var res = feedname.split("/");
var feed_client = res[res.length - 1];
var value = Blockly.Arduino.valueToCode(this, 'value', Blockly.Arduino.ORDER_ATOMIC) || '"No Block connected"';
var feedname = this.getFieldValue("publishfeed");
var res = feedname.split("/");
var feed_client = res[res.length - 1];
var value =
Blockly.Arduino.valueToCode(this, "value", Blockly.Arduino.ORDER_ATOMIC) ||
'"No Block connected"';
switch (service) {
case 'adafruitio':
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' + feedname + '");'
break;
case 'dioty':
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, "/"USERNAME"/' + feedname + '");'
break;
case 'custom':
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, "' + feedname + '");'
break;
default:
break;
switch (service) {
case "adafruitio":
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Publish " +
feed_client +
' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' +
feedname +
'");';
break;
case "dioty":
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Publish " +
feed_client +
' = Adafruit_MQTT_Publish(&mqtt, "/"USERNAME"/' +
feedname +
'");';
break;
case "custom":
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Publish " +
feed_client +
' = Adafruit_MQTT_Publish(&mqtt, "' +
feedname +
'");';
break;
default:
break;
}
}
//Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' + feedname + '");'
Blockly.Arduino.codeFunctions_['mqtt_connect_function'] = `// Function to connect and reconnect as necessary to the MQTT server.
//Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Publish ' + feed_client + ' = Adafruit_MQTT_Publish(&mqtt, USERNAME "/feeds/' + feedname + '");'
Blockly.Arduino.codeFunctions_[
"mqtt_connect_function"
] = `// Function to connect and reconnect as necessary to the MQTT server.
// Should be called in the loop function and it will take care if connecting.
void MQTT_connect() {
int8_t ret;
@ -59,23 +84,34 @@ void MQTT_connect() {
delay(5000); // wait 5 seconds
}
}`;
Blockly.Arduino.loopCodeOnce_['mqtt_connect'] = 'MQTT_connect();';
var code = '' + feed_client + '.publish(' + value + ');';
return code
Blockly.Arduino.loopCodeOnce_["mqtt_connect"] = "MQTT_connect();";
var code = "" + feed_client + ".publish(" + value + ");";
return code;
};
Blockly.Arduino.sensebox_mqtt_subscribe = function (block) {
var feedname = this.getFieldValue('subscribefeed');
var x = 5, feed_client;
feed_client = feedname.substr(feedname.length - x, x);
Blockly.Arduino.definitions_['mqtt_' + feed_client + ''] = 'Adafruit_MQTT_Subscribe ' + feed_client + '= Adafruit_MQTT_Subscribe(&mqtt,' + feedname + ');';
Blockly.Arduino.codeFunctions_['mqtt_' + feed_client + 'callbackFunction'] = `void ` + feed_client + `Callback (double x){
var feedname = this.getFieldValue("subscribefeed");
var x = 5,
feed_client;
feed_client = feedname.substr(feedname.length - x, x);
Blockly.Arduino.definitions_["mqtt_" + feed_client + ""] =
"Adafruit_MQTT_Subscribe " +
feed_client +
"= Adafruit_MQTT_Subscribe(&mqtt," +
feedname +
");";
Blockly.Arduino.codeFunctions_["mqtt_" + feed_client + "callbackFunction"] =
`void ` +
feed_client +
`Callback (double x){
Serial.println(x);
}`;
Blockly.Arduino.setupCode_['mqtt_' + feed_client + '_callback'] = '' + feed_client + '.setCallback(' + feed_client + 'Callback);';
Blockly.Arduino.setupCode_['mqtt_' + feed_client + '_subscribe'] = 'mqtt.subscribe(&' + feed_client + ');';
Blockly.Arduino.loopCodeOnce_['mqtt_processPackages'] = 'mqtt.processPackets(10);';
var code = '';
return code;
Blockly.Arduino.setupCode_["mqtt_" + feed_client + "_callback"] =
"" + feed_client + ".setCallback(" + feed_client + "Callback);";
Blockly.Arduino.setupCode_["mqtt_" + feed_client + "_subscribe"] =
"mqtt.subscribe(&" + feed_client + ");";
Blockly.Arduino.loopCodeOnce_["mqtt_processPackages"] =
"mqtt.processPackets(10);";
var code = "";
return code;
};

View File

@ -2,9 +2,8 @@ import * as Blockly from "blockly/core";
Blockly.Arduino.sensebox_phyphox_init = function () {
var name = this.getFieldValue("devicename");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["phyphox_library"] = `#include <phyphoxBle.h>`;
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.phyphoxSetupCode_[
"phyphox_start"
] = `PhyphoxBLE::start("${name}");`;

View File

@ -1,45 +1,79 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/*Display Blocks*/
Blockly.Arduino.sensebox_display_beginDisplay = function () {
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
Blockly.Arduino.libraries_['library_wire'] = '#include <Wire.h>';
Blockly.Arduino.libraries_['library_AdafruitGFX'] = '#include <Adafruit_GFX.h>';
Blockly.Arduino.libraries_['library_AdafruitSSD1306'] = '#include <Adafruit_SSD1306.h>';
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_display'] = '#define OLED_RESET 4\nAdafruit_SSD1306 display(OLED_RESET);';
Blockly.Arduino.setupCode_['sensebox_display_begin'] = 'senseBoxIO.powerI2C(true);\ndelay(2000);\ndisplay.begin(SSD1306_SWITCHCAPVCC, 0x3D);\ndisplay.display();\ndelay(100);\ndisplay.clearDisplay();';
var code = '';
return code;
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>";
Blockly.Arduino.libraries_["library_AdafruitGFX"] =
"#include <Adafruit_GFX.h> // http://librarymanager/All#Adafruit_GFX_Library";
Blockly.Arduino.libraries_["library_AdafruitSSD1306"] =
"#include <Adafruit_SSD1306.h> // http://librarymanager/All#Adafruit_SSD1306";
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.definitions_[
"define_display_size"
] = `#define SCREEN_WIDTH 128\n#define SCREEN_HEIGHT 64`;
Blockly.Arduino.definitions_["define_display"] =
"#define OLED_RESET 4\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);";
Blockly.Arduino.setupCode_["sensebox_display_begin"] =
"senseBoxIO.powerI2C(true);\ndelay(2000);\ndisplay.begin(SSD1306_SWITCHCAPVCC, 0x3D);\ndisplay.display();\ndelay(100);\ndisplay.clearDisplay();";
var code = "";
return code;
};
Blockly.Arduino.sensebox_display_clearDisplay = function () {
var code = 'display.clearDisplay();\n';
return code;
var code = "display.clearDisplay();\n";
return code;
};
Blockly.Arduino.sensebox_display_printDisplay = function () {
var x = this.getFieldValue('X');
var y = this.getFieldValue('Y');
var printDisplay = Blockly.Arduino.valueToCode(this, 'printDisplay', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
var size = this.getFieldValue('SIZE');
var color = this.getFieldValue('COLOR');
var code = 'display.setCursor(' + x + ',' + y + ');\n';
code += 'display.setTextSize(' + size + ');\n';
code += 'display.setTextColor(' + color + ');\n';
code += 'display.println(' + printDisplay + ');\n';
return code;
var x = this.getFieldValue("X");
var y = this.getFieldValue("Y");
var printDisplay =
Blockly.Arduino.valueToCode(
this,
"printDisplay",
Blockly.Arduino.ORDER_ATOMIC
) || '"Keine Eingabe"';
var size = this.getFieldValue("SIZE");
var color = this.getFieldValue("COLOR");
var code = "display.setCursor(" + x + "," + y + ");\n";
code += "display.setTextSize(" + size + ");\n";
code += "display.setTextColor(" + color + ");\n";
code += "display.println(" + printDisplay + ");\n";
return code;
};
Blockly.Arduino.sensebox_display_fastPrint = function () {
var title1 = Blockly.Arduino.valueToCode(this, 'Title1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var value1 = Blockly.Arduino.valueToCode(this, 'Value1', Blockly.Arduino.ORDER_ATOMIC);
var dimension1 = Blockly.Arduino.valueToCode(this, 'Dimension1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var title2 = Blockly.Arduino.valueToCode(this, 'Title2', Blockly.Arduino.ORDER_ATOMIC) || '0'
var value2 = Blockly.Arduino.valueToCode(this, 'Value2', Blockly.Arduino.ORDER_ATOMIC);
var dimension2 = Blockly.Arduino.valueToCode(this, 'Dimension2', Blockly.Arduino.ORDER_ATOMIC) || '0'
Blockly.Arduino.codeFunctions_['sensebox_fastPrint'] = `
var title1 =
Blockly.Arduino.valueToCode(this, "Title1", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var value1 = Blockly.Arduino.valueToCode(
this,
"Value1",
Blockly.Arduino.ORDER_ATOMIC
);
var dimension1 =
Blockly.Arduino.valueToCode(
this,
"Dimension1",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var title2 =
Blockly.Arduino.valueToCode(this, "Title2", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var value2 = Blockly.Arduino.valueToCode(
this,
"Value2",
Blockly.Arduino.ORDER_ATOMIC
);
var dimension2 =
Blockly.Arduino.valueToCode(
this,
"Dimension2",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
Blockly.Arduino.codeFunctions_["sensebox_fastPrint"] = `
void printOnDisplay(String title1, String measurement1, String unit1, String title2, String measurement2, String unit2) {
display.setCursor(0, 0);
@ -62,67 +96,141 @@ Blockly.Arduino.sensebox_display_fastPrint = function () {
display.setTextSize(1);
display.println(unit2);
}
`
var code = ` printOnDisplay(${title1}, String(${value1}), ${dimension1}, ${title2}, String(${value2}), ${dimension2});\n`;
return code;
`;
var code = ` printOnDisplay(${title1}, String(${value1}), ${dimension1}, ${title2}, String(${value2}), ${dimension2});\n`;
return code;
};
Blockly.Arduino.sensebox_display_show = function (block) {
var show = Blockly.Arduino.statementToCode(block, 'SHOW');
var code = '';
code += show;
code += 'display.display();\n';
return code;
var show = Blockly.Arduino.statementToCode(block, "SHOW");
var code = "";
code += show;
code += "display.display();\n";
return code;
};
Blockly.Arduino.sensebox_display_plotDisplay = function () {
var YLabel = Blockly.Arduino.valueToCode(this, 'YLabel', Blockly.Arduino.ORDER_ATOMIC) || 'Y'
var XLabel = Blockly.Arduino.valueToCode(this, 'XLabel', Blockly.Arduino.ORDER_ATOMIC) || 'X'
var Title = Blockly.Arduino.valueToCode(this, 'Title', Blockly.Arduino.ORDER_ATOMIC) || 'Title'
var XRange1 = Blockly.Arduino.valueToCode(this, 'XRange1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var XRange2 = Blockly.Arduino.valueToCode(this, 'XRange2', Blockly.Arduino.ORDER_ATOMIC) || '0'
var YRange1 = Blockly.Arduino.valueToCode(this, 'YRange1', Blockly.Arduino.ORDER_ATOMIC) || '0'
var YRange2 = Blockly.Arduino.valueToCode(this, 'YRange2', Blockly.Arduino.ORDER_ATOMIC) || '0'
var XTick = Blockly.Arduino.valueToCode(this, 'XTick', Blockly.Arduino.ORDER_ATOMIC) || '0'
var YTick = Blockly.Arduino.valueToCode(this, 'YTick', Blockly.Arduino.ORDER_ATOMIC) || '0'
var TimeFrame = Blockly.Arduino.valueToCode(this, 'TimeFrame', Blockly.Arduino.ORDER_ATOMIC) || '0'
var plotDisplay = Blockly.Arduino.valueToCode(this, 'plotDisplay', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
Blockly.Arduino.libraries_['library_plot'] = '#include <Plot.h>';
Blockly.Arduino.definitions_['define_plot_class'] = 'Plot DataPlot(&display);\n';
Blockly.Arduino.variables_['define_plot_class'] = 'const double TIMEFRAME = ' + TimeFrame + ';\n';
Blockly.Arduino.setupCode_['sensebox_plot_setup'] = 'DataPlot.setTitle(' + Title + ');\nDataPlot.setXLabel(' + XLabel + ');\nDataPlot.setYLabel(' + YLabel + ');\nDataPlot.setXRange(' + XRange1 + ',' + XRange2 + ');\nDataPlot.setYRange(' + YRange1 + ',' + YRange2 + ');\nDataPlot.setXTick(' + XTick + ');\nDataPlot.setYTick(' + YTick + ');\nDataPlot.setXPrecision(0);\nDataPlot.setYPrecision(0);\n';
var code = 'DataPlot.clear();'
code += 'double starttime = millis();\ndouble t = 0;\nwhile (t <= TIMEFRAME) {\nt = (millis() - starttime) / 1000.0;\nfloat value = ' + plotDisplay + ';\n';
code += 'DataPlot.addDataPoint(t,value);\n}\n';
return code;
var YLabel =
Blockly.Arduino.valueToCode(this, "YLabel", Blockly.Arduino.ORDER_ATOMIC) ||
"Y";
var XLabel =
Blockly.Arduino.valueToCode(this, "XLabel", Blockly.Arduino.ORDER_ATOMIC) ||
"X";
var Title =
Blockly.Arduino.valueToCode(this, "Title", Blockly.Arduino.ORDER_ATOMIC) ||
"Title";
var XRange1 =
Blockly.Arduino.valueToCode(
this,
"XRange1",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var XRange2 =
Blockly.Arduino.valueToCode(
this,
"XRange2",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var YRange1 =
Blockly.Arduino.valueToCode(
this,
"YRange1",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var YRange2 =
Blockly.Arduino.valueToCode(
this,
"YRange2",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var XTick =
Blockly.Arduino.valueToCode(this, "XTick", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var YTick =
Blockly.Arduino.valueToCode(this, "YTick", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var TimeFrame =
Blockly.Arduino.valueToCode(
this,
"TimeFrame",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var plotDisplay =
Blockly.Arduino.valueToCode(
this,
"plotDisplay",
Blockly.Arduino.ORDER_ATOMIC
) || '"Keine Eingabe"';
Blockly.Arduino.libraries_["library_plot"] = "#include <Plot.h>";
Blockly.Arduino.definitions_["define_plot_class"] =
"Plot DataPlot(&display);\n";
Blockly.Arduino.variables_["define_plot_class"] =
"const double TIMEFRAME = " + TimeFrame + ";\n";
Blockly.Arduino.setupCode_["sensebox_plot_setup"] =
"DataPlot.setTitle(" +
Title +
");\nDataPlot.setXLabel(" +
XLabel +
");\nDataPlot.setYLabel(" +
YLabel +
");\nDataPlot.setXRange(" +
XRange1 +
"," +
XRange2 +
");\nDataPlot.setYRange(" +
YRange1 +
"," +
YRange2 +
");\nDataPlot.setXTick(" +
XTick +
");\nDataPlot.setYTick(" +
YTick +
");\nDataPlot.setXPrecision(0);\nDataPlot.setYPrecision(0);\n";
var code = "DataPlot.clear();";
code +=
"double starttime = millis();\ndouble t = 0;\nwhile (t <= TIMEFRAME) {\nt = (millis() - starttime) / 1000.0;\nfloat value = " +
plotDisplay +
";\n";
code += "DataPlot.addDataPoint(t,value);\n}\n";
return code;
};
Blockly.Arduino.sensebox_display_fillCircle = function () {
let code = '';
var x = Blockly.Arduino.valueToCode(this, 'X', Blockly.Arduino.ORDER_ATOMIC) || '0'
var y = Blockly.Arduino.valueToCode(this, 'Y', Blockly.Arduino.ORDER_ATOMIC) || '0'
var radius = Blockly.Arduino.valueToCode(this, 'Radius', Blockly.Arduino.ORDER_ATOMIC) || '0'
var fill = this.getFieldValue('FILL');
if (fill === 'TRUE') {
code = 'display.fillCircle(' + x + ',' + y + ',' + radius + ',1);\n';
}
else {
code = 'display.drawCircle(' + x + ',' + y + ',' + radius + ',1);\n';
}
return code;
}
let code = "";
var x =
Blockly.Arduino.valueToCode(this, "X", Blockly.Arduino.ORDER_ATOMIC) || "0";
var y =
Blockly.Arduino.valueToCode(this, "Y", Blockly.Arduino.ORDER_ATOMIC) || "0";
var radius =
Blockly.Arduino.valueToCode(this, "Radius", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var fill = this.getFieldValue("FILL");
if (fill === "TRUE") {
code = "display.fillCircle(" + x + "," + y + "," + radius + ",1);\n";
} else {
code = "display.drawCircle(" + x + "," + y + "," + radius + ",1);\n";
}
return code;
};
Blockly.Arduino.sensebox_display_drawRectangle = function () {
let code = '';
var x = Blockly.Arduino.valueToCode(this, 'X', Blockly.Arduino.ORDER_ATOMIC) || '0'
var y = Blockly.Arduino.valueToCode(this, 'Y', Blockly.Arduino.ORDER_ATOMIC) || '0'
var width = Blockly.Arduino.valueToCode(this, 'width', Blockly.Arduino.ORDER_ATOMIC) || '0'
var height = Blockly.Arduino.valueToCode(this, 'height', Blockly.Arduino.ORDER_ATOMIC) || '0'
var fill = this.getFieldValue('FILL');
if (fill === 'TRUE') {
code = 'display.fillRect(' + x + ',' + y + ',' + width + ',' + height + ',1);\n';
}
else {
code = 'display.drawRect(' + x + ',' + y + ',' + width + ',' + height + ',1);\n';
}
return code;
}
let code = "";
var x =
Blockly.Arduino.valueToCode(this, "X", Blockly.Arduino.ORDER_ATOMIC) || "0";
var y =
Blockly.Arduino.valueToCode(this, "Y", Blockly.Arduino.ORDER_ATOMIC) || "0";
var width =
Blockly.Arduino.valueToCode(this, "width", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var height =
Blockly.Arduino.valueToCode(this, "height", Blockly.Arduino.ORDER_ATOMIC) ||
"0";
var fill = this.getFieldValue("FILL");
if (fill === "TRUE") {
code =
"display.fillRect(" + x + "," + y + "," + width + "," + height + ",1);\n";
} else {
code =
"display.drawRect(" + x + "," + y + "," + width + "," + height + ",1);\n";
}
return code;
};

View File

@ -5,10 +5,10 @@ Blockly.Arduino.sensebox_lora_initialize_otaa = function (block) {
var appID = this.getFieldValue("APPID");
var appKey = this.getFieldValue("APPKEY");
var interval = this.getFieldValue("INTERVAL");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_lmic"] = "#include <lmic.h>";
Blockly.Arduino.libraries_["library_lmic"] =
"#include <lmic.h> // http://librarymanager/All#IBM_LMIC_framework";
Blockly.Arduino.libraries_["library_hal"] = "#include <hal/hal.h>";
Blockly.Arduino.definitions_["define_LoRaVariablesOTAA"] = `
static const u1_t PROGMEM APPEUI[8]= {${appID}};
@ -177,7 +177,8 @@ Blockly.Arduino.sensebox_send_lora_sensor_value = function (block) {
};
Blockly.Arduino.sensebox_lora_cayenne_send = function (block) {
Blockly.Arduino.libraries_["library_cayene"] = "#include <CayenneLPP.h>";
Blockly.Arduino.libraries_["library_cayene"] =
"#include <CayenneLPP.h> // http://librarymanager/All#CayenneLPP";
Blockly.Arduino.variables_["variable_cayenne"] = "CayenneLPP lpp(51);";
var lora_sensor_values = Blockly.Arduino.statementToCode(block, "DO");
Blockly.Arduino.functionNames_["functions_do_send"] = `
@ -278,8 +279,7 @@ Blockly.Arduino.sensebox_lora_initialize_abp = function (block) {
var appskey = this.getFieldValue("APPSKEY");
var devaddr = this.getFieldValue("DEVADDR");
var interval = this.getFieldValue("INTERVAL");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_lmic"] = "#include <lmic.h>";
Blockly.Arduino.libraries_["library_hal"] = "#include <hal/hal.h>";
@ -525,3 +525,12 @@ Blockly.Arduino.sensebox_lora_cayenne_gps = function (block) {
var code = `lpp.addGPS(${channel}, ${lat}, ${lng}, ${alt});\n`;
return code;
};
Blockly.Arduino.sensebox_lora_cayenne_concentration = function (block) {
var value =
Blockly.Arduino.valueToCode(this, "Value", Blockly.Arduino.ORDER_ATOMIC) ||
0;
var channel = this.getFieldValue("CHANNEL");
var code = `lpp.addConcentration(${channel}, ${value});\n`;
return code;
};

View File

@ -17,13 +17,23 @@ Blockly.Arduino.sensebox_send_to_osem = function (block) {
};
Blockly.Arduino.sensebox_osem_connection = function (Block) {
var workspace = Blockly.getMainWorkspace();
var wifi = false;
var ethernet = false;
if (workspace.getBlocksByType("sensebox_wifi").length > 0) {
wifi = true;
ethernet = false;
} else if (workspace.getBlocksByType("sensebox_ethernet").length > 0) {
ethernet = true;
wifi = false;
}
var box_id = this.getFieldValue("BoxID");
var host = this.getFieldValue("host");
var branch = Blockly.Arduino.statementToCode(Block, "DO");
var access_token = this.getFieldValue("access_token");
var blocks = this.getDescendants();
var type = this.getFieldValue("type");
var ssl = this.getFieldValue("SSL");
var restart = this.getFieldValue("RESTART");
var port = 0;
var count = 0;
if (blocks !== undefined) {
@ -34,22 +44,63 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
}
}
var num_sensors = count;
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.definitions_["num_sensors"] =
"static const uint8_t NUM_SENSORS = " + num_sensors + ";";
Blockly.Arduino.definitions_["SenseBoxID"] =
'const char SENSEBOX_ID [] PROGMEM = "' + box_id + '";';
Blockly.Arduino.definitions_["host"] =
"const char server [] PROGMEM =" + host + ";";
if (ssl === "TRUE") {
Blockly.Arduino.definitions_["WiFiSSLClient"] = "WiFiSSLClient client;";
port = 443;
} else if (ssl === "FALSE") {
Blockly.Arduino.definitions_["WiFiClient"] = "WiFiClient client;";
port = 80;
}
'const char server [] PROGMEM ="ingress.opensensemap.org";';
if (wifi === true) {
if (ssl === "TRUE") {
Blockly.Arduino.libraries_["library_bearSSL"] =
"#include <ArduinoBearSSL.h>";
Blockly.Arduino.libraries_["library_arduinoECC08"] =
"#include <ArduinoECCX08.h>";
Blockly.Arduino.definitions_["WiFiClient"] = "WiFiClient wifiClient;";
Blockly.Arduino.definitions_["BearSSLClient"] =
"BearSSLClient client(wifiClient);";
Blockly.Arduino.functionNames_["getTime"] = `unsigned long getTime() {
return WiFi.getTime();
}`;
Blockly.Arduino.setupCode_["initBearSSL"] =
"ArduinoBearSSL.onGetTime(getTime);";
port = 443;
} else if (ssl === "FALSE") {
Blockly.Arduino.definitions_["WiFiClient"] = "WiFiClient client;";
port = 80;
}
} else if (ethernet === true) {
if (ssl === "TRUE") {
Blockly.Arduino.libraries_["library_bearSSL"] =
"#include <ArduinoBearSSL.h>";
Blockly.Arduino.libraries_["library_arduinoECC08"] =
"#include <ArduinoECCX08.h>";
Blockly.Arduino.libraries_["library_ethernetUdp"] =
"#include <EthernetUdp.h>";
Blockly.Arduino.libraries_["library_NTPClient"] =
"#include <NTPClient.h>";
Blockly.Arduino.definitions_["EthernetClient"] =
"EthernetClient eclient;";
Blockly.Arduino.definitions_["BearSSLClient"] =
"BearSSLClient client(eclient);";
Blockly.Arduino.definitions_["EthernetUDP"] = "EthernetUDP Udp;";
Blockly.Arduino.definitions_["NTPClient"] = "NTPClient timeClient(Udp);";
Blockly.Arduino.functionNames_["getTime"] = `
unsigned long getTime() {
timeClient.update();
return timeClient.getEpochTime();
}`;
Blockly.Arduino.setupCode_["timeClient_begin"] = "timeClient.begin();";
Blockly.Arduino.setupCode_["initBearSSL"] =
"ArduinoBearSSL.onGetTime(getTime);";
port = 443;
} else if (ssl === "FALSE") {
Blockly.Arduino.definitions_["EthernetClient"] = "EthernetClient client;";
port = 80;
}
}
Blockly.Arduino.definitions_["measurement"] = `typedef struct measurement {
const char *sensorId;
float value;
@ -82,11 +133,16 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
}`;
Blockly.Arduino.functionNames_["submitValues"] =
`
void submitValues() {
void submitValues() {
${
wifi === true
? "if (WiFi.status() != WL_CONNECTED) {\nWiFi.disconnect();\ndelay(1000); // wait 1s\nWiFi.begin(ssid, pass);\ndelay(5000); // wait 5s\n}"
: ""
}
if (client.connected()) {
client.stop();
delay(10);
}
client.stop();
delay(1000);
}
bool connected = false;
char _server[strlen_P(server)];
strcpy_P(_server, server);
@ -116,11 +172,29 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
break;
}
}
while (client.available()) {
char c = client.read();
// if the server's disconnected, stop the client:
if (!client.connected()) {
client.stop();
break;
}
}
num_measurements = 0;
break;
}
delay(1000);
}
${
restart === "TRUE"
? "if (connected == false) {\n delay(5000);\n noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }"
: ""
}
}`;
var code = "";
code += branch;
code += "submitValues();\n";
@ -197,11 +271,27 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
break;
}
}
while (client.available()) {
char c = client.read();
// if the server's disconnected, stop the client:
if (!client.connected()) {
client.stop();
break;
}
delay(1000);
}
num_measurements = 0;
break;
}
}
${
restart === "TRUE"
? "if (connected == false) {\n delay(5000);\n noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }"
: ""
}
}`;
code = "";
code += branch;

View File

@ -3,8 +3,7 @@ import Blockly from "blockly";
Blockly.Arduino.sensebox_rtc_init = function () {
Blockly.Arduino.libraries_["RV8523"] = `#include <RV8523.h>`;
Blockly.Arduino.definitions_["RTC"] = `RV8523 rtc;`;
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.setupCode_["rtc.begin"] = `rtc.begin();`;
var code = ``;
return code;

View File

@ -7,11 +7,13 @@ import Blockly from "blockly";
Blockly.Arduino.sensebox_sensor_temp_hum = function () {
var dropdown_name = this.getFieldValue("NAME");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_["define_hdc"] = "HDC1080 hdc;";
Blockly.Arduino.libraries_["library_adafruithdc1000"] =
"#include <Adafruit_HDC1000.h> // http://librarymanager/All#Adafruit_HDC1000_Library";
Blockly.Arduino.definitions_["define_hdc"] =
"Adafruit_HDC1000 hdc = Adafruit_HDC1000();";
Blockly.Arduino.setupCode_["sensebox_sensor_temp_hum"] = "hdc.begin();";
var code = "hdc.get" + dropdown_name + "()";
var code = `hdc.read${dropdown_name}()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@ -23,24 +25,104 @@ Blockly.Arduino.sensebox_sensor_temp_hum = function () {
Blockly.Arduino.sensebox_sensor_uv_light = function () {
var dropdown_name = this.getFieldValue("NAME");
let code = "";
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
if (dropdown_name === "UvIntensity") {
Blockly.Arduino.libraries_["library_veml6070"] = "#include <VEML6070.h>";
Blockly.Arduino.definitions_["define_veml"] = "VEML6070 veml;";
Blockly.Arduino.setupCode_["sensebox_sensor_uv_light"] = "veml.begin();";
code = "veml.get" + dropdown_name + "()";
code = "veml.getUV()";
}
// if (dropdown_name === 'Illuminance') {
// Blockly.Arduino.definitions_['define_tsl'] = 'TSL45315 tsl;'
// Blockly.Arduino.setupCode_['sensebox_sensor_illuminance'] = 'tsl.begin();'
// code = 'tsl.get' + dropdown_name + '()';
// }
if (dropdown_name === "Illuminance") {
Blockly.Arduino.definitions_["define_lightsensor"] =
"Lightsensor lightsensor;";
Blockly.Arduino.libraries_["library_ltr329"] = `#include <LTR329.h>`;
Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>";
Blockly.Arduino.codeFunctions_["read_reg"] = `
int read_reg(byte address, uint8_t reg)
{
int i = 0;
Wire.beginTransmission(address);
Wire.write(reg);
Wire.endTransmission();
Wire.requestFrom((uint8_t)address, (uint8_t)1);
delay(1);
if(Wire.available())
i = Wire.read();
return i;
}
`;
Blockly.Arduino.codeFunctions_["write_reg"] = `
void write_reg(byte address, uint8_t reg, uint8_t val)
{
Wire.beginTransmission(address);
Wire.write(reg);
Wire.write(val);
Wire.endTransmission();
}`;
Blockly.Arduino.codeFunctions_["Lightsensor_begin"] = `
void Lightsensor_begin()
{
Wire.begin();
unsigned int u = 0;
u = read_reg(0x29, 0x80 | 0x0A); //id register
if ((u & 0xF0) == 0xA0) // TSL45315
{
write_reg(0x29, 0x80 | 0x00, 0x03); //control: power on
write_reg(0x29, 0x80 | 0x01, 0x02); //config: M=4 T=100ms
delay(120);
lightsensortype = 0; //TSL45315
}
else
{
LTR.begin();
LTR.setControl(gain, false, false);
LTR.setMeasurementRate(integrationTime, measurementRate);
LTR.setPowerUp(); //power on with default settings
delay(10); //Wait 10 ms (max) - wakeup time from standby
lightsensortype = 1; //
}
}
`;
Blockly.Arduino.codeFunctions_["Lightsensor_getIlluminance"] = `
unsigned int Lightsensor_getIlluminance()
{
unsigned int lux = 0;
if (lightsensortype == 0) // TSL45315
{
unsigned int u = (read_reg(0x29, 0x80 | 0x04) << 0); //data low
u |= (read_reg(0x29, 0x80 | 0x05) << 8); //data high
lux = u * 4; // calc lux with M=4 and T=100ms
}
else if (lightsensortype == 1) //LTR-329ALS-01
{
delay(100);
unsigned int data0, data1;
for (int i = 0; i < 5; i++) {
if (LTR.getData(data0, data1)) {
if(LTR.getLux(gain, integrationTime, data0, data1, lux));
if(lux > 0) break;
else delay(10);
}
else {
byte error = LTR.getError();
}
}
}
return lux;
}
`;
Blockly.Arduino.definitions_["define_lightsensor"] = `
bool lightsensortype = 0; //0 for tsl - 1 for ltr
//settings for LTR sensor
LTR329 LTR;
unsigned char gain = 1;
unsigned char integrationTime = 0;
unsigned char measurementRate = 3;
`;
Blockly.Arduino.setupCode_["sensebox_sensor_illuminance"] =
"lightsensor.begin();";
code = "lightsensor.get" + dropdown_name + "()";
"Lightsensor_begin();";
code = "Lightsensor_getIlluminance()";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
@ -54,8 +136,8 @@ Blockly.Arduino.sensebox_sensor_uv_light = function () {
Blockly.Arduino.sensebox_sensor_bmx055_accelerometer = function () {
var dropdown_value = this.getFieldValue("VALUE");
var range = this.getFieldValue("RANGE");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_bmx055"] = `#include <BMX055.h>`;
Blockly.Arduino.definitions_["define_bmx"] = "BMX055 bmx;";
Blockly.Arduino.setupCode_["sensebox_sensor_bmx055"] =
"bmx.beginAcc(" + range + ");";
@ -71,14 +153,19 @@ Blockly.Arduino.sensebox_sensor_bmx055_accelerometer = function () {
Blockly.Arduino.sensebox_sensor_sds011 = function () {
var dropdown_name = this.getFieldValue("NAME");
var serial_name = this.getFieldValue("SERIAL");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.codeFunctions_["define_sds011"] =
"SDS011 my_sds(" + serial_name + ");";
Blockly.Arduino.variables_["variables_sds011"] = "float p10,p25;\n";
Blockly.Arduino.setupCode_["sensebox_sensor_sds011"] =
serial_name + ".begin(9600);";
var code = "my_sds.get" + dropdown_name + "()";
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"SdsDustSensor"
] = `#include <SdsDustSensor.h> // http://librarymanager/All#Nova_Fitness_Sds_dust_sensors_library`;
Blockly.Arduino.definitions_["define_sds011"] =
"SdsDustSensor sds(" + serial_name + ");";
Blockly.Arduino.setupCode_["sds011_begin"] = "sds.begin();";
Blockly.Arduino.setupCode_["sds011_setActiveReporting"] =
"sds.setActiveReportingMode();";
Blockly.Arduino.loopCodeOnce_[
"sds011_getData"
] = `PmResult pm = sds.readPm();`;
var code = `pm.${dropdown_name}`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@ -91,14 +178,31 @@ Blockly.Arduino.sensebox_sensor_pressure = function () {
var dropdown_name = this.getFieldValue("NAME");
var code = "";
var referencePressure = this.getFieldValue("referencePressure");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_["define_pressure"] = "BMP280 bmp_sensor;";
Blockly.Arduino.setupCode_["sensebox_bmp_sensor"] = "bmp_sensor.begin();";
if (dropdown_name === "Pressure" || dropdown_name === "Temperature") {
code = "bmp_sensor.get" + dropdown_name + "()";
} else if (dropdown_name === "Altitude") {
code = "bmp_sensor.getAltitude(" + referencePressure + ")";
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"adafruit_bmp280"
] = `#include <Adafruit_BMP280.h> // http://librarymanager/All#Adafruit_BMP280_Library`;
Blockly.Arduino.definitions_["define_pressure"] = "Adafruit_BMP280 bmp;";
Blockly.Arduino.setupCode_["sensebox_bmp_sensor"] = "bmp.begin();";
Blockly.Arduino.setupCode_["bmp_setSampling"] = `
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,
Adafruit_BMP280::SAMPLING_X2,
Adafruit_BMP280::SAMPLING_X16,
Adafruit_BMP280::FILTER_X16,
Adafruit_BMP280::STANDBY_MS_500);
`;
switch (dropdown_name) {
case "Temperature":
code = "bmp.readTemperature()";
break;
case "Pressure":
code = "bmp.readPressure()/100";
break;
case "Altitude":
code = "bmp.readAltitude(" + referencePressure + ")";
break;
default:
code = "";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@ -111,7 +215,9 @@ Blockly.Arduino.sensebox_sensor_pressure = function () {
Blockly.Arduino.sensebox_sensor_bme680_bsec = function () {
var dropdown_name = this.getFieldValue("dropdown");
let code = "";
Blockly.Arduino.libraries_["library_bsec"] = '#include "bsec.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_bsec"] =
"#include <bsec.h> // http://librarymanager/All#BSEC_Software_Library";
Blockly.Arduino.definitions_["bsec_iaqSensor"] = "Bsec iaqSensor;";
Blockly.Arduino.variables_["bmeTemperatur"] = "float bmeTemperatur;";
Blockly.Arduino.variables_["bmeHumidity"] = "float bmeHumidity;";
@ -222,18 +328,21 @@ Blockly.Arduino.sensebox_sensor_ultrasonic_ranger = function () {
var dropdown_pin_RX = this.getFieldValue("ultrasonic_trigger");
var dropdown_pin_TX = this.getFieldValue("ultrasonic_echo");
var port = this.getFieldValue("port");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_["var_ultrasonic" + port] =
"Ultrasonic Ultrasonic" +
port +
"(" +
dropdown_pin_RX +
"," +
dropdown_pin_TX +
");";
var maxDistance = this.getFieldValue("maxDistance");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"library_newPing"
] = `#include <NewPing.h> // http://librarymanager/All#NewPing`;
Blockly.Arduino.variables_["define_newPingVariables" + port] = `
#define TRIGGER_PIN_${port} ${dropdown_pin_RX}
#define ECHO_PIN_${port} ${dropdown_pin_TX}
#define MAX_DISTANCE_${port} ${maxDistance}
`;
Blockly.Arduino.definitions_[
"define_newPing" + port
] = `NewPing sonar${port}(TRIGGER_PIN_${port}, ECHO_PIN_${port}, MAX_DISTANCE_${port});`;
var code;
code = "Ultrasonic" + port + ".getDistance()";
code = `sonar${port}.ping_cm()`;
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@ -244,11 +353,37 @@ Blockly.Arduino.sensebox_sensor_ultrasonic_ranger = function () {
Blockly.Arduino.sensebox_sensor_sound = function () {
var dropdown_pin = this.getFieldValue("PIN");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_["define_microphone"] =
"Microphone microphone(" + dropdown_pin + ");";
var code = "microphone.getValue()";
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.codeFunctions_["define_sound"] = `
float getSoundValue(int pin) {
unsigned long start = millis(); // Start des Messintervalls
unsigned int peakToPeak = 0; // Abstand von maximalem zu minimalem Amplitudenausschlag
unsigned int signalMax = 0;
unsigned int signalMin = 1023;
const int sampleTime = 100;
unsigned int micValue;
// Sammle Daten für 100 Millisekunden
while (millis() - start < sampleTime)
{
micValue = analogRead(pin); // Messe den aktuellen Wert
if (micValue < 1023) // sortiere Fehlmessungen aus, deren Werte über dem max Wert 1024 liegen
{
if (micValue > signalMax)
{
signalMax = micValue; // speichere den maximal gemessenen Wert
}
else if (micValue < signalMin)
{
signalMin = micValue; // speichere den minimal gemessenen Wert
}
}
}
peakToPeak = signalMax - signalMin; // max - min = Abstand von maximalem zu minimalem Amplitudenausschlag
double volts = (peakToPeak * 5.0) / 1023; // wandle in Volt um
return volts;
}`;
var code = "getSoundValue(" + dropdown_pin + ")";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@ -260,12 +395,16 @@ Blockly.Arduino.sensebox_sensor_sound = function () {
Blockly.Arduino.sensebox_button = function () {
var dropdown_pin = this.getFieldValue("PIN");
var dropown_function = this.getFieldValue("FUNCTION");
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"library_jcButtons"
] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`;
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
"Button button_" + dropdown_pin + "(" + dropdown_pin + ");";
Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] =
"button_" + dropdown_pin + ".begin();";
Blockly.Arduino.loopCodeOnce_["loop_button" + dropdown_pin + ""] =
"button_" + dropdown_pin + ".read();";
var code = "";
if (dropown_function === "isPressed") {
code = "button_" + dropdown_pin + ".isPressed()";
@ -273,6 +412,9 @@ Blockly.Arduino.sensebox_button = function () {
code = "button_" + dropdown_pin + ".getSwitch()";
} else if (dropown_function === "wasPressed") {
code = "button_" + dropdown_pin + ".wasPressed()";
} else if (dropown_function === "longPress") {
var time = this.getFieldValue("time");
code = "button_" + dropdown_pin + ".pressedFor(" + time + ")";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
@ -284,10 +426,9 @@ Blockly.Arduino.sensebox_button = function () {
Blockly.Arduino.sensebox_scd30 = function () {
var dropdown = this.getFieldValue("dropdown");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["scd30_library"] =
'#include "SparkFun_SCD30_Arduino_Library.h"';
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
"#include <SparkFun_SCD30_Arduino_Library.h> // http://librarymanager/All#SparkFun_SCD30_Arduino_Library";
Blockly.Arduino.definitions_["SCD30"] = "SCD30 airSensor;";
Blockly.Arduino.setupCode_["init_scd30"] = ` Wire.begin();
if (airSensor.begin() == false)
@ -319,11 +460,10 @@ Blockly.Arduino.sensebox_scd30 = function () {
Blockly.Arduino.sensebox_gps = function () {
var dropdown = this.getFieldValue("dropdown");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["gps_library"] =
"#include <SparkFun_u-blox_GNSS_Arduino_Library.h>";
"#include <SparkFun_u-blox_GNSS_Arduino_Library.h> // http://librarymanager/All#SparkFun_u-blox_GNSS_Arduino_Library";
Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>";
Blockly.Arduino.libraries_["library_senseBoxMCU"] =
'#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_["GPS"] = "SFE_UBLOX_GNSS myGNSS;";
Blockly.Arduino.setupCode_["init_gps"] = ` Wire.begin();
@ -383,6 +523,7 @@ return tsBuffer;
*/
Blockly.Arduino.sensebox_sensor_truebner_smt50 = function () {
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
var dropdown_port = this.getFieldValue("Port");
var dropdown_value = this.getFieldValue("value");
var dropdown_pin = 1;
@ -435,9 +576,11 @@ Blockly.Arduino.sensebox_sensor_watertemperature = function () {
if (dropdown_port === "C") {
dropdown_pin = 5;
}
Blockly.Arduino.libraries_["library_oneWire"] = '#include "OneWire.h"';
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_oneWire"] =
"#include <OneWire.h> // http://librarymanager/All#OneWire";
Blockly.Arduino.libraries_["library_oneDallasTemperature"] =
'#include "DallasTemperature.h"';
"#include <DallasTemperature.h> // http://librarymanager/All#DallasTemperature";
Blockly.Arduino.definitions_["define_OneWire"] =
"#define ONE_WIRE_BUS " +
dropdown_pin +
@ -488,6 +631,7 @@ float getWindspeed(){
*/
Blockly.Arduino.sensebox_soundsensor_dfrobot = function () {
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
var dropdown_port = this.getFieldValue("Port");
var dropdown_pin = 1;
if (dropdown_port === "A") {
@ -511,3 +655,42 @@ float getSoundValue(){
var code = "getSoundValue()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
* Infineon DPS310 Pressure Sensor
*
*/
Blockly.Arduino.sensebox_sensor_dps310 = function () {
var dropdown_name = this.getFieldValue("NAME");
var code = "";
var referencePressure = this.getFieldValue("referencePressure");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_[
"adafruit_dps310"
] = `#include <Adafruit_DPS310.h> // http://librarymanager/All#Adafruit_DPS310`;
Blockly.Arduino.definitions_["define_dps"] = "Adafruit_DPS310 dps;";
Blockly.Arduino.setupCode_["dps_begin"] = "dps.begin_I2C(0x76);";
Blockly.Arduino.setupCode_["dps_configuration"] = `
dps.configurePressure(DPS310_64HZ, DPS310_64SAMPLES);
dps.configureTemperature(DPS310_64HZ, DPS310_64SAMPLES);
`;
Blockly.Arduino.loopCodeOnce_["dps_events"] =
"sensors_event_t temp_event, pressure_event;";
Blockly.Arduino.loopCodeOnce_["dps_getEvents"] =
"dps.getEvents(&temp_event, &pressure_event);";
switch (dropdown_name) {
case "Temperature":
code = "temp_event.temperature";
break;
case "Pressure":
code = "pressure_event.pressure";
break;
case "Altitude":
code = "dps.readAltitude(" + referencePressure + ")";
break;
default:
code = "";
}
return [code, Blockly.Arduino.ORDER_ATOMIC];
};

View File

@ -1,29 +1,40 @@
import * as Blockly from 'blockly/core';
import * as Blockly from "blockly/core";
/**
* Telegram Bot by re:edu
*/
Blockly.Arduino.sensebox_telegram = function (Block) {
let token = Block.getFieldValue('telegram_token');
Blockly['Arduino'].libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly['Arduino'].libraries_['library_telegram'] = `#include <UniversalTelegramBot.h>`
Blockly['Arduino'].functionNames_['WiFiSSLClient'] = 'WiFiSSLClient client;';
Blockly['Arduino'].functionNames_['telegram_objects'] = `#define BOTtoken "${token}" // your Bot Token (Get from Botfather)
let token = Block.getFieldValue("telegram_token");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly["Arduino"].libraries_[
"library_telegram"
] = `#include <UniversalTelegramBot.h>`;
Blockly["Arduino"].functionNames_["WiFiSSLClient"] = "WiFiSSLClient client;";
Blockly["Arduino"].functionNames_[
"telegram_objects"
] = `#define BOTtoken "${token}" // your Bot Token (Get from Botfather)
UniversalTelegramBot bot(BOTtoken, client);`
UniversalTelegramBot bot(BOTtoken, client);`;
let code = '';
let code = "";
return code;
};
Blockly.Arduino.sensebox_telegram_do = function (block) {
var messageProcessing = Blockly.Arduino.statementToCode(block, 'telegram_do', Blockly.Arduino.ORDER_ATOMIC);
var messageProcessing = Blockly.Arduino.statementToCode(
block,
"telegram_do",
Blockly.Arduino.ORDER_ATOMIC
);
Blockly.Arduino.definitions_['telegram_variables'] = `int Bot_mtbs = 1000; //mean time between scan messages
long Bot_lasttime; //last time messages' scan has been done`
Blockly.Arduino.definitions_[
"telegram_variables"
] = `int Bot_mtbs = 1000; //mean time between scan messages
long Bot_lasttime; //last time messages' scan has been done`;
Blockly.Arduino.loopCodeOnce_['sensebox_telegram_loop'] = `if (millis() > Bot_lasttime + Bot_mtbs) {
Blockly.Arduino.loopCodeOnce_[
"sensebox_telegram_loop"
] = `if (millis() > Bot_lasttime + Bot_mtbs) {
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
while(numNewMessages) {
for(int i=0; i<numNewMessages; i++) {
@ -36,13 +47,17 @@ Blockly.Arduino.sensebox_telegram_do = function (block) {
}
Bot_lasttime = millis();
}`;
var code = '';
var code = "";
return code;
};
Blockly.Arduino.sensebox_telegram_do_on_message = function (block) {
var message = this.getFieldValue('telegram_message');
var stuffToDo = Blockly.Arduino.statementToCode(block, 'telegram_do_on_message', Blockly.Arduino.ORDER_ATOMIC);
var message = this.getFieldValue("telegram_message");
var stuffToDo = Blockly.Arduino.statementToCode(
block,
"telegram_do_on_message",
Blockly.Arduino.ORDER_ATOMIC
);
var code = `
if (text == "${message}") {
${stuffToDo}
@ -51,7 +66,12 @@ Blockly.Arduino.sensebox_telegram_do_on_message = function (block) {
};
Blockly.Arduino.sensebox_telegram_send = function (block) {
var textToSend = Blockly.Arduino.valueToCode(this, 'telegram_text_to_send', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
var textToSend =
Blockly.Arduino.valueToCode(
this,
"telegram_text_to_send",
Blockly.Arduino.ORDER_ATOMIC
) || '"Keine Eingabe"';
var code = `bot.sendMessage(chat_id, String(${textToSend}), "");\n`;
return code;
};

View File

@ -1,25 +1,112 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/* Wifi connection and openSenseMap Blocks*/
Blockly.Arduino.sensebox_wifi = function (block) {
var pw = this.getFieldValue('Password');
var ssid = this.getFieldValue('SSID');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_network'] = 'Bee* b = new Bee();';
if (pw === "") {
Blockly.Arduino.setupCode_['sensebox_network'] = 'b->connectToWifi("' + ssid + '");\ndelay(1000);';
} else
Blockly.Arduino.setupCode_['sensebox_network'] = 'b->connectToWifi("' + ssid + '","' + pw + '");\ndelay(1000);';
var code = '';
return code;
var pw = this.getFieldValue("Password");
var ssid = this.getFieldValue("SSID");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_WiFi"] = "#include <WiFi101.h>";
Blockly.Arduino.variables_["ssid"] = `char ssid[] = "${ssid}";`;
Blockly.Arduino.variables_["pass"] = `char pass[] = "${pw}";`;
Blockly.Arduino.variables_["wifi_Status"] = "int status = WL_IDLE_STATUS;";
if (pw === "") {
Blockly.Arduino.setupCode_["wifi_begin"] = `
if (WiFi.status() == WL_NO_SHIELD) {
while (true);
}
while (status != WL_CONNECTED) {
status = WiFi.begin(ssid);
delay(5000);
}
`;
} else
Blockly.Arduino.setupCode_["wifi_begin"] = `
if (WiFi.status() == WL_NO_SHIELD) {
while (true);
}
while (status != WL_CONNECTED) {
status = WiFi.begin(ssid, pass);
delay(5000);
}
`;
var code = "";
return code;
};
Blockly.Arduino.sensebox_wifi_status = function () {
var code = "WiFi.status()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_wifi_rssi = function () {
var code = "WiFi.RSSI()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_get_ip = function () {
Blockly.Arduino.definitions_["define_ipadress"] = "IPAddress ip;";
Blockly.Arduino.setupCode_["sensebox_get_ip"] = " ip = WiFi.localIP();";
var code = "";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_startap = function (block) {
var ssid = this.getFieldValue('SSID');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.definitions_['define_network'] = 'Bee* b = new Bee();';
Blockly.Arduino.setupCode_['sensebox_network'] = 'b->startAP("' + ssid + '");'
var code = '';
return code;
};
var ssid = this.getFieldValue("SSID");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_WiFi"] = "#include <WiFi101.h>";
Blockly.Arduino.setupCode_["wifi_startAP"] = `WiFi.beginAP(${ssid});`;
var code = "";
return code;
};
Blockly.Arduino.sensebox_ethernet = function () {
var ip = this.getFieldValue("ip");
var gateway = this.getFieldValue("gateway");
var subnetmask = this.getFieldValue("subnetmask");
var dns = this.getFieldValue("dns");
var mac = this.getFieldValue("mac");
var dhcp = this.getFieldValue("dhcp");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_ethernet"] =
"#include <Ethernet.h> // http://librarymanager/All#Ethernet";
Blockly.Arduino.definitions_["ethernet_config"] = `
byte mac[] = { ${mac}};`;
if (dhcp === "Manual") {
Blockly.Arduino.definitions_["ethernet_manual_config"] = `
//Configure static IP setup (only needed if DHCP is disabled)
IPAddress myIp(${ip.replaceAll(".", ", ")});
IPAddress myDns(${dns.replaceAll(".", ",")});
IPAddress myGateway(${gateway.replaceAll(".", ",")});
IPAddress mySubnet(${subnetmask.replaceAll(".", ",")});
`;
Blockly.Arduino.setupCode_["ethernet_setup"] = `
Ethernet.init(23);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
// no point in carrying on, so do nothing forevermore:
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, myIp);
}
// give the Ethernet shield a second to initialize:
delay(1000);
`;
} else {
Blockly.Arduino.setupCode_["ethernet_setup"] = `
Ethernet.init(23);
// start the Ethernet connection:
Ethernet.begin(mac);
// give the Ethernet shield a second to initialize:
delay(1000);
`;
}
var code = "";
return code;
};
Blockly.Arduino.sensebox_ethernetIp = function () {
var code = "Ethernet.localIP()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};

View File

@ -0,0 +1,35 @@
import * as Blockly from "blockly/core";
Blockly.Arduino["print_serial_monitor"] = function (block) {
var serialId = block.getFieldValue("SERIAL_ID");
var content =
Blockly.Arduino.valueToCode(
block,
"CONTENT",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var checkbox_name = block.getFieldValue("NEW_LINE") === "TRUE";
var code = "";
if (checkbox_name) {
code = serialId + ".println(" + content + ");\n";
} else {
code = serialId + ".print(" + content + ");\n";
}
return code;
};
/**
* Code generator for block for setting the serial com speed.
* Arduino code: setup{ Serial.begin(X); }
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code.
*/
Blockly.Arduino["init_serial_monitor"] = function (block) {
var serialId = block.getFieldValue("SERIAL_ID");
var serialSpeed = block.getFieldValue("SPEED");
Blockly.Arduino.setupCode_[
"init_serial"
] = `${serialId}.begin(${serialSpeed});`;
var code = "";
return code;
};

View File

@ -1,4 +1,4 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/**
* @license Licensed under the Apache License, Version 2.0 (the "License"):
@ -16,11 +16,15 @@ import Blockly from 'blockly';
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['time_delay'] = function (block) {
var delayTime = Blockly.Arduino.valueToCode(
block, 'DELAY_TIME_MILI', Blockly.Arduino.ORDER_ATOMIC) || '0';
var code = 'delay(' + delayTime + ');\n';
return code;
Blockly.Arduino["time_delay"] = function (block) {
var delayTime =
Blockly.Arduino.valueToCode(
block,
"DELAY_TIME_MILI",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var code = "delay(" + delayTime + ");\n";
return code;
};
/**
@ -29,11 +33,15 @@ Blockly.Arduino['time_delay'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['time_delaymicros'] = function (block) {
var delayTimeMs = Blockly.Arduino.valueToCode(
block, 'DELAY_TIME_MICRO', Blockly.Arduino.ORDER_ATOMIC) || '0';
var code = 'delayMicroseconds(' + delayTimeMs + ');\n';
return code;
Blockly.Arduino["time_delaymicros"] = function (block) {
var delayTimeMs =
Blockly.Arduino.valueToCode(
block,
"DELAY_TIME_MICRO",
Blockly.Arduino.ORDER_ATOMIC
) || "0";
var code = "delayMicroseconds(" + delayTimeMs + ");\n";
return code;
};
/**
@ -42,9 +50,9 @@ Blockly.Arduino['time_delaymicros'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code with order of operation.
*/
Blockly.Arduino['time_millis'] = function (block) {
var code = 'millis()';
return [code, Blockly.Arduino.ORDER_ATOMIC];
Blockly.Arduino["time_millis"] = function (block) {
var code = "millis()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
@ -53,9 +61,9 @@ Blockly.Arduino['time_millis'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {array} Completed code with order of operation.
*/
Blockly.Arduino['time_micros'] = function (block) {
var code = 'micros()';
return [code, Blockly.Arduino.ORDER_ATOMIC];
Blockly.Arduino["time_micros"] = function (block) {
var code = "micros()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
/**
@ -64,17 +72,39 @@ Blockly.Arduino['time_micros'] = function (block) {
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly.Arduino['infinite_loop'] = function (block) {
return 'while(true);\n';
Blockly.Arduino["infinite_loop"] = function (block) {
return "while(true);\n";
};
// Blockly.Arduino.sensebox_interval_timer = function (block) {
// var interval = this.getFieldValue("interval");
// Blockly.Arduino.variables_["define_interval_variables"] =
// "const long interval = " +
// interval +
// ";\nlong time_start = 0;\nlong time_actual = 0;";
// var branch = Blockly.Arduino.statementToCode(block, "DO");
// var code = "time_start = millis();\n";
// code +=
// "if (time_start > time_actual + interval) {\n time_actual = millis();\n";
// code += branch;
// code += "}\n";
// return code;
// };
Blockly.Arduino.sensebox_interval_timer = function (block) {
var interval = this.getFieldValue('interval');
Blockly.Arduino.variables_['define_interval_variables'] = 'const long interval = ' + interval + ';\nlong time_start = 0;\nlong time_actual = 0;';
var branch = Blockly.Arduino.statementToCode(block, 'DO');
var code = 'time_start = millis();\n';
code += 'if (time_start > time_actual + interval) {\n time_actual = millis();\n'
code += branch;
code += '}\n'
return code;
};
var intervalTime = this.getFieldValue("interval");
var intervalName = this.getFieldValue("name");
Blockly.Arduino.variables_[`define_interval_variables${intervalName}`] = `
const long interval${intervalName} = ${intervalTime};
long time_start${intervalName} = 0;
long time_actual${intervalName} = 0;`;
Blockly.Arduino.loopCodeOnce_[
`interval_loop${intervalName}`
] = `time_start${intervalName} = millis();\n`;
var branch = Blockly.Arduino.statementToCode(block, "DO");
var code = `
if (time_start${intervalName} > time_actual${intervalName} + interval${intervalName}) {\n time_actual${intervalName} = millis();\n`;
code += branch;
code += "}\n";
return code;
};

View File

@ -0,0 +1,16 @@
import * as Blockly from "blockly/core";
Blockly.Arduino.watchdog_enable = function () {
var time = this.getFieldValue("TIME");
Blockly.Arduino.libraries_["Adafruit_sleepydog"] =
"#include <Adafruit_SleepyDog.h> // http://librarymanager/All#Adafruit_SleepyDog_Library";
Blockly.Arduino.setupCode_["watchdog_enable"] = `Watchdog.enable(${time});`;
var code = "";
return code;
};
Blockly.Arduino.watchdog_reset = function () {
var code = "Watchdog.reset();";
return code;
};

View File

@ -1,114 +1,133 @@
import Blockly from 'blockly';
import Blockly from "blockly";
/**
* Webserver Blocks by Lucas Steinmann
*
*
*/
Blockly.Arduino.sensebox_initialize_http_server = function (block) {
var box_id = this.getFieldValue('Port');
Blockly.Arduino.libraries_['library_senseBoxMCU'] = '#include "SenseBoxMCU.h"';
Blockly.Arduino.codeFunctions_['define_wifi_server'] = 'WiFiServer server(' + box_id + ');';
Blockly.Arduino.setupCode_['sensebox_wifi_server_beging'] = 'server.begin();';
return '';
var box_id = this.getFieldValue("Port");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_http"] = "#include <WebUtil.h>";
Blockly.Arduino.codeFunctions_["define_wifi_server"] =
"WiFiServer server(" + box_id + ");";
Blockly.Arduino.setupCode_["sensebox_wifi_server_beging"] = "server.begin();";
return "";
};
Blockly.Arduino.sensebox_http_on_client_connect = function (block) {
var onConnect = Blockly.Arduino.statementToCode(block, 'ON_CONNECT');
var code = '';
code += 'WiFiClient client = server.available();\n';
code += 'if (client && client.available()) {\n';
code += ' String request_string = listenClient(client);\n';
code += ' Request request;\n';
code += ' if (parseRequestSafe(request_string, request)) {\n';
code += onConnect;
code += ' }\n';
code += ' delay(1);\n';
code += ' client.stop();\n';
code += ' delay(1);\n';
code += '}\n';
return code;
var onConnect = Blockly.Arduino.statementToCode(block, "ON_CONNECT");
var code = "";
code += "WiFiClient client = server.available();\n";
code += "if (client && client.available()) {\n";
code += " String request_string = listenClient(client);\n";
code += " Request request;\n";
code += " if (parseRequestSafe(request_string, request)) {\n";
code += onConnect;
code += " }\n";
code += " delay(1);\n";
code += " client.stop();\n";
code += " delay(1);\n";
code += "}\n";
return code;
};
Blockly.Arduino.sensebox_http_method = function (block) {
var code = "request.method";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.method";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_http_uri = function (block) {
var code = "request.uri";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.uri";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_http_protocol_version = function (block) {
var code = "request.protocol_version";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.protocol_version";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_http_user_agent = function (block) {
var code = "request.user_agent";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "request.user_agent";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_generate_html_doc = function (block) {
var header = Blockly.Arduino.valueToCode(block, 'HEADER', Blockly.Arduino.ORDER_NONE) || '""';
var body = Blockly.Arduino.valueToCode(block, 'BODY', Blockly.Arduino.ORDER_NONE) || '""';
var code = 'buildHTML(' + header + ', ' + body + ')';
return [code, Blockly.Arduino.ORDER_ATOMIC];
var header =
Blockly.Arduino.valueToCode(block, "HEADER", Blockly.Arduino.ORDER_NONE) ||
'""';
var body =
Blockly.Arduino.valueToCode(block, "BODY", Blockly.Arduino.ORDER_NONE) ||
'""';
var code = "buildHTML(" + header + ", " + body + ")";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_generate_http_succesful_response = function (block) {
var content = Blockly.Arduino.valueToCode(block, 'CONTENT', Blockly.Arduino.ORDER_NONE) || '""';
var code = 'client.println(buildSuccessfulResponse(request, ' + content + '));\n';
return code;
var content =
Blockly.Arduino.valueToCode(block, "CONTENT", Blockly.Arduino.ORDER_NONE) ||
'""';
var code =
"client.println(buildSuccessfulResponse(request, " + content + "));\n";
return code;
};
Blockly.Arduino.sensebox_generate_http_not_found_response = function (block) {
var code = 'client.println(buildNotFoundResponse(request));\n';
return code;
var code = "client.println(buildNotFoundResponse(request));\n";
return code;
};
Blockly.Arduino.sensebox_ip_address = function (block) {
var code = "b->getIpAddress()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
var code = "b->getIpAddress()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_general_html_tag = function (block) {
var tag = this.getFieldValue('TAG');
var code = 'buildTag("' + tag + '",';
var n = 0;
var branch = Blockly.Arduino.valueToCode(block, 'DO' + n, Blockly.Arduino.ORDER_NONE);
if (branch.length > 0) {
code += '\n ' + branch;
} else {
code += '""';
}
for (n = 1; n <= block.additionalChildCount_; n++) {
branch = Blockly.Arduino.valueToCode(block, 'DO' + n, Blockly.Arduino.ORDER_NONE);
code += ' +' + branch;
}
return [code + ')', Blockly.Arduino.ORDER_ATOMIC];
var tag = this.getFieldValue("TAG");
var code = 'buildTag("' + tag + '",';
var n = 0;
var branch = Blockly.Arduino.valueToCode(
block,
"DO" + n,
Blockly.Arduino.ORDER_NONE
);
if (branch.length > 0) {
code += "\n " + branch;
} else {
code += '""';
}
for (n = 1; n <= block.additionalChildCount_; n++) {
branch = Blockly.Arduino.valueToCode(
block,
"DO" + n,
Blockly.Arduino.ORDER_NONE
);
code += " +" + branch;
}
return [code + ")", Blockly.Arduino.ORDER_ATOMIC];
};
Blockly.Arduino.sensebox_web_readHTML = function (block) {
var filename = this.getFieldValue('FILENAME');
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
Blockly.Arduino.libraries_['library_sd'] = '#include <SD.h>';
Blockly.Arduino.codeFunctions_['define_sd' + filename] = 'File webFile;';
Blockly.Arduino.setupCode_['sensebox_sd'] = 'SD.begin(28);';
var func = [
'String generateHTML(){',
' webFile = SD.open("' + filename + '", FILE_READ);',
' String finalString ="";',
' while (webFile.available())',
' {',
' finalString+=(char)webFile.read();',
' }',
' return finalString;',
'}'];
var functionName = Blockly.Arduino.addFunction(
'generateHTML', func.join('\n'));
var code = functionName + '()';
return [code, Blockly.Arduino.ORDER_ATOMIC];
};
var filename = this.getFieldValue("FILENAME");
Blockly.Arduino.libraries_["library_spi"] = "#include <SPI.h>";
Blockly.Arduino.libraries_["library_sd"] = "#include <SD.h>";
Blockly.Arduino.codeFunctions_["define_sd" + filename] = "File webFile;";
Blockly.Arduino.setupCode_["sensebox_sd"] = "SD.begin(28);";
var func = [
"String generateHTML(){",
' webFile = SD.open("' + filename + '", FILE_READ);',
' String finalString ="";',
" while (webFile.available())",
" {",
" finalString+=(char)webFile.read();",
" }",
" return finalString;",
"}",
];
var functionName = Blockly.Arduino.addFunction(
"generateHTML",
func.join("\n")
);
var code = functionName + "()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};

View File

@ -11,6 +11,7 @@ const colours = {
audio: 250,
arrays: 33,
mqtt: 90,
serial: 230,
webserver: 40,
phyphox: 25,
};

View File

@ -9,11 +9,11 @@ const maxInstances = {
sensebox_display_beginDisplay: 1,
sensebox_telegram: 1,
sensebox_telegram_do: 1,
sensebox_interval_timer: 1,
sensebox_osem_connection: 1,
sensebox_lora_initialize_otaa: 1,
sensebox_lora_initialize_abp: 1,
sensebox_phyphox_init: 1,
sensebox_ethernet: 1,
};
export const getMaxInstances = () => {

View File

@ -27,7 +27,7 @@ export const BLE = {
sensebox_phyphox_graphStyle: "Stil",
sensebox_phyphox_init_tooltip:
"Initialisere das Bluetooth Bee. Stecke diese auf dem Steckplatz **XBEE1**. Gib dem Phphox Messgerät einen eindeutigen Namen, damit du dieses in der App wiederfindest",
"Initialisere das Bluetooth Bee. Stecke diese auf dem Steckplatz **XBEE1**. Gib dem Phyphox Messgerät einen eindeutigen Namen, damit du dieses in der App wiederfindest",
sensebox_phyphox_experiment_tooltip:
"Erstelle ein Experiment und vergib einen eindeutigen Namen und eine kurze Beschreibung. Füge bis zu 5 verschiedene Graphen in der Ansicht hinzu. ",
sensebox_phyphox_graph_tooltip:

View File

@ -1,44 +1,59 @@
export const LORA = {
/*
* LoRa Blöcke
*/
/*
* LoRa Blöcke
*/
senseBox_LoRa_connect: "Zu TTN senden",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Intervall in Minuten",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_connect: "Zu TTN senden",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Intervall in Minuten",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_send_message: "Sende als Lora Nachricht",
senseBox_LoRa_send_cayenne: "Sende als Cayenne Nachricht",
senseBox_LoRa_cayenne_temperature: "Temperatur",
senseBox_LoRa_cayenne_channel: "Kanal",
senseBox_LoRa_cayenne_humidity: "Luftfeuchtigkeit",
senseBox_LoRa_cayenne_pressure: "Luftdruck",
senseBox_LoRa_cayenne_luminosity: "Helligkeit",
senseBox_LoRa_cayenne_analog: "Analoger Wert",
senseBox_LoRa_cayenne_x: "X Wert",
senseBox_LoRa_cayenne_y: "Y Wert",
senseBox_LoRa_cayenne_z: "Z Wert",
senseBox_LoRa_cayenne_lat: "Breitengrad",
senseBox_LoRa_cayenne_lng: "Längengrad",
senseBox_LoRa_cayenne_alt: "Höhe",
senseBox_LoRa_send_message: "Sende als Lora Nachricht",
senseBox_LoRa_send_cayenne: "Sende als Cayenne Nachricht",
senseBox_LoRa_cayenne_temperature: "Temperatur",
senseBox_LoRa_cayenne_channel: "Kanal",
senseBox_LoRa_cayenne_humidity: "Luftfeuchtigkeit",
senseBox_LoRa_cayenne_pressure: "Luftdruck",
senseBox_LoRa_cayenne_luminosity: "Helligkeit",
senseBox_LoRa_cayenne_analog: "Analoger Wert",
senseBox_LoRa_cayenne_x: "X Wert",
senseBox_LoRa_cayenne_y: "Y Wert",
senseBox_LoRa_cayenne_z: "Z Wert",
senseBox_LoRa_cayenne_lat: "Breitengrad",
senseBox_LoRa_cayenne_lng: "Längengrad",
senseBox_LoRa_cayenne_alt: "Höhe",
senseBox_LoRa_cayenne_concentration: "Konzentration",
senseBox_LoRa_cayenne_tip: "Sende Daten als Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Sende GPS",
senseBox_LoRa_cayenne_temperature_tip: "Sendet Temperaturwert mit einer Nachkommastelle",
senseBox_LoRa_cayenne_pressure_tip: "Sendet Luftdruck mit einer Nachkommastelle",
senseBox_LoRa_cayenne_luminosity_tip: "Sendet Helligkeitswert",
senseBox_LoRa_cayenne_analog_tip: "Sendet einen Dezimalwert mit einer Nachkommastelle",
senseBox_LoRa_cayenne_tip: "Sende Daten als Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Sende GPS",
senseBox_LoRa_cayenne_temperature_tip:
"Sendet Temperaturwert mit einer Nachkommastelle",
senseBox_LoRa_cayenne_pressure_tip:
"Sendet Luftdruck mit einer Nachkommastelle",
senseBox_LoRa_cayenne_luminosity_tip: "Sendet Helligkeitswert",
senseBox_LoRa_cayenne_analog_tip:
"Sendet einen Dezimalwert mit einer Nachkommastelle",
senseBox_LoRa_message_tooltip: "Sende eine Nachricht über LoRa",
senseBox_LoRa_sensor_tip: "Sende einen Sensorwert mit einer bestimmten Anzahl an Bytes",
senseBox_LoRa_init_abp_tooltip: "Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über ABP. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere den **Network Session Key** und den **App Session Key** im **msb Format** und die **Device ID** im **hex Format**.",
senseBox_LoRa_init_helpurl: "https://docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip: "Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über OTAA. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere die **DEVICE EUI** und die **Application EUI** im **lsb Format** den **App Key** im **msb Format**.",
}
senseBox_LoRa_cayenne_concentration_tip: "Sendet eine Konzentration in PPM",
senseBox_LoRa_message_tooltip: "Sende eine Nachricht über LoRa",
senseBox_LoRa_sensor_tip:
"Sende einen Sensorwert mit einer bestimmten Anzahl an Bytes",
senseBox_LoRa_init_abp_tooltip:
"Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über ABP. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere den **Network Session Key** und den **App Session Key** im **msb Format** und die **Device ID** im **hex Format**.",
senseBox_LoRa_init_helpurl:
"https://docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip:
"Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über OTAA. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere die **DEVICE EUI** und die **Application EUI** im **lsb Format** den **App Key** im **msb Format**.",
sensebox_lora_ttn_mapper_tip:
"Mit einem TTN Mapper kannst du die LoRa-Netzabdeckung in deiner Umgebung aufzeichnen. Die Daten werden dann auf [ttnmaper](https://ttnmapper.org) angezeigt. Den notwendigen Decoder findest du [hier](https://gist.github.com/felixerdy/f959ac03df98c6947f1c7f35d537f23e#file-decoder-js).",
sensebox_lora_ttn_mapper_helpurl:
"https://sensebox.de/projects/de/2020-03-06-ttn-mapper",
};

View File

@ -1,17 +1,23 @@
export const OSEM = {
/**
* openSenseMap
*/
senseBox_osem_connection_tip: "stellt eine WLAN verbindung her",
senseBox_send_to_osem_tip: "sende Messwert an",
senseBox_send_to_osem: "Sende Messwert an die openSenseMap",
senseBox_osem_connection: "Verbinde mit openSenseMap:",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Typ",
senseBox_osem_stationary: "Stationär",
senseBox_osem_mobile: "Mobil",
senseBox_osem_access_token: "API Schlüssel",
senseBox_send_mobile_to_osem: "Sende Messwert und Standort an die openSenseMap",
senseBox_send_mobile_to_osem_tip: "Sende Messwert und Standort an die openSenseMap",
}
/**
* openSenseMap
*/
senseBox_osem_connection_tip:
"Verwende diesen Block, um deine senseBox mit der openSenseMap zu verbinden. Registriere deine senseBox auf der openSenseMap und trage die IDs und den API-Schlüssel ein. Verwende anschließend den Block ***Sende Messwert an die openSenseMap*** und die Sensor-ID, um die Messwerte zu übertragen.",
senseBox_osem_connection_helpurl: "https://www.opensensemap.org/",
senseBox_send_to_osem_tip:
"Sende mit diesem Block Messwerte an die openSenseMap. Verwende pro Messwert einen Block und trage die zugewiesene Sensor ID ein",
senseBox_send_to_osem: "Sende Messwert an die openSenseMap",
senseBox_osem_connection: "Verbinde mit openSenseMap:",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Typ",
senseBox_osem_stationary: "Stationär",
senseBox_osem_mobile: "Mobil",
senseBox_osem_access_token: "API Schlüssel",
senseBox_send_mobile_to_osem:
"Sende Messwert und Standort an die openSenseMap",
senseBox_send_mobile_to_osem_tip:
"Sende Messwert und Standort an die openSenseMap",
senseBox_osem_restart: "Bei Verbindungsverlust Gerät neustarten?",
};

View File

@ -1,129 +1,147 @@
export const SENSORS = {
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* BMP280
*/
senseBox_pressure_sensor: "Luftdruck-/Temperatursensor (BMP280)",
senseBox_pressure: "Luftdruck in Pa",
senseBox_pressure_dimension: "Luftdruck in Pa",
senseBox_pressure_tip: "Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für den Luftdruck in Pa. Um die korrekte Höhe über NN zu berechnen benötigt der Sensor einen aktuellen Referenzwert.",
senseBox_pressure_referencePressure: "Luftdruck auf NN",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl: "",
/**
* BMP280
*/
senseBox_pressure_sensor: "Luftdruck-/Temperatursensor (BMP280)",
senseBox_pressure: "Luftdruck in hPa",
senseBox_pressure_dimension: "Luftdruck in hPa",
senseBox_pressure_tooltip:
"Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für den Luftdruck in hPa. Um die korrekte Höhe über NN zu berechnen benötigt der Sensor einen aktuellen Referenzwert.",
senseBox_pressure_referencePressure: "Luftdruck auf NN",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl:
"https://docs.sensebox.de/hardware/sensoren-luftdruck-temperatur/",
/**
* DPS310
*/
senseBox_sensor_dps310: "Luftdruck-/Temperatursensor (DPS310)",
senseBox_sensor_dps310_tooltip:
"Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für den Luftdruck in hPa. Um die korrekte Höhe über NN zu berechnen benötigt der Sensor einen aktuellen Referenzwert.",
senseBox_sensor_dps310_helpurl: "",
/**
* Mikro
*/
senseBox_sound: "Mikrofon",
senseBox_sound_tip: "Schließe den Sensor über das Breadbord an einen der 3 **analog/digital** Ports an. Gibt den Messwert des Mikrofons in Volt zurück",
senseBox_sound_helpurl: "https://docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Mikro
*/
senseBox_sound: "Mikrofon",
senseBox_sound_tip:
"Schließe den Sensor über das Breadbord an einen der 3 **analog/digital** Ports an. Gibt den Messwert des Mikrofons in Volt zurück",
senseBox_sound_helpurl: "https://docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperatur in °C",
senseBox_temp_hum: "Temperatur-/Luftfeuchtigkeitssensor (HDC1080)",
senseBox_temp_hum_tooltip: "Dieser Block gibt dir die Messwerte des Temperatur- und Luftfeuchtigkeitssensor zurück. Schließe den Sensor an einen der 5 I2C Anschlüsse an. Messwert wird mit 2 Nachkommastellen ausgegeben.",
senseBox_temp_hum_helpurl: "https://docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperatur in °C",
senseBox_temp_hum: "Temperatur-/Luftfeuchtigkeitssensor (HDC1080)",
senseBox_temp_hum_tooltip:
"Dieser Block gibt dir die Messwerte des Temperatur- und Luftfeuchtigkeitssensor zurück. Schließe den Sensor an einen der 5 I2C Anschlüsse an. Messwert wird mit 2 Nachkommastellen ausgegeben.",
senseBox_temp_hum_helpurl:
"https://docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
/**
* Ultraschalldistanzsensor
*/
/**
* Ultraschalldistanzsensor
*/
senseBox_ultrasonic: "Ultraschall-Abstandssensor an Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Misst die Distanz mithilfe von Ultraschall in cm. Schließe den Sensor an einen der drei Digital/Analog Ports an:
senseBox_ultrasonic: "Ultraschall-Abstandssensor an Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_maxDistance: "Maximale Distanz",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Misst die Distanz mithilfe von Ultraschall in cm. Schließe den Sensor an einen der drei Digital/Analog Ports an:
- Trigger: Grünes Kabel
- Echo: gelbes Kabel`,
senseBox_ultrasonic_helpurl: "https://docs.sensebox.de/hardware/sensoren-distanz/",
/**
* UV and Lightsensor
*/
senseBox_value: "Messwert:",
senseBox_uv_light: "Helligkeit-/UV-Sensor",
senseBox_uv_light_tooltip: "Sensor misst UV-Licht oder die Helligkeit. Die Helligkeit wird als **Ganzezahl** in Lux ausgegeben. Die UV-Intensität als **Kommazahl** in µW/cm².",
senseBox_uv: "UV-Intensität in µW/cm²",
senseBox_light: "Beleuchtungsstärke in Lux",
senseBox_uv_light_helpurl: "https://docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
- Echo: gelbes Kabel
Wenn die maximale Distanz überschritten wird, wird ein Wert von **O** ausgegeben`,
senseBox_ultrasonic_helpurl:
"https://docs.sensebox.de/hardware/sensoren-distanz/",
/**
* UV and Lightsensor
*/
senseBox_value: "Messwert:",
senseBox_uv_light: "Helligkeit-/UV-Sensor",
senseBox_uv_light_tooltip:
"Sensor misst UV-Licht oder die Helligkeit. Die Helligkeit wird als **Ganzezahl** in Lux ausgegeben. Die UV-Intensität als **Kommazahl** in µW/cm².",
senseBox_uv: "UV-Intensität in µW/cm²",
senseBox_light: "Beleuchtungsstärke in Lux",
senseBox_uv_light_helpurl:
"https://docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
/**
* BMX055
*/
/**
* BMX055
*/
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Beschleunigungssensor",
senseBox_bmx055_accelerometer_range: "Messbereich",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Richtung",
senseBox_bmx055_accelerometer_direction_x: "X-Achse",
senseBox_bmx055_accelerometer_direction_y: "Y-Achse",
senseBox_bmx055_accelerometer_direction_z: "Z-Achse",
senseBox_bmx055_accelerometer_direction_total: "Gesamt",
senseBox_bmx055_gyroscope: "Lage Sensor",
senseBox_bmx055_accelerometer_tip: "Lage Sensor",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Richtung",
senseBox_bmx055_y: "Y-Richtung",
senseBox_bmx055_accelerometer_tooltip: `Dieser Block gibt dir den Messwert des Beschleunigungssensors der direkt auf der senseBox MCU aufgelötet ist. Im Dropdown Menü kannst du die Richtung und den Messbereich auswählen.`,
senseBox_bmx055_helpurl: "",
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Beschleunigungssensor",
senseBox_bmx055_accelerometer_range: "Messbereich",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Richtung",
senseBox_bmx055_accelerometer_direction_x: "X-Achse",
senseBox_bmx055_accelerometer_direction_y: "Y-Achse",
senseBox_bmx055_accelerometer_direction_z: "Z-Achse",
senseBox_bmx055_accelerometer_direction_total: "Gesamt",
senseBox_bmx055_gyroscope: "Lage Sensor",
senseBox_bmx055_accelerometer_tip: "Lage Sensor",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Richtung",
senseBox_bmx055_y: "Y-Richtung",
senseBox_bmx055_accelerometer_tooltip: `Dieser Block gibt dir den Messwert des Beschleunigungssensors der direkt auf der senseBox MCU aufgelötet ist. Im Dropdown Menü kannst du die Richtung und den Messbereich auswählen.`,
senseBox_bmx055_helpurl: "",
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "Breitengrad",
senseBox_gps_lng: "Längengrad",
senseBox_gps_alt: "Höhe über NN in m",
senseBox_gps_speed: "Geschwindigkeit in km/h",
senseBox_gps_date: "Datum",
senseBox_gps_time: "Uhrzeit",
senseBox_gps_timeStamp: "Zeitstempel (RFC 3339)",
senseBox_gps_tooltip: `Liest das GPS Modul aus und gibt dir die Standortinformationen. Längen- und Breitengrad werden als Kommazahl mit 6 Nachkommastellen ausgegeben.
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "Breitengrad",
senseBox_gps_lng: "Längengrad",
senseBox_gps_alt: "Höhe über NN in m",
senseBox_gps_speed: "Geschwindigkeit in km/h",
senseBox_gps_date: "Datum",
senseBox_gps_time: "Uhrzeit",
senseBox_gps_timeStamp: "Zeitstempel (RFC 3339)",
senseBox_gps_tooltip: `Liest das GPS Modul aus und gibt dir die Standortinformationen. Längen- und Breitengrad werden als Kommazahl mit 6 Nachkommastellen ausgegeben.
**Anschluss: I2C**
**Beachte:** Das GPS Modul benöigt beim ersten Verwenden relativ lange (ca. 5-10 Minuten) bis es deinen Standort gefunden hat!
`,
senseBox_gps_helpurl: "https://docs.sensebox.de/hardware/sensoren-gps/",
senseBox_gps_helpurl: "https://docs.sensebox.de/hardware/sensoren-gps/",
/**
* Windspeed
*/
senseBox_windspeed: "Windgeschwindigkeitssensor",
senseBox_windspeed_tooltip: "",
/**
* Windspeed
*/
senseBox_windspeed: "Windgeschwindigkeitssensor",
senseBox_windspeed_tooltip: "",
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip: "Schließe den Sensor an einen der 3 **digital/analog Ports** an. Der Sensor gibt dir den Messwert in dB mit einer Nachkommastelle",
senseBox_soundsensor_dfrobot_helpurl: "https://docs.sensebox.de/hardware/sensoren-lautstaerke/",
/*
* BME680
*/
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip:
"Schließe den Sensor an einen der 3 **digital/analog Ports** an. Der Sensor gibt dir den Messwert in dB mit einer Nachkommastelle",
senseBox_soundsensor_dfrobot_helpurl:
"https://docs.sensebox.de/hardware/sensoren-lautstaerke/",
/*
* BME680
*/
senseBox_bme680: "Umweltsensor (BME680)",
senseBox_bme_iaq: "Innenraumluftqualität (IAQ)",
senseBox_bme_iaq_accuracy: "Kalibrierungswert",
senseBox_bme_co2: "CO2 Äquivalent",
senseBox_bme_breatheVocEquivalent: "Atemluft VOC Äquivalent",
senseBox_bme_tooltip: `Schließe den Umweltsensor an einen der 5 **I2C-Anschlüsse** an. **Beachte:** Der Sensor benöigt eine gewisse Zeit zum kalibrieren.
senseBox_bme680: "Umweltsensor (BME680)",
senseBox_bme_iaq: "Innenraumluftqualität (IAQ)",
senseBox_bme_iaq_accuracy: "Kalibrierungswert",
senseBox_bme_co2: "CO2 Äquivalent",
senseBox_bme_breatheVocEquivalent: "Atemluft VOC Äquivalent",
senseBox_bme_tooltip: `Schließe den Umweltsensor an einen der 5 **I2C-Anschlüsse** an. **Beachte:** Der Sensor benöigt eine gewisse Zeit zum kalibrieren.
Den Status der Kalibrierung kann über den Kalibrierungswert abgelesen werden. Er ist entweder 0, 1, 2 oder 3 und sagt folgendes aus:
- IAQ Accuracy : 0 heißt Sensor wird stabilisiert (dauert ca. 25 Minuten) oder dass es eine Zeitüberschreitung gab,
@ -132,49 +150,54 @@ Den Status der Kalibrierung kann über den Kalibrierungswert abgelesen werden. E
- IAQ Accuracy : 3 heißt Sensor erfolgreich kalibriert.
Die Messwerte für Temperatur, Luftfeuchtigkeit und Luftdruck können direkt verwendet werden.`,
senseBox_bme680_helpurl: "https://docs.sensebox.de/hardware/sensoren-umweltsensor/",
senseBox_bme680_helpurl:
"https://docs.sensebox.de/hardware/sensoren-umweltsensor/",
/**
* Truebner SMT50
*/
senseBox_smt50: "Bodenfeuchte/-temperatur (SMT50)",
senseBox_smt50_helpurl:
"https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip:
"Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* Truebner SMT50
*/
senseBox_smt50: "Bodenfeuchte/-temperatur (SMT50)",
senseBox_smt50_helpurl: "https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip: "Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip:
"Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für die CO2-Konzentration in ppm. Der Temperaturmesswert kann aufgrund der Messung direkt am Sensor um einige Grad vom realen Wert abweichen.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://docs.sensebox.de/hardware/sensoren-co2/",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip: "Schließe den Sensor an einen der 5 **I2C-Anschlüsse** an. Der Sensor gibt dir den Messwert für die CO2-Konzentration in ppm. Der Temperaturmesswert kann aufgrund der Messung direkt am Sensor um einige Grad vom realen Wert abweichen.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://docs.sensebox.de/hardware/sensoren-co2/",
/**
* Feinstaubsensor (SDS011)
*/
/**
* Feinstaubsensor (SDS011)
*/
senseBox_sds011: "Feinstaubsensor",
senseBox_sds011_dimension: "in µg/m³ an",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip:
"Dieser Block gibt dir den Messwert des Feinstaubsensor. Schließe den Feinstaubsensor an einen der 2 **Serial/UART** Anschlüssen an. Im Dropdown Menü zwischen PM2.5 und PM10 auswählen. Der Messwert wird dir als **Kommazahl** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl:
"https://docs.sensebox.de/hardware/sensoren-feinstaub/",
senseBox_sds011: "Feinstaubsensor",
senseBox_sds011_dimension: "in µg/m³ an",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip: "Dieser Block gibt dir den Messwert des Feinstaubsensor. Schließe den Feinstaubsensor an einen der 2 **Serial/UART** Anschlüssen an. Im Dropdown Menü zwischen PM2.5 und PM10 auswählen. Der Messwert wird dir als **Kommazahl** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl: "https://docs.sensebox.de/hardware/sensoren-feinstaub/",
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "ist gedrückt",
senseBox_button_switch: "als Schalter",
senseBox_button_wasPressed: "wurde gedrückt",
senseBox_button_longPress: "Gedrückt für",
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "ist gedrückt",
senseBox_button_switch: "als Schalter",
senseBox_button_wasPressed: "wurde gedrückt",
senseBox_button_tooltip: `Dieser Block gibt dir den Status des angeschlossenen Buttons. Im Dropdown Menü können verschiedene Modi für den Button ausgewählt werden. Angesteuert können entweder der on Board Button oder ein Button, der an einen der 6 digitalen Pins angeschlossen ist. verschiedene Modi:
senseBox_button_tooltip: `Dieser Block gibt dir den Status des angeschlossenen Buttons. Im Dropdown Menü können verschiedene Modi für den Button ausgewählt werden. Angesteuert können entweder der on Board Button oder ein Button, der an einen der 6 digitalen Pins angeschlossen ist. verschiedene Modi:
- "ist gedrückt": Mit diesem Modus kannst du abfragen ob der Block gerade gedrückt wird. Du erhältst entweder den Wert TRUE oder FALSE.
- "wurde gedrückt": Mit diesem Modus kannst du abfragen ob der Block gedrückt wurde. Erst wenn der Knopf gedrückt und wieder losgelassen wurde erhältst du TRUE zurück
- "als Schalter": Wenn du diesen Block verwendest kannst du den Knopf wie ein Lichtschalter verwenden. Der Status wird gespeichert bis der Button erneut gedrückt wird`,
senseBox_button_helpurl: "",
}
senseBox_button_helpurl: "",
};

View File

@ -1,11 +1,29 @@
export const WEB = {
/**
* WiFi
*/
senseBox_wifi_connect: "Verbinde mit WLAN",
senseBox_wifi_ssid: "Netzwerkname",
senseBox_wifi_tooltip: "Stellt eine Verbindung mit einem WLAN-Netzwerk her. Möchtest du dich mit einem ungesicheren Netzwerk (z.B. Freifunk) verbinden lösche das Feld Passwort. Das WiFi-Bee muss auf den Steckplatz **XBEE1** aufgesteckt werden.",
senseBox_wifi_startap: "Initialisiere WLAN Access Point",
senseBox_wifi_startap_tooltip: "Erstellt einen WiFi-Accesspoint zu dem du dich verbinden kannst. Beachte, dass immer nur 1 Gerät gleichzeitig verbunden werden kann.",
senseBox_wifi_helpurl: "https://docs.sensebox.de/blockly/blockly-web-wifi/",
}
/**
* WiFi
*/
senseBox_wifi_connect: "Verbinde mit WLAN",
senseBox_wifi_ssid: "Netzwerkname",
senseBox_wifi_ip: "IP-Address",
senseBox_wifi_ip_tooltip: "Gibt die IP-Address der senseBox aus",
senseBox_wifi_status: "WiFi-Status",
senseBox_wifi_status_tooltip: "Gibt den Status der WiFi-Verbindung aus",
senseBox_wifi_rssi: "RSSI",
senseBox_wifi_rssi_tooltip: "Gibt die Sigal Stärke der WiFi-Verbindung",
senseBox_wifi_tooltip:
"Stellt eine Verbindung mit einem WLAN-Netzwerk her. Möchtest du dich mit einem ungesicheren Netzwerk (z.B. Freifunk) verbinden lösche das Feld Passwort. Das WiFi-Bee muss auf den Steckplatz **XBEE1** aufgesteckt werden.",
senseBox_wifi_startap: "Initialisiere WLAN Access Point",
senseBox_wifi_startap_tooltip:
"Erstellt einen WiFi-Accesspoint zu dem du dich verbinden kannst. Beachte, dass immer nur 1 Gerät gleichzeitig verbunden werden kann.",
senseBox_wifi_helpurl: "https://docs.sensebox.de/blockly/blockly-web-wifi/",
senseBox_ethernet: "Verbinde mit Ethernet",
senseBox_ethernet_dhcp: "DHCP",
senseBox_ethernet_manuel_config: "Manuelle Konfiguration",
senseBox_ethernet_ip: "IP-Adresse",
senseBox_ethernet_gateway: "Gateway",
senseBox_ethernet_subnetmask: "Subnetzmaske",
senseBox_ethernet_mac: "MAC-Adresse",
senseBox_ethernet_dns: "DNS-Server",
senseBox_ethernet_tooltip:
"Verbinde das LAN-Bee mit dem Steckplatz XBEE1. Die meisten Netzwerke verwenden DHCP und vergeben automatisch eine IP-Adresse. Solltest du eine Manuelle Konfiguration durchführen wollen wählen im Dropdown Menü **Manuelle Konfiguration** aus und gebe die entsprechenden Daten ein.",
};

View File

@ -1,20 +1,22 @@
export const TIME = {
/**
* Interval Block
*/
senseBox_interval_timer: "Messintervall",
senseBox_interval: "ms",
senseBox_interval_timer_tip: "Intervall",
ARD_TIME_DELAY: "Warte",
ARD_TIME_DELAY_MICROS: "Mikrosekunden",
ARD_TIME_DELAY_MICRO_TIP: "Warte eine spezifischen Zeit in Microsekunden",
ARD_TIME_DELAY_TIP: "Warte spezifische Zeit in Millisekunden",
ARD_TIME_INF: "Warte für immer (Beende Programm)",
ARD_TIME_INF_TIP: "Stoppt das Programm.",
ARD_TIME_MICROS: "Bereits vergangen Zeit (Mikrosekunden)",
ARD_TIME_MICROS_TIP: "Gibt eine Zahl in Microsekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MILLIS: "Bereits vergangen Zeit (Millisekunden)",
ARD_TIME_MILLIS_TIP: "Gibt eine Zahl in Millisekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MS: "Millisekunden",
}
/**
* Interval Block
*/
senseBox_interval_timer: "Intervall: ",
senseBox_interval: "ms",
senseBox_interval_timer_tip:
"Definiere ein Intervall, das alle x Millisekunden ausgeführt wird",
ARD_TIME_DELAY: "Warte",
ARD_TIME_DELAY_MICROS: "Mikrosekunden",
ARD_TIME_DELAY_MICRO_TIP: "Warte eine spezifischen Zeit in Microsekunden",
ARD_TIME_DELAY_TIP: "Warte spezifische Zeit in Millisekunden",
ARD_TIME_INF: "Warte für immer (Beende Programm)",
ARD_TIME_INF_TIP: "Stoppt das Programm.",
ARD_TIME_MICROS: "Bereits vergangen Zeit (Mikrosekunden)",
ARD_TIME_MICROS_TIP:
"Gibt eine Zahl in Microsekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MILLIS: "Bereits vergangen Zeit (Millisekunden)",
ARD_TIME_MILLIS_TIP:
"Gibt eine Zahl in Millisekunden zurück, die der Zeitdauer des Aktuellen Programms entspricht. Muss als positiven Integer gespeichert werden", // untranslated
ARD_TIME_MS: "Millisekunden",
};

View File

@ -10,6 +10,8 @@ export const UI = {
toolbox_time: "Zeit",
toolbox_functions: "Funktionen",
toolbox_variables: "Variablen",
toolbox_serial: "Seriell",
toolbox_advanced: "Erweitert",
variable_NUMBER: "Zahl (int)",
variable_SHORT_NUMBER: "char",
variable_LONG: "große Zahl (long)",
@ -176,6 +178,9 @@ export const UI = {
"Der Tablet Modus deaktiviert die Code anzeige und aktiviert die Möglichkeit den Programmcode über die senseBox Connect App zu übertragen. Weitere Informationen dazu findest du unter: ",
settings_ota_on: "Aktiviert",
settings_ota_off: "Deaktiviert",
settings_sounds: "Töne",
settings_sounds_text:
"Aktiviere oder Deaktiviere Töne beim hinzufügen und löschen von Blöcken. Standardmäßig deaktiviert",
/**
* 404

View File

@ -745,8 +745,8 @@ Blockly.Msg.senseBox_lux_tip = "Helligkeitssensor";
Blockly.Msg.senseBox_poti = "Potenziometer";
Blockly.Msg.senseBox_poti_tip = "Potenziometer";
Blockly.Msg.senseBox_pressure_sensor = "Luftdruck-/Temperatursensor (BMP280)";
Blockly.Msg.senseBox_pressure = "Luftdruck in Pa";
Blockly.Msg.senseBox_pressure_dimension = "Luftdruck in Pa";
Blockly.Msg.senseBox_pressure = "Luftdruck in hPa";
Blockly.Msg.senseBox_pressure_dimension = "Luftdruck in hPa";
Blockly.Msg.senseBox_pressure_tip = "Luftdrucksensor";
Blockly.Msg.senseBox_pressure_referencePressure = "Luftdruck auf NN";
Blockly.Msg.senseBox_pressure_referencePressure_dim = "hPa";

View File

@ -28,7 +28,9 @@ export const BLE = {
sensebox_phyphox_graphStyle: "style",
sensebox_phyphox_init_tooltip:
"Initialise the Bluetooth Bee. Plug it into the **XBEE1** slot. Give the Phphox meter a unique name so you can find it in the app",
"Initialise the Bluetooth Bee. Plug it into the **XBEE1** slot. Give the Phyphox meter a unique name so you can find it in the app",
sensebox_phyphox_helpurl:
"https://sensebox.de/projects/de/2021-12-21-verbindung%20mit%20der%20phyphox%20app",
sensebox_phyphox_experiment_tooltip:
"Create an experiment and give it a unique name and a short description. Add up to 5 different graphs in the view. ",
sensebox_phyphox_graph_tooltip:

View File

@ -1,51 +1,52 @@
export const LORA = {
/*
* LoRa Blöcke
*/
/*
* LoRa Blöcke
*/
senseBox_LoRa_connect: "Send to TTN",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Transmission interval in minutes",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_connect: "Send to TTN",
senseBox_LoRa_device_id: "Device EUI (lsb)",
senseBox_LoRa_app_id: "Application EUI (lsb)",
senseBox_LoRa_app_key: "App Key (msb)",
senseBox_LoRa_nwskey_id: "Network Session Key (msb)",
senseBox_LoRa_appskey_id: "App Session Key (msb)",
senseBox_LoRa_devaddr_id: "Device Adress",
senseBox_LoRa_interval: "Transmission interval in minutes",
senseBox_measurement: "Messung",
senseBox_measurements: "Messungen",
senseBox_LoRa_send_message: "Send as Lora Message",
senseBox_LoRa_send_cayenne: "Send as Cayenne Payload",
senseBox_LoRa_cayenne_temperature: "Temperature",
senseBox_LoRa_cayenne_channel: "Channel",
senseBox_LoRa_cayenne_humidity: "Humidity",
senseBox_LoRa_cayenne_pressure: "Pressure",
senseBox_LoRa_cayenne_luminosity: "Luminosity",
senseBox_LoRa_cayenne_analog: "Analog Value",
senseBox_LoRa_cayenne_x: "X Value",
senseBox_LoRa_cayenne_y: "Y Value",
senseBox_LoRa_cayenne_z: "Z Value",
senseBox_LoRa_cayenne_lat: "Latitude",
senseBox_LoRa_cayenne_lng: "Longitude",
senseBox_LoRa_cayenne_alt: "Altitude",
senseBox_LoRa_cayenne_humidity_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_tip: "Send Data as Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Send GPS Data",
senseBox_LoRa_cayenne_temperature_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_pressure_tip: "Send pressure with one decimal",
senseBox_LoRa_cayenne_luminosity_tip: "Send luminosity without any decimals",
senseBox_LoRa_cayenne_analog_tip: "Send a value with one decimal",
senseBox_LoRa_message_tooltip: "Send a message with LoRa",
senseBox_LoRa_sensor_tip: "Send a value with a specific number of bytes",
senseBox_LoRa_init_abp_tooltip: "Initialize the LoRa transmission. The activation is done via ABP. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **Network Session Key** and the **App Session Key** in **msb format** and the **Device ID** in **hex format**.",
senseBox_LoRa_init_helpurl: "https://en.docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip: "Initialize the LoRa transmission. The activation is done via OTAA. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **DEVICE EUI** and the **Application EUI** in **lsb format** the **App Key** in **msb format**.",
}
senseBox_LoRa_send_message: "Send as Lora Message",
senseBox_LoRa_send_cayenne: "Send as Cayenne Payload",
senseBox_LoRa_cayenne_temperature: "Temperature",
senseBox_LoRa_cayenne_channel: "Channel",
senseBox_LoRa_cayenne_humidity: "Humidity",
senseBox_LoRa_cayenne_pressure: "Pressure",
senseBox_LoRa_cayenne_luminosity: "Luminosity",
senseBox_LoRa_cayenne_analog: "Analog Value",
senseBox_LoRa_cayenne_x: "X Value",
senseBox_LoRa_cayenne_y: "Y Value",
senseBox_LoRa_cayenne_z: "Z Value",
senseBox_LoRa_cayenne_lat: "Latitude",
senseBox_LoRa_cayenne_lng: "Longitude",
senseBox_LoRa_cayenne_alt: "Altitude",
senseBox_LoRa_cayenne_concentration: "Concentration",
senseBox_LoRa_cayenne_humidity_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_tip: "Send Data as Cayenne Payload Format",
senseBox_LoRa_cayenne_gps_tip: "Send GPS Data",
senseBox_LoRa_cayenne_temperature_tip: "Send temperature with one decimal",
senseBox_LoRa_cayenne_pressure_tip: "Send pressure with one decimal",
senseBox_LoRa_cayenne_luminosity_tip: "Send luminosity without any decimals",
senseBox_LoRa_cayenne_analog_tip: "Send a value with one decimal",
senseBox_LoRa_message_tooltip: "Send a message with LoRa",
senseBox_LoRa_sensor_tip: "Send a value with a specific number of bytes",
senseBox_LoRa_init_abp_tooltip:
"Initialize the LoRa transmission. The activation is done via ABP. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **Network Session Key** and the **App Session Key** in **msb format** and the **Device ID** in **hex format**.",
senseBox_LoRa_init_helpurl:
"https://en.docs.sensebox.de/blockly/blockly-web-lora/",
senseBox_LoRa_init_otaa_tooltip:
"Initialize the LoRa transmission. The activation is done via OTAA. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **DEVICE EUI** and the **Application EUI** in **lsb format** the **App Key** in **msb format**.",
sensebox_lora_ttn_mapper_tip:
"You can use a TTN Mapper to map LoRa network coverage in your area. The data is then displayed on [ttnmaper](https://ttnmapper.org). You can find the necessary decoder [here](https://gist.github.com/felixerdy/f959ac03df98c6947f1c7f35d537f23e#file-decoder-js).",
};

View File

@ -1,20 +1,22 @@
export const OSEM = {
/**
* openSenseMap
*/
senseBox_osem_connection_tip: "connect to the openSenseMap",
senseBox_send_to_osem_tip: "sends the measurement to openSenseMap. Make shure to enter the correct BoxID and SensorID",
senseBox_send_to_osem: "Send measurement to openSenseMap",
senseBox_osem_connection: "Connect to openSenseMap",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Type",
senseBox_osem_stationary: "Stationary",
senseBox_osem_mobile: "Mobile",
senseBox_osem_access_token: "API Key",
senseBox_send_mobile_to_osem: "Send measurement and location to openSenseMap",
senseBox_send_mobile_to_osem_tip: "Send Value and Location to openSenseMap",
}
/**
* openSenseMap
*/
senseBox_osem_connection_tip:
"Use this block to connect your senseBox to the openSenseMap. Register your senseBox on the openSenseMap and enter the IDs and the API key. Then use the block ***Send reading to the openSenseMap*** and the sensor ID to transfer the readings.",
senseBox_osem_connection_helpurl: "https://www.opensensemap.org/",
senseBox_send_to_osem_tip:
"Send measured values to the openSenseMap with this block. Use one block per measurement value and enter the assigned sensor ID",
senseBox_send_to_osem: "Send measurement to openSenseMap",
senseBox_osem_connection: "Connect to openSenseMap",
senseBox_osem_host: "opensensemap.org",
senseBox_osem_host_workshop: "workshop.opensensemap.org",
senseBox_osem_exposure: "Type",
senseBox_osem_stationary: "Stationary",
senseBox_osem_mobile: "Mobile",
senseBox_osem_access_token: "API Key",
senseBox_send_mobile_to_osem: "Send measurement and location to openSenseMap",
senseBox_send_mobile_to_osem_tip: "Send Value and Location to openSenseMap",
senseBox_osem_restart: "Restart device if disconnected?",
};

View File

@ -1,134 +1,149 @@
export const SENSORS = {
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* Sensors
* ---------------------------------------------------
*
*/
/**
* BMP280
*/
senseBox_pressure_sensor: "Airpressure/Temperature Sensor (BMP280)",
senseBox_pressure: "Airpressure in hPa",
senseBox_pressure_dimension: "Airpressure in hPa",
senseBox_pressure_tooltip:
"Connect the sensor to one of the 5 **I2C ports**. The sensor gives you the measured value for the air pressure in hPa. To calculate the correct altitude above sea level the sensor needs a current reference value.",
senseBox_pressure_referencePressure: "Pressure at Sea Level",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl: "",
/**
* BMP280
*/
senseBox_pressure_sensor: "Airpressure/Temperature Sensor (BMP280)",
senseBox_pressure: "Airpressure in Pa",
senseBox_pressure_dimension: "Airpressure in Pa",
senseBox_pressure_tip: "Connect the sensor to one of the 5 **I2C ports**. The sensor gives you the measured value for the air pressure in Pa. To calculate the correct altitude above sea level the sensor needs a current reference value.",
senseBox_pressure_referencePressure: "Pressure at Sea Level",
senseBox_pressure_referencePressure_dim: "hPa",
senseBox_pressure_helpurl: "",
/**
* DPS310
*/
senseBox_sensor_dps310: "Airpressure/Temperature Sensor (DPS310)",
senseBox_sensor_dps310_tooltip:
"Connect the sensor to one of the 5 **I2C ports**. The sensor gives you the measured value for the air pressure in hPa. To calculate the correct altitude above sea level the sensor needs a current reference value.",
/**
* Mikro
*/
senseBox_sound: "Microphone",
senseBox_sound_tip:
"Connect the sensor to one of the 3 **analog/digital** ports via the breadbord. Returns the reading of the microphone in volt",
senseBox_sound_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Mikro
*/
senseBox_sound: "Microphone",
senseBox_sound_tip: "Connect the sensor to one of the 3 **analog/digital** ports via the breadbord. Returns the reading of the microphone in volt",
senseBox_sound_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-mikro/",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperature in °C",
senseBox_temp_hum: "Temperature/Humidity Sensor (HDC1080)",
senseBox_temp_hum_tooltip:
"This block returns the temperature and humidity sensor readings. Connect the sensor to one of the 5 I2C ports. Measured value is output with 2 decimal places.",
senseBox_temp_hum_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
senseBox_hum: "humidity in %",
senseBox_hum_tip: "Measures humidity in %",
/**
* Temperature and Humidity Sensor (HDC1080)
*/
senseBox_temp: "Temperature in °C",
senseBox_temp_hum: "Temperature/Humidity Sensor (HDC1080)",
senseBox_temp_hum_tooltip: "This block returns the temperature and humidity sensor readings. Connect the sensor to one of the 5 I2C ports. Measured value is output with 2 decimal places.",
senseBox_temp_hum_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-temperatur-luftfeuchte/",
senseBox_hum: "humidity in %",
senseBox_hum_tip: "Measures humidity in %",
/**
* Ultraschalldistanzsensor
*/
/**
* Ultraschalldistanzsensor
*/
senseBox_ultrasonic: "Ultrasonic distance sensor at Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Measures the distance using ultrasound in cm. Connect the sensor to one of the three digital/analog ports:
senseBox_ultrasonic: "Ultrasonic distance sensor at Port",
senseBox_ultrasonic_trigger: "Trigger",
senseBox_ultrasonic_echo: "Echo",
senseBox_ultrasonic_maxDistance: "Max distance",
senseBox_ultrasonic_port_A: "A",
senseBox_ultrasonic_port_B: "B",
senseBox_ultrasonic_port_C: "C",
senseBox_ultrasonic_tooltip: `Measures the distance using ultrasound in cm. Connect the sensor to one of the three digital/analog ports:
- Trigger: Green Cable
- Echo: Yellow Cable`,
senseBox_ultrasonic_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-distanz/",
- Echo: Yellow Cable
If the max distance is reached the a value of **O** will be returned`,
senseBox_ultrasonic_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-distanz/",
/**
* UV and Lightsensor
*/
senseBox_uv: "UV-Light in µW/cm²",
senseBox_uv_light: "Light Visible + UV",
senseBox_value: "Value:",
senseBox_uv_light_tooltip: "Sensor measures UV light or brightness. Brightness is output as **integer** in lux. UV intensity as **decimal** in µW/cm².",
senseBox_light: "Illuminance in Lux",
senseBox_uv_light_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
/**
* UV and Lightsensor
*/
senseBox_uv: "UV-Light in µW/cm²",
senseBox_uv_light: "Light Visible + UV",
senseBox_value: "Value:",
senseBox_uv_light_tooltip:
"Sensor measures UV light or brightness. Brightness is output as **integer** in lux. UV intensity as **decimal** in µW/cm².",
senseBox_light: "Illuminance in Lux",
senseBox_uv_light_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-helligkeit-uv/",
/**
* BMX055
*/
/**
* BMX055
*/
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Accelerometer",
senseBox_bmx055_accelerometer_range: "Range",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Direction",
senseBox_bmx055_accelerometer_direction_x: "X-Axis",
senseBox_bmx055_accelerometer_direction_y: "Y-Axis",
senseBox_bmx055_accelerometer_direction_z: "Z-Axis",
senseBox_bmx055_accelerometer_direction_total: "Total",
senseBox_bmx055_gyroscope: "Gyroscope",
senseBox_bmx055_compass: "Lage Sensor",
senseBox_bmx055_accelerometer: "Accelerometer",
senseBox_bmx055_accelerometer_range: "Range",
senseBox_bmx055_accelerometer_range_2g: "2g",
senseBox_bmx055_accelerometer_range_4g: "4g",
senseBox_bmx055_accelerometer_range_8g: "8g",
senseBox_bmx055_accelerometer_range_16g: "16g",
senseBox_bmx055_accelerometer_direction: "Direction",
senseBox_bmx055_accelerometer_direction_x: "X-Axis",
senseBox_bmx055_accelerometer_direction_y: "Y-Axis",
senseBox_bmx055_accelerometer_direction_z: "Z-Axis",
senseBox_bmx055_accelerometer_direction_total: "Total",
senseBox_bmx055_gyroscope: "Gyroscope",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Direction",
senseBox_bmx055_y: "Y-Direction",
senseBox_bmx055_accelerometer_tooltip: `This block gives you the measurement value of the accelerometer which is soldered directly on the senseBox MCU. In the dropdown menu you can select the direction and the measuring range.`,
senseBox_bmx055_helpurl: "",
senseBox_bmx055_compass_tip: "Lage Sensor",
senseBox_bmx055_gyroscope_tip: "Lage Sensor",
senseBox_bmx055_x: "X-Direction",
senseBox_bmx055_y: "Y-Direction",
senseBox_bmx055_accelerometer_tooltip: `This block gives you the measurement value of the accelerometer which is soldered directly on the senseBox MCU. In the dropdown menu you can select the direction and the measuring range.`,
senseBox_bmx055_helpurl: "",
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "latitude",
senseBox_gps_lng: "longitude",
senseBox_gps_alt: "altitude in m",
senseBox_gps_speed: "speed in km/h",
senseBox_gps_date: "date",
senseBox_gps_time: "time",
senseBox_gps_timeStamp: "Timestamp (RFC 3339)",
senseBox_gps_tooltip: `Reads the GPS module and gives you the location information. Longitude and latitude are output as a decimal number with 6 decimal places.
/**
*
* GPS
*/
senseBox_gps_getValues: "GPS Modul",
senseBox_gps_lat: "latitude",
senseBox_gps_lng: "longitude",
senseBox_gps_alt: "altitude in m",
senseBox_gps_speed: "speed in km/h",
senseBox_gps_date: "date",
senseBox_gps_time: "time",
senseBox_gps_timeStamp: "Timestamp (RFC 3339)",
senseBox_gps_tooltip: `Reads the GPS module and gives you the location information. Longitude and latitude are output as a decimal number with 6 decimal places.
**Connection: I2C**
**Note:** The GPS module needs a relatively long time (about 5-10 minutes) until it has found your location!
`,
senseBox_gps_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-gps/",
senseBox_gps_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-gps/",
/**
* Windspeed
*/
senseBox_windspeed: "Windspeedsensor",
senseBox_windspeed_tooltip: "",
/**
* Windspeed
*/
senseBox_windspeed: "Windspeedsensor",
senseBox_windspeed_tooltip: "",
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip: "Connect the sensor to one of the 3 **digital/analog ports**. The sensor will give you the reading in dB with one decimal.",
senseBox_soundsensor_dfrobot_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-lautstaerke/",
/*
* Soundsensor
*/
senseBox_soundsensor_dfrobot: "Soundsensor (DF Robot)",
senseBox_soundsensor_dfrobot_tooltip:
"Connect the sensor to one of the 3 **digital/analog ports**. The sensor will give you the reading in dB with one decimal.",
senseBox_soundsensor_dfrobot_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-lautstaerke/",
/*
* BME680
*/
/*
* BME680
*/
senseBox_bme680: "Environmental sensor (BME680)",
senseBox_bme_iaq: "Indoor Air Quality (IAQ)",
senseBox_bme_iaq_accuracy: "Calibration Value",
senseBox_bme_co2: "CO2 Equivalent",
senseBox_bme_breatheVocEquivalent: "Breathe VOC Equivalent",
senseBox_bme_tooltip: `Connect the environmental sensor to one of the 5 **I2C ports**. **Note:** The sensor needs some time to calibrate.
senseBox_bme680: "Environmental sensor (BME680)",
senseBox_bme_iaq: "Indoor Air Quality (IAQ)",
senseBox_bme_iaq_accuracy: "Calibration Value",
senseBox_bme_co2: "CO2 Equivalent",
senseBox_bme_breatheVocEquivalent: "Breathe VOC Equivalent",
senseBox_bme_tooltip: `Connect the environmental sensor to one of the 5 **I2C ports**. **Note:** The sensor needs some time to calibrate.
The status of the calibration can be read from the calibration value. It is either 0, 1, 2 or 3 and says the following:
- IAQ Accuracy : 0 means sensor is stabilized (takes about 25 minutes) or that there was a timeout,
@ -137,53 +152,57 @@ The status of the calibration can be read from the calibration value. It is eith
- IAQ Accuracy : 3 means sensor calibrated successfully.
The measured values for temperature, humidity and air pressure can be used directly,`,
senseBox_bme680_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-umweltsensor/",
senseBox_bme680_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-umweltsensor/",
/**
* Truebner SMT50
*/
senseBox_smt50: "Soil Moisture and Temperature (SMT50)",
senseBox_smt50_helpurl:
"https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip:
"Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* Truebner SMT50
*/
senseBox_smt50: "Soil Moisture and Temperature (SMT50)",
senseBox_smt50_helpurl: "https://docs.sensebox.de/hardware/sensoren-truebner/",
senseBox_smt50_tooltip: "Schließe den Bodenfeuchtigkeit- und Temperatursensor an einen der 3 digital/analog Ports an und wähle den Port im Block aus. Der Sensor gibt die Bodentemperatur in °C und die Bodenfeuchtigkeit in % aus.",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip:
"Connect the sensor to one of the 5 **I2C ports**. The sensor will give you the reading for the CO2 concentration in ppm. The temperature reading may differ from the real value by a few degrees due to the measurement directly at the sensor.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-co2/",
/**
* Feinstaubsensor (SDS011)
*/
senseBox_sds011: "Fine Particular Sensor",
senseBox_sds011_dimension: "in µg/m³ at",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip:
"This block gives you the reading of the fine dust sensor. Connect the fine dust sensor to one of the 2 **Serial/UART** ports. Select between PM2.5 and PM10 in the dropdown menu. The measured value will be displayed as **comma number** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-feinstaub/",
/**
* SCD30 CO2 Sensor
*/
senseBox_scd30: "CO2 Sensor (Sensirion SCD30)",
senseBox_scd_tooltip: "Connect the sensor to one of the 5 **I2C ports**. The sensor will give you the reading for the CO2 concentration in ppm. The temperature reading may differ from the real value by a few degrees due to the measurement directly at the sensor.",
senseBox_scd_co2: "CO2 in ppm",
senseBox_scd_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-co2/",
/**
* Feinstaubsensor (SDS011)
*/
senseBox_sds011: "Fine Particular Sensor",
senseBox_sds011_dimension: "in µg/m³ at",
senseBox_sds011_pm25: "PM2.5",
senseBox_sds011_pm10: "PM10",
senseBox_sds011_tooltip: "This block gives you the reading of the fine dust sensor. Connect the fine dust sensor to one of the 2 **Serial/UART** ports. Select between PM2.5 and PM10 in the dropdown menu. The measured value will be displayed as **comma number** in µg/m3",
senseBox_sds011_serial1: "Serial1",
senseBox_sds011_serial2: "Serial2",
senseBox_sds011_helpurl: "https://en.docs.sensebox.de/hardware/sensoren-feinstaub/",
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "is Pressed",
senseBox_button_switch: "as Switch",
senseBox_button_wasPressed: "was Pressed",
senseBox_button_tooltip: `This block gives you the status of the connected button. In the dropdown menu you can select different modes for the button. Either the on board button or a button connected to one of the 6 digital pins can be controlled. different modes:
/**
* Button
*/
senseBox_button: "Button",
senseBox_button_isPressed: "is Pressed",
senseBox_button_switch: "as Switch",
senseBox_button_wasPressed: "was Pressed",
senseBox_button_longPress: "Pressed for",
senseBox_button_tooltip: `This block gives you the status of the connected button. In the dropdown menu you can select different modes for the button. Either the on board button or a button connected to one of the 6 digital pins can be controlled. different modes:
- "is pressed": With this mode you can check if the block is currently pressed. You get either the value TRUE or FALSE.
- "was pressed": With this mode you can query if the block was pressed. Only if the button was pressed and released you will get TRUE.
- "as switch": If you use this block you can use the button like a light switch. The status is saved until the button is pressed again.
`,
senseBox_button_helpurl: "",
senseBox_button_helpurl: "",
/**
*
*/
senseBox_watertemperature: "Water Temperature",
}
/**
*
*/
senseBox_watertemperature: "Water Temperature",
};

View File

@ -1,11 +1,30 @@
export const WEB = {
/**
* WiFi
*/
senseBox_wifi_connect: "Connect to Wifi",
senseBox_wifi_ssid: "Networkname",
senseBox_wifi_tooltip: "Connects to a wireless network. If you want to connect to an unsecured network (e.g. Freifunk) clear the password field. The WiFi-Bee must be plugged into the **XBEE1** slot.",
senseBox_wifi_startap: "Initialize Wifi Access Point",
senseBox_wifi_startap_tooltip: "Creates a WiFi access point to which you can connect. Note that only 1 device can be connected at a time.",
senseBox_wifi_helpurl: "https://en.docs.sensebox.de/blockly/blockly-web-wifi/",
}
/**
* WiFi
*/
senseBox_wifi_connect: "Connect to Wifi",
senseBox_wifi_ssid: "Networkname",
senseBox_wifi_ip: "IP-Address",
senseBox_wifi_ip_tooltip: "The IP-Address of the SenseBox",
senseBox_wifi_status: "Status",
senseBox_wifi_status_tooltip: "The status of the Wifi connection",
senseBox_wifi_rssi: "RSSI",
senseBox_wifi_rssi_tooltip: "The signal strength of the Wifi connection",
senseBox_wifi_tooltip:
"Connects to a wireless network. If you want to connect to an unsecured network (e.g. Freifunk) clear the password field. The WiFi-Bee must be plugged into the **XBEE1** slot.",
senseBox_wifi_startap: "Initialize Wifi Access Point",
senseBox_wifi_startap_tooltip:
"Creates a WiFi access point to which you can connect. Note that only 1 device can be connected at a time.",
senseBox_wifi_helpurl:
"https://en.docs.sensebox.de/blockly/blockly-web-wifi/",
senseBox_ethernet: "Connect to Ethernet",
senseBox_ethernet_dhcp: "DHCP",
senseBox_ethernet_manuel_config: "Manual configuration",
senseBox_ethernet_ip: "IP address",
senseBox_ethernet_gateway: "Gateway",
senseBox_ethernet_subnetmask: "Subnet mask",
senseBox_ethernet_mac: "MAC address",
senseBox_ethernet_dns: "DNS-Server",
senseBox_ethernet_tooltip:
"Connect the LAN-Bee to the XBEE1 slot. Most networks use DHCP and assign an IP address automatically. If you want to do a manual configuration select **Manual Configuration** in the dropdown menu and enter the appropriate data.",
};

View File

@ -1,17 +1,19 @@
export const TIME = {
senseBox_interval: "ms",
senseBox_interval_timer: "Measuring interval",
senseBox_interval_timer_tip: "Setup an Intervall",
ARD_TIME_DELAY: "wait",
ARD_TIME_DELAY_MICROS: "microseconds",
ARD_TIME_DELAY_MICRO_TIP: "Wait specific time in microseconds",
ARD_TIME_DELAY_TIP: "Wait specific time in milliseconds",
ARD_TIME_INF: "wait forever (end program)",
ARD_TIME_INF_TIP: "Wait indefinitely, stopping the program.",
ARD_TIME_MICROS: "current elapsed Time (microseconds)",
ARD_TIME_MICROS_TIP: "Returns the number of microseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MILLIS: "current elapsed Time (milliseconds)",
ARD_TIME_MILLIS_TIP: "Returns the number of milliseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MS: "milliseconds",
}
senseBox_interval: "ms",
senseBox_interval_timer: "Interval: ",
senseBox_interval_timer_tip:
"Define an interval to be executed every x milliseconds",
ARD_TIME_DELAY: "wait",
ARD_TIME_DELAY_MICROS: "microseconds",
ARD_TIME_DELAY_MICRO_TIP: "Wait specific time in microseconds",
ARD_TIME_DELAY_TIP: "Wait specific time in milliseconds",
ARD_TIME_INF: "wait forever (end program)",
ARD_TIME_INF_TIP: "Wait indefinitely, stopping the program.",
ARD_TIME_MICROS: "current elapsed Time (microseconds)",
ARD_TIME_MICROS_TIP:
"Returns the number of microseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MILLIS: "current elapsed Time (milliseconds)",
ARD_TIME_MILLIS_TIP:
"Returns the number of milliseconds since the Arduino board began running the current program. Has to be stored in a positive long integer",
ARD_TIME_MS: "milliseconds",
};

View File

@ -10,6 +10,8 @@ export const UI = {
toolbox_time: "Time",
toolbox_functions: "Functions",
toolbox_variables: "Variables",
toolbox_serial: "Serial",
toolbox_advanced: "Erweitert",
variable_NUMBER: "Number (int)",
variable_SHORT_NUMBER: "char",
variable_LONG: " Zahl (long)",
@ -166,11 +168,14 @@ export const UI = {
"The display of statistics on the usage of the blocks above the workspace can be shown or hidden.",
settings_statistics_on: "On",
settings_statistics_off: "Off",
settings_ota_head: "tablet mode",
settings_ota_head: "Tablet mode",
settings_ota_text:
"Tablet mode disables the code display and enables the possibility to transfer the program code via the senseBox Connect app. You can find more information on: ",
settings_ota_on: "Activated",
settings_ota_off: "Deactivated",
settings_sounds: "Sound",
settings_sounds_text:
"Enable or disable sounds when adding and deleting blocks. Disabled by default",
/**
* 404

View File

@ -887,13 +887,13 @@ Blockly.Msg.senseBox_output_timestamp = "timestamp";
Blockly.Msg.senseBox_piezo_tip = "simple piezo to make sound";
Blockly.Msg.senseBox_poti = "Potentiometer";
Blockly.Msg.senseBox_poti_tip = "Potentiometer";
Blockly.Msg.senseBox_pressure = "Airpressure in Pa";
Blockly.Msg.senseBox_pressure = "Airpressure in hPa";
Blockly.Msg.senseBox_pressure_referencePressure = "Pressure at Sea Level";
Blockly.Msg.senseBox_pressure_referencePressure_dim = "hPa";
Blockly.Msg.senseBox_pressure_sensor =
"Airpressure/Temperature Sensor (BMP280)";
Blockly.Msg.senseBox_pressure_tip =
"airpressure sensor can measure the airpressure in Pa";
"airpressure sensor can measure the airpressure in hPa";
Blockly.Msg.senseBox_rgb_led = "RGB-LED";
Blockly.Msg.senseBox_rgb_led_tip = "RGB-LED";
Blockly.Msg.senseBox_sd_create_file = "Create file on SD-Card";

View File

@ -65,6 +65,7 @@ class Toolbox extends React.Component {
<Block type="sensebox_sensor_bmx055_accelerometer" />
<Block type="sensebox_sensor_sds011" />
<Block type="sensebox_sensor_pressure" />
<Block type="sensebox_sensor_dps310" />
<Block type="sensebox_sensor_bme680_bsec" />
<Block type="sensebox_scd30" />
<Block type="sensebox_gps" />
@ -92,8 +93,15 @@ class Toolbox extends React.Component {
</Category>
<Category name="WIFI" colour={getColour().sensebox}>
<Block type="sensebox_wifi" />
<Block type="sensebox_wifi_status" />
<Block type="sensebox_wifi_rssi" />
<Block type="sensebox_get_ip" />
<Block type="sensebox_startap" />
</Category>
<Category name="Ethernet" colour={getColour().sensebox}>
<Block type="sensebox_ethernet" />
<Block type="sensebox_ethernetIp" />
</Category>
<Category name="SD" colour={getColour().sensebox}>
<Block type="sensebox_sd_create_file" />
<Block type="sensebox_sd_open_file">
@ -290,12 +298,12 @@ class Toolbox extends React.Component {
</Value>
</Block>
</Category>
<Category name="Telegram" colour={getColour().sensebox}>
{/* <Category name="Telegram" colour={getColour().sensebox}>
<Block type="sensebox_telegram" />
<Block type="sensebox_telegram_do" />
<Block type="sensebox_telegram_do_on_message" />
<Block type="sensebox_telegram_send" />
</Category>
</Category> */}
<Category name="openSenseMap" colour={getColour().sensebox}>
<Block type="sensebox_interval_timer">
<Value name="DO">
@ -368,6 +376,7 @@ class Toolbox extends React.Component {
<Block type="sensebox_lora_cayenne_humidity" />
<Block type="sensebox_lora_cayenne_pressure" />
<Block type="sensebox_lora_cayenne_luminosity" />
<Block type="sensebox_lora_cayenne_concentration" />
<Block type="sensebox_lora_cayenne_sensor" />
<Block type="sensebox_lora_cayenne_accelerometer" />
<Block type="sensebox_lora_cayenne_gps" />
@ -594,39 +603,52 @@ class Toolbox extends React.Component {
colour={getColour().variables}
custom="CREATE_TYPED_VARIABLE"
></Category>
<Category name="Arrays" colour={getColour().arrays}>
{/* <Category name="Arrays" colour={getColour().arrays}>
<Block type="lists_create_empty" />
<Block type="array_getIndex" />
<Block type="lists_length" />
</Category>
</Category> */}
<Category
name={Blockly.Msg.toolbox_functions}
colour={getColour().procedures}
custom="PROCEDURE"
></Category>
<sep></sep>
<Category name={Blockly.Msg.toolbox_io} colour={getColour().io}>
<Block type="io_digitalwrite"></Block>
<Block type="io_digitalread"></Block>
<Block type="io_builtin_led"></Block>
<Block type="io_analogwrite"></Block>
<Block type="io_analogread"></Block>
<Block type="io_highlow"></Block>
<Block type="io_pulsein">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
</Block>
<Block type="io_pulsetimeout">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
<Value name="TIMEOUT">
<Shadow type="math_number">
<Field name="NUM">100</Field>
</Shadow>
</Value>
</Block>
<Category name={Blockly.Msg.toolbox_advanced} colour={getColour().io}>
<Category
name={Blockly.Msg.toolbox_serial}
colour={getColour().serial}
>
<Block type="init_serial_monitor"></Block>
<Block type="print_serial_monitor"></Block>
</Category>
<Category name={Blockly.Msg.toolbox_io} colour={getColour().io}>
<Block type="io_digitalwrite"></Block>
<Block type="io_digitalread"></Block>
<Block type="io_builtin_led"></Block>
<Block type="io_analogwrite"></Block>
<Block type="io_analogread"></Block>
<Block type="io_highlow"></Block>
<Block type="io_pulsein">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
</Block>
<Block type="io_pulsetimeout">
<Value name="PULSETYPE">
<Shadow type="io_highlow"></Shadow>
</Value>
<Value name="TIMEOUT">
<Shadow type="math_number">
<Field name="NUM">100</Field>
</Shadow>
</Value>
</Block>
</Category>
<Category name="Watchdog" colour={getColour().io}>
<Block type="watchdog_enable"></Block>
<Block type="watchdog_reset"></Block>
</Category>
</Category>
{/* this block is the initial block of the workspace; not necessary
to display, because it can only be used once anyway

View File

@ -11,6 +11,7 @@ import LanguageSelector from "./LanguageSelector";
import RenderSelector from "./RenderSelector";
import StatsSelector from "./StatsSelector";
import OtaSelector from "./OtaSelector";
import SoundsSelector from "./SoundsSelector";
import Button from "@material-ui/core/Button";
import Paper from "@material-ui/core/Paper";
@ -48,6 +49,9 @@ class Settings extends Component {
<Paper style={{ margin: "10px 0px", padding: "10px" }}>
<OtaSelector />
</Paper>
<Paper style={{ margin: "10px 0px", padding: "10px" }}>
<SoundsSelector />
</Paper>
<Button
style={{ marginTop: "10px" }}

View File

@ -0,0 +1,63 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { setSounds } from "../../actions/generalActions";
import * as Blockly from "blockly/core";
import InputLabel from "@material-ui/core/InputLabel";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select";
import Typography from "@material-ui/core/Typography";
import FormHelperText from "@material-ui/core/FormHelperText";
class SoundsSelector extends Component {
componentDidMount() {
// Ensure that Blockly.setLocale is adopted in the component.
// Otherwise, the text will not be displayed until the next update of the component.
this.forceUpdate();
}
render() {
return (
<div>
<Typography style={{ fontWeight: "bold" }}>
{Blockly.Msg.settings_sounds}
</Typography>
<FormHelperText
style={{ color: "black", lineHeight: 1.3, marginBottom: "8px" }}
>
{Blockly.Msg.settings_sounds_text}
</FormHelperText>
<FormControl>
<InputLabel id="demo-simple-select-label">
{Blockly.Msg.settings_sounds}
</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={this.props.sounds}
onChange={(e) => this.props.setSounds(e.target.value)}
>
<MenuItem value={false}>{Blockly.Msg.settings_ota_off}</MenuItem>
<MenuItem value={true}>{Blockly.Msg.settings_ota_on}</MenuItem>
</Select>
</FormControl>
</div>
);
}
}
SoundsSelector.propTypes = {
setSounds: PropTypes.func.isRequired,
language: PropTypes.string.isRequired,
sounds: PropTypes.string.isRequired,
};
const mapStateToProps = (state) => ({
sounds: state.general.sounds,
language: state.general.language,
});
export default connect(mapStateToProps, { setSounds })(SoundsSelector);

View File

@ -2,6 +2,7 @@ import {
VISIT,
LANGUAGE,
RENDERER,
SOUNDS,
STATISTICS,
PLATFORM,
} from "../actions/types";
@ -20,6 +21,14 @@ const initialPlatform = () => {
return getPlatform();
};
const initialSounds = () => {
if (window.localStorage.getItem("sounds")) {
return window.localStorage.getItem("sounds");
} else {
return "off";
}
};
const getPlatform = () => {
if (window.localStorage.getItem("platform")) {
return JSON.parse(window.localStorage.getItem("platform"));
@ -62,6 +71,7 @@ const initialState = {
pageVisits: 0, // detect if previous URL was
language: initialLanguage(),
renderer: initialRenderer(),
sounds: initialSounds(),
statistics: initialStatistics(),
platform: initialPlatform(),
};
@ -90,6 +100,12 @@ export default function foo(state = initialState, action) {
...state,
renderer: action.payload,
};
case SOUNDS:
window.localStorage.setItem("sounds", action.payload);
return {
...state,
sounds: action.payload,
};
case STATISTICS:
window.localStorage.setItem("statistics", action.payload);
return {