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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
._*
Thumbs.db
Desktop.ini
.env
.vscode

# Project files
ino_project
.env
launch.json

# Closure library needed for uncompressed development
/closure-library
Expand Down
58 changes: 11 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,83 +19,45 @@ The core was started as a fork from [BlocklyDuino](https://github.com/makewithar

### Demo

This is a web tool. You can give it a try at https://code.barnabasrobotics.com.
This is a web tool for teaching [Barnabas Robotics Curriculum](https://lessons.barnabasrobotics.com). You can give it a try at https://code.barnabasrobotics.com.

If you want to install it locally:

git clone https://github.com/BarnabasRobotics/Online-BlocklyDuinoEditor.git

You can then use a local server in your IDE or an extension with your browser and going to a url like localhost/public/blockly/demos/blocklyduino/index.html for use.

### Run locally on your web browser

1. Open browser to BlocklyDuino, Drag and Drop blocks to make arduino program.
2. Select 'Arduino' tab to copy source code to Arduino IDE
### Creating New Blocks
1. While old chromeduino blocks still exist in blocks a new directory blocks/custom has been added.
you can create new files and add them to the index file or simply append them to the arduino.js file.
1. For code generation you can also append that to arduino.js in blocks/custom but it is recommended to add your new generator in the generators/arduino directory and insert that to your index file.

Uploading the code to an arduino is currently a work in progress with eyes on [WebUSB](https://wicg.github.io/webusb/) or [WebSerial](https://github.com/WICG/serial)


### Integrated Arduino upload

To avoid the tedious step of manually pasting code to the Arduino IDE, you can run a mini webserver that uses
the [Arduino IDE](https://www.arduino.cc/en/Main/Software) to upload the code to a connected Arduino board on Windows, Mac OS X and Linux systems.
Invoke this command from the BlocklyDuino root folder:

```
python arduino_web_server.py
```

You can optionally specify the port with `--port=COM3` (or `--port=/dev/tty.foo` on Linux and Mac); if you don't, it will try and guess which port to use.

When the webserver is running, you can access BlocklyDuino itself on [http://127.0.0.1:8080/](http://127.0.0.1:8080/).

### Usage

1. Open browser to BlocklyDuino, drag and drop blocks to make an Arduino program
2. Select the 'Arduino' tab and copy all of the source code into an existing or new project in the Arduino IDE
3. Press the 'Upload' button in the Arduino IDE to burn the code into a connected Arduino board

OR (if running `ino_web_server.py`):

1. Open browser to BlocklyDuino, drag and drop blocks to make an Arduino program.
2. Select the 'Arduino' tab and press the 'Upload' button. (press the 'Reset' button to upload an empty program)

### ChangeLog

Check changelog [here](https://github.com/BlocklyDuino/BlocklyDuino/blob/master/CHANGELOG.txt)
With special thanks to @noopkat https://github.com/noopkat/avrgirl-arduino we can now flash to our Barnabas Noggin

### Authors and Contributors
Fred Lin @gasolin is the creator of BlocklyDuino.

Suz Hinton @noopkat for avrgirl.

BlocklyDuino is a **web-based visual programming editor for [Arduino](http://www.arduino.cc/)**.

BlocklyDuino is based on [Blockly](https://developers.google.com/blockly/), the web-based, graphical programming editor. Provide static type language blocks and code generators for Arduino programming.

Thanks Neil Fraser, Q.Neutron from [Blockly](https://developers.google.com/blockly/)

The project is also inspired by [ardublock](https://github.com/taweili/ardublock) and [modkit](http://www.modk.it/)
Thanks Dale Low (gumbypp) for contribute the python server to pipe BlocklyDuino source to arduino board.

Thanks Arduino and Seeeduino guys for Arduino and [Grove](http://www.seeedstudio.com/wiki/GROVE_System) blocks.

[makewitharduino](https://github.com/makewitharduino/Online-BlocklyDuinoEditor) is work by @okhiroyuki

There has been some interesting [chatter on Chromeduino](https://github.com/spaceneedle/Chromeduino/issues/12) perhaps some of these projects find a way to merge together.

### License

Copyright (C) 2012~2015 Fred Lin gasolin+blockly@gmail.com
Copyright (C) 2020

* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0


# Blockly [![Build Status]( https://travis-ci.org/google/blockly.svg?branch=master)](https://travis-ci.org/google/blockly)


Google's Blockly is a web-based, visual programming editor. Users can drag
blocks together to build programs. All code is free and open source.

Expand All @@ -110,3 +72,5 @@ Blockly](https://developers.google.com/blockly/registration). The questionnaire
a few minutes and will help us better support the Blockly community.

Want to contribute? Great! First, read [our guidelines for contributors](https://developers.google.com/blockly/guides/modify/contributing).


Binary file added android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 46 additions & 46 deletions blocks/aerobot.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//http://www.seeedstudio.com/wiki/GROVE_System
//http://www.seeedstudio.com/depot/index.php?main_page=advanced_search_result&search_in_description=1&keyword=grovefamily
//support starter bundle example http://www.seeedstudio.com/wiki/GROVE_-_Starter_Kit_V1.1b
// http://www.seeedstudio.com/wiki/GROVE_System
// http://www.seeedstudio.com/depot/index.php?main_page=advanced_search_result&search_in_description=1&keyword=grovefamily
// support starter bundle example http://www.seeedstudio.com/wiki/GROVE_-_Starter_Kit_V1.1b

/**
* @license
Expand Down Expand Up @@ -33,7 +33,7 @@ goog.require('Blockly.Blocks');

Blockly.Blocks.aerobot.HUE = 200;

Blockly.Blocks.aerobot.image = filepath.media + '/aerobot.jpg';
Blockly.Blocks.aerobot.image = '/media/aerobot.jpg';

Blockly.Blocks.aerobot.checkBlocks = function(obj) {
var legal = false;
Expand All @@ -60,15 +60,15 @@ Blockly.Blocks['aerobot_move'] = {
this.setHelpUrl(Blockly.Msg.AEROBOT_HELPURL);
this.setColour(Blockly.Blocks.aerobot.HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_MOVE_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_FORWARD, "forward"],
[Blockly.Msg.AEROBOT_BACKWARD, "backward"],
[Blockly.Msg.AEROBOT_STOP, "stop"],
[Blockly.Msg.AEROBOT_TURN_LEFT, "cw"],
[Blockly.Msg.AEROBOT_TURN_RIGHT, "ccw"]
]), "DIRECTION");
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_MOVE_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_FORWARD, "forward"],
[Blockly.Msg.AEROBOT_BACKWARD, "backward"],
[Blockly.Msg.AEROBOT_STOP, "stop"],
[Blockly.Msg.AEROBOT_TURN_LEFT, "cw"],
[Blockly.Msg.AEROBOT_TURN_RIGHT, "ccw"]
]), "DIRECTION");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.AEROBOT_MOVE_TOOLTIP);
Expand All @@ -91,12 +91,12 @@ Blockly.Blocks['aerobot_rotate'] = {
this.setHelpUrl(Blockly.Msg.AEROBOT_HELPURL);
this.setColour(Blockly.Blocks.aerobot.HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_ROTATE_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_ROTATE_LEFT, "cw"],
[Blockly.Msg.AEROBOT_ROTATE_RIGHT, "ccw"]
]), "DIRECTION");
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_ROTATE_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_ROTATE_LEFT, "cw"],
[Blockly.Msg.AEROBOT_ROTATE_RIGHT, "ccw"]
]), "DIRECTION");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.AEROBOT_ROTATE_TOOLTIP);
Expand All @@ -119,13 +119,13 @@ Blockly.Blocks['aerobot_lightsens'] = {
this.setHelpUrl(Blockly.Msg.AEROBOT_HELPURL);
this.setColour(Blockly.Blocks.aerobot.HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_LIGHTSENS_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_CENTER, "CENTER"],
[Blockly.Msg.AEROBOT_RIGHT, "RIGHT"],
[Blockly.Msg.AEROBOT_LEFT, "LEFT"]
]), "SENS");
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_LIGHTSENS_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_CENTER, "CENTER"],
[Blockly.Msg.AEROBOT_RIGHT, "RIGHT"],
[Blockly.Msg.AEROBOT_LEFT, "LEFT"]
]), "SENS");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.AEROBOT_LIGHTSENS_TOOLTIP);
Expand All @@ -148,13 +148,13 @@ Blockly.Blocks['aerobot_distsens'] = {
this.setHelpUrl(Blockly.Msg.AEROBOT_HELPURL);
this.setColour(Blockly.Blocks.aerobot.HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_DISTSENS_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_CENTER, "CENTER"],
[Blockly.Msg.AEROBOT_RIGHT, "RIGHT"],
[Blockly.Msg.AEROBOT_LEFT, "LEFT"]
]), "SENS");
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_DISTSENS_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_CENTER, "CENTER"],
[Blockly.Msg.AEROBOT_RIGHT, "RIGHT"],
[Blockly.Msg.AEROBOT_LEFT, "LEFT"]
]), "SENS");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.AEROBOT_LIGHTSENS_TOOLTIP);
Expand All @@ -177,14 +177,14 @@ Blockly.Blocks['aerobot_linesens'] = {
this.setHelpUrl(Blockly.Msg.AEROBOT_HELPURL);
this.setColour(Blockly.Blocks.aerobot.HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_LINESENS_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_CENTER, "CENTER"],
[Blockly.Msg.AEROBOT_RIGHT, "RIGHT"],
[Blockly.Msg.AEROBOT_LEFT, "LEFT"],
[Blockly.Msg.AEROBOT_NONE, "NONE"]
]), "SENS");
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_LINESENS_TITLE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.AEROBOT_CENTER, "CENTER"],
[Blockly.Msg.AEROBOT_RIGHT, "RIGHT"],
[Blockly.Msg.AEROBOT_LEFT, "LEFT"],
[Blockly.Msg.AEROBOT_NONE, "NONE"]
]), "SENS");
this.setInputsInline(true);
this.setOutput(true, 'Number');
this.setTooltip(Blockly.Msg.AEROBOT_LINESENS_TOOLTIP);
Expand All @@ -207,12 +207,12 @@ Blockly.Blocks['aerobot_setled'] = {
this.setHelpUrl(Blockly.Msg.AEROBOT_HELPURL);
this.setColour(Blockly.Blocks.aerobot.HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_SETLED_TITLE)
.appendField(new Blockly.FieldImage(Blockly.Blocks.aerobot.image, 64, 64))
.appendField(Blockly.Msg.AEROBOT_SETLED_TITLE);
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.COLOR)
.appendField(new Blockly.FieldColour("#00ff00"), "RGB");
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.COLOR)
.appendField(new Blockly.FieldColour("#00ff00"), "RGB");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.AEROBOT_SETLED_TOOLTIP);
Expand Down
12 changes: 6 additions & 6 deletions blocks/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Blockly.Blocks['array_create_with_item'] = {
init: function() {
this.setColour(Blockly.Blocks.array.HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.ARRAY_CREATE_WITH_ITEM_TITLE);
.appendField(Blockly.Msg.ARRAY_CREATE_WITH_ITEM_TITLE);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.ARRAY_CREATE_WITH_ITEM_TOOLTIP);
Expand All @@ -178,7 +178,7 @@ Blockly.Blocks['array_create_with_container'] = {
init: function() {
this.setColour(Blockly.Blocks.array.HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.ARRAY_CREATE_WITH_CONTAINER_TITLE_ADD);
.appendField(Blockly.Msg.ARRAY_CREATE_WITH_CONTAINER_TITLE_ADD);
this.appendStatementInput('STACK');
this.setTooltip(Blockly.Msg.ARRAY_CREATE_WITH_CONTAINER_TOOLTIP);
this.contextMenu = false;
Expand All @@ -190,11 +190,11 @@ Blockly.Blocks['array_getIndex'] = {
this.setHelpUrl(Blockly.Msg.ARRAY_GETINDEX);
this.setColour(Blockly.Blocks.array.HUE);
this.appendValueInput("ITEM")
.setCheck('Array')
.appendField(Blockly.Msg.ARRAY_GETINDEX_ITEM);
.setCheck('Array')
.appendField(Blockly.Msg.ARRAY_GETINDEX_ITEM);
this.appendValueInput("AT")
.setCheck("Number")
.appendField(Blockly.Msg.ARRAY_GETINDEX_AT);
.setCheck("Number")
.appendField(Blockly.Msg.ARRAY_GETINDEX_AT);
this.setInputsInline(true);
this.setOutput(true);
this.setTooltip(Blockly.Msg.ARRAY_GETINDEX_TOOLTIP);
Expand Down
2 changes: 1 addition & 1 deletion blocks/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
'use strict';

//To support syntax defined in http://arduino.cc/en/Reference/HomePage
// To support syntax defined in http://arduino.cc/en/Reference/HomePage

goog.provide('Blockly.Blocks.base');

Expand Down
Loading