Giter Club home page Giter Club logo

carlosperate / ardublockly Goto Github PK

View Code? Open in Web Editor NEW
445.0 57.0 274.0 64.09 MB

Visual programming for Arduino. Based on blockly, implements Arduino code generation and facilitates program uploading.

Home Page: http://ardublockly.embeddedlog.com

License: Apache License 2.0

Python 16.61% HTML 2.84% JavaScript 79.87% CSS 0.60% NSIS 0.07%
arduino block blockly arduino-ide visual-programming visual-programming-language desktop-application desktop-app

ardublockly's Introduction

Ardublockly

Ardublockly is a visual programming editor for Arduino. It is based on Google's Blockly, which has been forked to generate Arduino code.

The ArdublocklyServer Python package initialises a local server to be able to compile and load the Arduino code using the Arduino IDE.

This is all packaged in a self contained executable desktop application for Windows, Mac OS X, and Linux.

Ardublockly desktop program screenshot

Features

  • Generates Arduino code with visual drag-and-drop blocks
  • Uploads the code to an Arduino Board
  • Useful "code block warnings"
  • Compatible with a wide range of official Arduino Boards
  • Works on Windows / Linux / Mac OS X

Ardublockly is still under development and a few features are not yet implemented. A to-do list can be found in the TODO.md file.

Currently tested under Windows with Python 2.7 and 3.4 and in Linux and MacOS X with Python 2.7.

Cloning the repository

Please note that there are submodules in the repository that need initialisation. So, to correctly clone the Ardublockly repository:

git clone https://github.com/carlosperate/ardublockly.git
cd ardublockly
git submodule update --init --recursive

Installing

The desktop application is available for Windows/Mac/Linux and runs as a stand-alone executable that can be downloaded from the Ardublockly repository releases page.

You will also need the Arduino IDE version 1.6.x or higher.

Development builds

You can also test UNSTABLE development builds automatically generated every time an update is added to the GitHub repository:

Linux build Windows build Mac OS X build
Linux Build Status Windows Build status Mac Build Status
Download Link Download Link Download Link

"Core version" (Python server only)

If you prefer, the core software can be used by running only the Python server, which loads the web interface on your local browser (Chrome recommended).

Full installation instructions for this version can be found in this Github repository Wiki.

The quick version: Clone this repository, initialise all submodules, and execute:

python start.py

This will work on Windows, Linux (including ARM) and Mac OS X, with Python >2.7 or >3.4

Running

  1. Install Ardublockly.
  2. Install the Arduino IDE version 1.6.x or higher (latest version is always recommended).
  3. Run Ardublockly as defined in your installation method.
  4. Configure Ardublockly to locate the Arduino IDE following these instructions.

Online Demos

A demo of the latest release of Ardublockly main interface can be found in the following two links (to load the code into an Arduino it requires the full Ardublockly application to be downloaded and run on your computer):

WebApp screenshot responsive design

WebApp screenshot

Documentation

The documentation, including installation instructions, configuration instructions, and developer information can be found in the Ardublockly GitHub repository Wiki.

To download the documentation you can git clone the wiki data:

git clone https://github.com/carlosperate/ardublockly.wiki.git

Credit

This project has been inspired by BlocklyDuino.

Blockly original source is Copyright of Google Inc. https://developers.google.com/blockly/. A list of changes to the Blockly fork can be found in the Blockly subdirectory README file.

License

Copyright (c) 2016 carlosperate https://github.com/carlosperate/

Unless stated otherwise, the source code of this projects is licensed under the Apache License, Version 2.0 (the "License"); you may not use any of the licensed files within this project except in compliance with the License.

The full document can be found in the LICENSE file.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

ardublockly's People

Contributors

aethaniel avatar allisonshaw avatar bmcage avatar carloslfu avatar carlosperate avatar cdjackson avatar ciaranj avatar daarond avatar dlaliberte avatar drigz avatar emansije avatar espertus avatar immortalin avatar ingegno avatar jordiorlando avatar kaworru avatar miguel76 avatar neilfraser avatar niccokunzmann avatar nikerabbit avatar picklesrus avatar pjkui avatar pkendall64 avatar rachel-fenichel avatar ranisputnik avatar siebrand avatar takaokouji avatar tarling avatar techplexengineer avatar trodi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ardublockly's Issues

C/C++ headers missing from the displayed Arduino code

A fix for #47 created a regression on this issue.
The Cpp code to HTML conversion wrongly identifies header files as invalid HTML code and removes it from the generated html string. This causes things like #include <xxx> to be displayed just as #include.

Menu items broken

Under Win7 64b pro...

With the latest build, 35c72, the Time, Motors, and Comms block menus are either blank or significantly reduced from prior functions.

The functions menu has functions with input variables available. Not sure if you are just in the middle of adding the functionality back, or if this was also a side effect of the update.

stepper generated code

Incorrect code, example blocks:

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="stepper_config" id="18" inline="false" x="316" y="9">
    <field name="STEPPER_PIN1">1</field>
    <field name="STEPPER_PIN2">2</field>
    <value name="STEPPER_STEPS">
      <block type="math_number" id="19">
        <field name="NUM">100</field>
      </block>
    </value>
    <value name="STEPPER_SPEED">
      <block type="math_number" id="20">
        <field name="NUM">10</field>
      </block>
    </value>
    <value name="STEPPER_NAME">
      <block type="text" id="21">
        <field name="TEXT">MyStepper</field>
      </block>
    </value>
  </block>
  <block type="time_delay" id="22" inline="true" x="38" y="144">
    <value name="DELAY_TIME_MILI">
      <block type="math_number" id="23">
        <field name="NUM">1000</field>
      </block>
    </value>
    <next>
      <block type="stepper_step" id="24" inline="true">
        <field name="STEPPER_NAME">MyStepper</field>
        <value name="STEPPER_STEPS">
          <block type="math_number" id="25">
            <field name="NUM">10</field>
          </block>
        </value>
      </block>
    </next>
  </block>
</xml>

generates code

#include <Stepper.h>

Stepper MyStepper(100, 1, 2);

void setup() {
  MyStepper.setSpeed(10);
}


void loop() {
  delay(1000);
  MyStepper.steps(10),0
}

should be

#include <Stepper.h>

Stepper MyStepper(100, 1, 2);

void setup() {
  MyStepper.setSpeed(10);
}


void loop() {
  delay(1000);
  MyStepper.step(10);
}

Settings dark overlay from Materialize

A dark overlay is added every time a modal is opened, however when any of the modals is closed, only the latest overlay is removed, leaving the others loaded on the page and blocking the content.

Preferences window can be triggered multiple times

Not quite a bug in the Materialize framework, but definitely a bug within Ardublockly.

The current Materialize modal functionality does not stop the same modal to be launched multiple times programmatically, so when triggered from the electron menus it creates mutiple dark overlays on top of the content. Then, when the preferences modal is dismissed only the latest overlay is removed.

Can be fixed by either locally tracking the state of the preferences window (kind of hacky) or updating the Materialize framework (already on the works on issue #1647).

Variable blocks do not get their internal value assigned.

The current implementation navigates through statements and expects variable blocks to have their type assigned internally if already defined earlier in the block stack. This variable block type assignment is currently missing and causes undefined types to filter through the final code generation.

Compile check not displaying errors

Even when there are clear errors in the sketch, the return message at the bottom banner still reports that the check was successful from the Arduino IDE.

Floats?

How is a variable set to a float type?

HTTP1.1 error

default

python ver 3.5....

why this error..??

closure/goog/base.js existence

Servo Pins, need more

The servo motor module is limited in the pins you can choose. The servo library allows for almost all of the pins, including the analog, to be used for servos. They are not limited to PWM pins.

Toolbox view/hide button dissapears

More common on touch devices (probably because of the double click bug), but every one in a while the button seems to animate to the left and disappear off the viewport.

Hidden content in fixed footer modal

The current settings modal has one of the select elements hidden by the modal footer in firefox.
Possible workaround could be to add additional padding to the last element within the modal, but a Materialize bug is already reported.

Change item/variable name or new not popping up

When using the current ready to run windows version on Win 7 64, the popup window normally seen in blockly, or the ability to type over the label of the variables (default as "item"), does not appear to function.


Repository owner edit to trigger Github task list for this issue:

  • Refactor Blockly to allow async update of variable names
  • Update desktop aplication to use Ardublockly HTML modal instead of window.prompt (browser version still uses prompt)
  • Further refactor Blockly to allow async creation of a new variable name
  • Submit blockly changes as upstream PR

Scoop

I was wondering if in the future there might be a scoop block to run the scoop library so I can run several loops simultaneously?

Generic Code Block

It would be useful to have a generic block that allowed for code to be directly added. ArduBlock had this feature, and I found it useful in adding additional functionality when I needed to add libraries or just a little bit of manual code to enhance the visual functions.

Great job so far! I am looking forward to showing ardublockly to several youth groups and as a fun tool to go with my robot kits.

Hover Tips/Tooltips

It would be great to have tooltips which appear when one hovers over buttons. This helps new users learn the interface. Most of the time adding a title="" attribute will suffice.

Great work!

ternary block type checks

For the Arduino generator only, the ternary block should display a warning if the types of the assignment blocks are different from each other.

labels editing is skewed

Win 7 64b pro...

The editing of labels and some variables has the text in an awkward location:
image
image

Desktop app open file

The current way to open a blocks xml file to load does not work on the Desktop application due to the way the file dialog is triggered.
To fix this a node.js/electron file dialog needs to be triggered, a file read and the string text send back into the Ardublockly application.

Serial Monitor?

What are the plans for any integration with a serial monitor?

Arduino app does not work in IE

The app renders fine in Chrome, Firefox, and Opera, but it does not render any of the originally hidden divs (content_blocks, content_arduino, content_xml) in IE.

Current builds missing menus

Win7 64b pro...

The builds from 01/30/2016 and 01/31/2016 both are missing the blocks menu and give an error of "invalid xml" when an example file opening is attempted.

The future of ardublockly and use with others' products?

Carlos,

I am not sure how to contact you with a private message through git.

I am nearing completion on a robotic chassis system I have been developing and may also feature on a crowdfunder like kickstarter. Ardublockly has the potential to be a near perfect fit for what I have in mind for both my basic and more advanced starter kits.

Sure you have this out there under an open license, but do you have any objection to me presenting Ardublockly as a useful tool with my product?

What might be the longer term goals, and achievable timeline, for further development and feature enhancements beyond your todo list?

Thank you.

Zoom icons function

Is the cross hairs zoom button suppose to work as a zoom to extents/all, or as it currently functions where it zooms to the center of mass at the 100% setting?

If I start with a large or spread out program like this zoomed out to see it all:
image

then clicked on cross hair:
image

Blockly svg resize delay

Ardublockly apps load blockly inside a div. There is currently javascript attempting to dynamically resize blockly when the page/window size changes. The svg does not resize in all occasions, sometimes requiring two resizes before it is redraw and sometimes requiring blocks to be moved around.

Comment popup window jumps over tool menu

The text of the comments window pops up, sort of, over the top of the tool/block menu bar after clicking back on "?" to hide and re-display comments.

Initial entry:
image

1st Click on "?" to close: (BTW, seems related that comments do not show in arduino source code until the block is moved around)
image

2nd click back on "?" to view comment:
image

Additional view and hide clicks respond the same as 2nd until the block is moved with the comment popup exposed then it works along with the comment now present in the arduino source code:
image

Once the comment is closed, it will again act the same way with the text top left of window until you drag the block, then, it does pop back in place. However, when the comment is hidden, there is a brief blip of the text in the correct popup location before it fully closes. Additionally, removal or changes of the comment do not update in arduino source code until the block is drug around.

Select drop down menus duplicate

The HTML seletc drop down menus duplicate every time the Settings modal window is open or an option is selected. Only the latest menu refreshes to the correct value.
This is a Materialize issue, as it does not have a way to actualize the HTML elements without creating a new menu.

Traducción de Ardublockly al Español

Hola Carlos

He visto tu trabajo sobre Ardublockly y me gustaría realizar la traducción al español de la herramienta. ¿Será posible? ¿Que ficheros debo traducir?. Me gustaría poder utilizarla con mis alumnos y en los cursos de formación que imparto sobre Entornos de Programación de Arduino

También estoy interesado en una versión directamente ejecutable desde Windows de la aplicación Ardublockly, ¿existe?.

saludos

Profesor
José Manuel Ruiz Gutierrez
España


Repository owner edit to trigger Github task list for this issue:

  • Implement block sessionStorage to save block on language change (requires page reload)
  • Add language menu that trigger main blockly language change
  • Update toolbox to change language strings with blockly
  • Move the arduino specific blocks strings to a translation file
  • Move all the text displayed in the main web interface to a translation file
  • Extended the server settings to store the language selection
  • Update the front en code to retrieve the store language setting from the server
  • Translate all strings to the Spanish language

Easier Custom Block Creation

Currently, creating a custom block requires jumping through a lot of hoops. I noticed that you have a block creator in your TODO.md. Do you think you can elaborate on that? I am building something similar. The end goal is to combine the block factory with this, a browser-based code editor, e.g. ace editor, a visual tree editor for the toolbox.xml for easy addition and removal of blocks and finally automated addition and removal of blocks directly from the browser to remove the need for manual copying and pasting. The problem I have is how do you store and parse javascript code. While it is easy to insert code to blocks.js and python.js or, arduino.js in your case, by simply appending to the file, it is much harder to remove or update it. I have come up with two solutions to this, 1) Use a tool such as Esprima to parse the js functions and insert/remove/update the files similar to a key-value database or 2) Split the blocks into separate files and have build.py concatenate them together at runtime. I do not have much experience with writing databases/kv stores and I believe the second solution to be easier as you are directly reading/writing to the filesystem.

Problem with < and > logic operators during code generation,

Dear, Carlos.

There is a problem with the code generation when we use the > or < operators,

after the first time you choose one of them in the dropdown list, you get the simbols > and < into the code instead of the simbols < or >. I'm workin in that fork I told you and I need solve this problem that also happens in ardublockly.

Best Regards

Rubens.

Add on Blocks usage

How is it we enable the add on blocks like the grove?

I saw some mention of a function to call from the module, I think, but I am unsure where/how that is done.

I have been able to open open the examples of grove and play with the blocks, but I am not sure how to get the menu item in the tool bar to show.

Code Highlighting

It would be a great enhancement if the code in the arduino source code window would be highlighted to indicate the blocks that are currently selected. This would be a great teaching and debugging tool.
image

AnalogWrite to digital pins?

Any short term plans for expanding the analogue write to include digital/pwm pins?

Is there somewhere besides issues I should post enhancements?

Run program button in IE

The run program button (red one) can only be clicked in IE in a very small area at the bottom of the circle.
The button works fine in Firefox, Chrome and Opera.

Generic Motor Enhancement

Is there a list of block requests I should point this towards?

In addition to the stepper and servo motor blocks, a generic motor block which at minimum can handle a pin for direction (0,1) and a speed pin (0-255) would be cool. Maybe another expanded version which handled two motors labelled left and right.

AVG Antivirus Support

When I tried to run Ardublockly with AVG antivirus running, AVG blocked some of the files. I think it was the "start" file that was the trigger.

Right now I am running within a vmware virtual machine without any AVG.

start.py error in windows 7 32bits

I tried to work with Ardublocky in a machine with windows 7-32bits and I got this errors when trying do run start.py:

Python 2.7.8 (default, Jun 30 2014, 16:03:49)
[MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

================================ RESTART ================================

Running Python version 2.7.8

======= Loading Settings =======

Settings loaded from:
C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\ServerCompilerSettings.ini

The provided compiler path in the settings file is not valid:
None
Default compiler path set:
None

Traceback (most recent call last):
File "C:\Users\Rubens\dbk_over_ardublockly\start.py", line 120, in
main(sys.argv[1:])
File "C:\Users\Rubens\dbk_over_ardublockly\start.py", line 89, in main
ArdublocklyServer.ServerCompilerSettings.ServerCompilerSettings()
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\ServerCompilerSettings.py", line 61, in new
cls.__singleton_instance.__initialise()
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\ServerCompilerSettings.py", line 77, in __initialise
self.read_settings()
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\ServerCompilerSettings.py", line 509, in read_settings
self.set_serial_port_from_file(settings_dict['arduino_serial_port'])
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\ServerCompilerSettings.py", line 350, in set_serial_port_from_file
self.populate_serial_port_list()
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\ServerCompilerSettings.py", line 401, in populate_serial_port_list
port_list = ArdublocklyServer.SerialPort.get_port_list()
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\SerialPort.py", line 20, in get_port_list
iterator = get_port_complete_list()
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\SerialPort.py", line 13, in get_port_complete_list
return sorted(port_list)
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\PySerialListPorts\list_ports_windows.py", line 232, in comports
yield string(port_name_buffer), string(szFriendlyName), szHardwareID_str
File "C:\Users\Rubens\dbk_over_ardublockly\ArdublocklyServer\PySerialListPorts\list_ports_windows.py", line 46, in string
return ''.join(s)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 0: ordinal not in range(128)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.