├── .gitignore
├── .gitmodules
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── assets
├── app.icns
├── document.icns
├── icons
│ ├── 128x128x32.png
│ ├── 16x16x32.png
│ ├── 256x256x32.png
│ ├── 32x32x32.png
│ └── 48x48x32.png
├── s4a.ico
├── s4a_logo.png
├── s4a_logo_sm.png
├── snap4arduino.png
└── snap4arduino.svg
├── build
├── prepare
├── print_utils
└── src
├── Costumes
├── COSTUMES_s4a.json
├── beetleJr.svg
├── cat2Jr.svg
├── echidna.png
├── echidna.svg
├── echidnaJr.png
├── fantastic.png
└── tortugaJr.png
├── Examples
├── Bumpy Cat.xml
├── EXAMPLES_s4a.json
├── Etch-a-Sketch.xml
├── Force Meter.xml
├── Gauge.xml
├── Line Tracer.xml
├── MeArm.xml
├── Robotic eye.xml
├── Simon.xml
├── SnapJunior.xml
└── Theremin.xml
├── libraries
├── Creative_Robotix.xml
├── LIBRARIES_s4a.json
├── NeoPixel.xml
├── SA5Firmata_ir.xml
├── SA5Firmata_tone.xml
├── TdRSTEAMv1.xml
├── TdRSTEAMv2.xml
├── arduino
│ ├── BraccioFirmata
│ │ └── BraccioFirmata.ino
│ ├── CRE_Firmata
│ │ └── CRE_Firmata.ino
│ ├── SA5Firmata
│ │ ├── sa5firmata_ir_5
│ │ │ └── sa5firmata_ir_5.ino
│ │ └── sa5firmata_tone_5
│ │ │ └── sa5firmata_tone_5.ino
│ └── Serial_Bridge_mDNS_websocket.ino
├── blankLib.xml
├── braccio.xml
├── echidna.xml
├── i2c.xml
├── imagina.xml
├── nodeMCU.xml
├── phiro.xml
├── scale.xml
├── snapJrLib.xml
├── snapJrLib_old.xml
└── snapJrPlusLib.xml
├── platforms
├── desktop
│ ├── build
│ ├── gnu
│ │ ├── 32
│ │ │ ├── .buildme
│ │ │ ├── build
│ │ │ └── root
│ │ ├── 64
│ │ │ ├── .buildme
│ │ │ ├── build
│ │ │ └── root
│ │ ├── Snap4Arduino.desktop
│ │ └── launcher.sh
│ ├── osx
│ │ └── 64
│ │ │ ├── .buildme
│ │ │ ├── build
│ │ │ ├── disable_gpu.command
│ │ │ ├── package.json
│ │ │ └── root
│ ├── root
│ │ ├── desktop
│ │ │ └── gui.js
│ │ ├── index.html
│ │ ├── libraries
│ │ │ └── leap-library.xml
│ │ ├── loading.png
│ │ └── package.json
│ └── win
│ │ ├── 32
│ │ ├── .buildme
│ │ ├── build
│ │ └── root
│ │ ├── 64
│ │ ├── .buildme
│ │ ├── build
│ │ └── root
│ │ ├── Snap4Arduino.iss
│ │ └── makeinstaller
├── embedded
│ ├── cli
│ │ ├── .buildme
│ │ ├── build
│ │ ├── root
│ │ │ ├── index.html
│ │ │ └── linino
│ │ │ │ ├── blocks.js
│ │ │ │ ├── gui.js
│ │ │ │ ├── linino.js
│ │ │ │ ├── objects.js
│ │ │ │ ├── store.js
│ │ │ │ └── threads.js
│ │ └── super_root
│ │ │ ├── LICENSE.md
│ │ │ ├── README.md
│ │ │ ├── canvas.js
│ │ │ ├── decorators.js
│ │ │ ├── install.sh
│ │ │ ├── linino.js
│ │ │ ├── listen.js
│ │ │ ├── nodify.js
│ │ │ ├── package.json
│ │ │ ├── snap.js
│ │ │ └── threads.js
│ └── ipkg
│ │ ├── build
│ │ ├── root
│ │ ├── daemon.js
│ │ └── ws.js
│ │ └── src
│ │ └── templates
│ │ ├── daemon.sh
│ │ ├── ipkg-control
│ │ ├── postinst
│ │ ├── postinst-pkg
│ │ ├── postrm
│ │ └── prerm
├── mobile
│ ├── android
│ │ ├── .buildme
│ │ ├── build
│ │ ├── build-extras.gradle
│ │ ├── config.xml
│ │ └── root
│ │ │ ├── index.html
│ │ │ ├── mobile
│ │ │ ├── arduino.js
│ │ │ ├── blocks.js
│ │ │ ├── bops.js
│ │ │ ├── events.js
│ │ │ ├── firmata.js
│ │ │ ├── gui.js
│ │ │ ├── mobile.js
│ │ │ ├── morphic.js
│ │ │ ├── serialport.js
│ │ │ └── util.js
│ │ │ └── plugin
│ │ │ ├── arduino.js
│ │ │ ├── gui.js
│ │ │ ├── morphic.js
│ │ │ ├── plugin.js
│ │ │ └── threads.js
│ └── ios
│ │ ├── build
│ │ ├── config.xml
│ │ └── root
└── web
│ ├── chromeos
│ ├── .buildme
│ ├── build
│ └── root
│ │ ├── background.js
│ │ ├── chromeos
│ │ ├── chromefs.js
│ │ ├── gui.js
│ │ ├── morphic.js
│ │ ├── startup.js
│ │ └── threads.js
│ │ ├── events.js
│ │ ├── firmata.js
│ │ ├── icon-128.png
│ │ ├── icon-16.png
│ │ ├── index.html
│ │ ├── main.js
│ │ ├── manifest.json
│ │ ├── sandbox.html
│ │ ├── serialport.js
│ │ └── util.js
│ └── chromium
│ ├── .buildme
│ ├── build
│ ├── chromeExtensions.txt
│ ├── crx
│ ├── background.html
│ ├── bundle.js
│ ├── icon-128.png
│ ├── icon-16.png
│ └── manifest.json
│ └── root
│ ├── img
│ ├── app_120.png
│ ├── app_128.png
│ ├── app_144.png
│ ├── app_152.png
│ ├── app_192.png
│ ├── app_256.png
│ ├── app_384.png
│ ├── app_512.png
│ ├── app_72.png
│ └── app_96.png
│ ├── index.html
│ ├── index_fast.html
│ ├── manifest.json
│ ├── plugin
│ ├── arduino.js
│ ├── gui.js
│ ├── morphic.js
│ ├── objects.js
│ ├── plugin.js
│ └── threads.js
│ └── sw.js
├── s4a
├── arduino.js
├── blocks.js
├── byob.js
├── cloud.js
├── extensions.js
├── firmware
│ ├── UNO_FirmataNeopixel.hex
│ ├── UNO_FirmataSA5Ir.hex
│ ├── UNO_FirmataSA5Tone.hex
│ ├── UNO_FirmataSt.hex
│ ├── uploader.html
│ └── uploader.js
├── gui.js
├── httpserver.js
├── icon-128.png
├── icon-16.png
├── icon-256.png
├── lang-ca.js
├── lang-cs.js
├── lang-de.js
├── lang-es.js
├── lang-et.js
├── lang-eu.js
├── lang-fr.js
├── lang-gl.js
├── lang-he.js
├── lang-id.js
├── lang-it.js
├── lang-ko.js
├── lang-nl.js
├── lang-pl.js
├── lang-pt.js
├── lang-pt_BR.js
├── lang-ru.js
├── lang-sv.js
├── lang-tr.js
├── lang-ua.js
├── lang-uk.js
├── lang-zh_CN.js
├── lang-zh_TW.js
├── lists.js
├── morphic.js
├── objects.js
├── store.js
└── threads.js
└── version
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | environments/*
3 | tmp
4 | releases/*
5 | .DS_Store
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/snap"]
2 | path = src/snap
3 | url = https://github.com/jguille2/Snap.git
4 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | When contributing to this repository, please **first discuss the change you wish to make via issue,
4 | email, or any other method with the owners of this repository**.
5 |
6 | Pull requests that do not respond to an open issue that has been agreed upon by the maintainers
7 | will most likely be rejected.
8 |
9 | Please note we have a code of conduct, please follow it in all your interactions with the project.
10 |
11 | ## Pull Request Process
12 |
13 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
14 | build.
15 | 2. Update the README.md with details of changes to the interface, this includes new environment
16 | variables, exposed ports, useful file locations and container parameters.
17 |
--------------------------------------------------------------------------------
/assets/app.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/app.icns
--------------------------------------------------------------------------------
/assets/document.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/document.icns
--------------------------------------------------------------------------------
/assets/icons/128x128x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/icons/128x128x32.png
--------------------------------------------------------------------------------
/assets/icons/16x16x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/icons/16x16x32.png
--------------------------------------------------------------------------------
/assets/icons/256x256x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/icons/256x256x32.png
--------------------------------------------------------------------------------
/assets/icons/32x32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/icons/32x32x32.png
--------------------------------------------------------------------------------
/assets/icons/48x48x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/icons/48x48x32.png
--------------------------------------------------------------------------------
/assets/s4a.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/s4a.ico
--------------------------------------------------------------------------------
/assets/s4a_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/s4a_logo.png
--------------------------------------------------------------------------------
/assets/s4a_logo_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/s4a_logo_sm.png
--------------------------------------------------------------------------------
/assets/snap4arduino.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/assets/snap4arduino.png
--------------------------------------------------------------------------------
/assets/snap4arduino.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
94 |
--------------------------------------------------------------------------------
/print_utils:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Just some utility function to colorfully print stuff
3 |
4 | print_ok() {
5 | echo "\033[32m$1\033[0m"
6 | }
7 |
8 | print_warning() {
9 | echo "\033[30;43mWARNING:\033[0;33m $1\033[0m"
10 | }
11 |
12 | print_error() {
13 | (>&2 echo "\033[37;41mERROR:\033[0m \033[1;31m$1\033[0m");
14 | }
15 |
--------------------------------------------------------------------------------
/src/Costumes/COSTUMES_s4a.json:
--------------------------------------------------------------------------------
1 | },
2 | {
3 | "fileName": "tortugaJr.png",
4 | "name": "tortuga",
5 | "translations": {
6 | }
7 | },
8 | {
9 | "fileName": "fantastic.png",
10 | "name": "fantastic",
11 | "translations": {
12 | }
13 | },
14 | {
15 | "fileName": "beetleJr.svg",
16 | "name": "beetleJr",
17 | "translations": {
18 | }
19 | },
20 | {
21 | "fileName": "cat2Jr.svg",
22 | "name": "cat2Jr",
23 | "translations": {
24 | }
25 | },
26 | {
27 | "fileName": "echidna.png",
28 | "name": "echidna",
29 | "translations": {
30 | }
31 | },
32 | {
33 | "fileName": "echidna.svg",
34 | "name": "echidna",
35 | "translations": {
36 | }
37 | },
38 | {
39 | "fileName": "echidnaJr.png",
40 | "name": "echidnaJr",
41 | "translations": {
42 | }
43 | }
44 | ]
45 |
--------------------------------------------------------------------------------
/src/Costumes/echidna.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/Costumes/echidna.png
--------------------------------------------------------------------------------
/src/Costumes/echidnaJr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/Costumes/echidnaJr.png
--------------------------------------------------------------------------------
/src/Costumes/fantastic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/Costumes/fantastic.png
--------------------------------------------------------------------------------
/src/Costumes/tortugaJr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/Costumes/tortugaJr.png
--------------------------------------------------------------------------------
/src/Examples/EXAMPLES_s4a.json:
--------------------------------------------------------------------------------
1 | },
2 | {
3 | "fileName": "Bumpy Cat.xml",
4 | "name": "LED-triggering virtual cat"
5 | },
6 | {
7 | "fileName": "Force Meter.xml",
8 | "name": "Pressure sensor force meter"
9 | },
10 | {
11 | "fileName": "Line Tracer.xml",
12 | "name": "Line tracer robot"
13 | },
14 | {
15 | "fileName": "Simon.xml",
16 | "name": "Simon game"
17 | },
18 | {
19 | "fileName": "Etch-a-Sketch.xml",
20 | "name": "Etch a Sketch"
21 | },
22 | {
23 | "fileName": "Gauge.xml",
24 | "name": "Analog sensor gauge"
25 | },
26 | {
27 | "fileName": "MeArm.xml",
28 | "name": "MeArm robotic arm example"
29 | },
30 | {
31 | "fileName": "Robotic eye.xml",
32 | "name": "Robotic eye"
33 | },
34 | {
35 | "fileName": "Theremin.xml",
36 | "name": "Analog sensor theremin"
37 | }
38 | ]
39 |
--------------------------------------------------------------------------------
/src/libraries/NeoPixel.xml:
--------------------------------------------------------------------------------
1 |
166
3 |
--------------------------------------------------------------------------------
/src/libraries/blankLib.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/libraries/braccio.xml:
--------------------------------------------------------------------------------
1 |
basebase
3 | shoulder
4 | elbow
5 | hand
6 | wrist
7 | gripper90
basebase
8 | shoulder
9 | elbow
10 | hand
11 | wrist
12 | gripper1
openopen
13 | close
basebase
14 | shoulder
15 | elbow
16 | hand
17 | wrist
18 | gripperWe use a list because we need some kind of variable that's passed as a reference to the JS function. A numeric type would not work, as it's passed by value and thus the original value can't be changed from inside the "run" block.
19 |
--------------------------------------------------------------------------------
/src/libraries/i2c.xml:
--------------------------------------------------------------------------------
1 |
ca:i2c escriu dades _ al registre _ de l'adreça _
ca:i2c envia comandes _ a l'adreça _
ca:i2c llegeix _ registres de l'adreça _
--------------------------------------------------------------------------------
/src/libraries/scale.xml:
--------------------------------------------------------------------------------
1 |
ca:constreny _ entre _ i _
es:constreñir _ entre _ y _
ca:escala _ des de [ _ , _ ] fins [ _ , _ ]
es:escala _ desde [ _ , _ ] hasta [ _ , _ ]
--------------------------------------------------------------------------------
/src/libraries/snapJrPlusLib.xml:
--------------------------------------------------------------------------------
1 |
50controltrue
50controltrue
90controltrue
90controltrue
3 |
--------------------------------------------------------------------------------
/src/platforms/desktop/build:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Particular build script for nwjs.io-based versions.
4 |
5 | # First parameter contains the platform name in the form desktop/gnu/32,
6 | # which needs transforming into linux32
7 |
8 | platform=`echo $1 | sed 's/gnu/linux/' | sed 's/desktop\///' | sed 's/\///'`
9 |
10 | echo
11 | echo "======="
12 | echo "Setting up Node dependencies..."
13 | echo "======="
14 | echo
15 |
16 | cp -Rv environments/desktop/node_modules tmp
17 |
18 | echo
19 | echo "======="
20 | echo "Setting version name..."
21 | echo "======="
22 | echo
23 |
24 | sed -E 's/.*version.*/ "version": "'`cat src\/version`'",/' src/platforms/desktop/root/package.json > tmp/package.json
25 |
26 | echo
27 | echo "======="
28 | echo "Asking nwbuilder to build Snap4Arduino for $platform"
29 | echo "======="
30 | echo
31 |
32 | rm -rf releases/desktop/Snap4Arduino/$platform
33 | rm -rf releases/$1
34 |
35 | #environments/node_modules/nw-builder/bin/nwbuild -v 0.34.5 -p $platform tmp -o releases/desktop
36 | environments/node_modules/nw-builder/bin/nwbuild -p $platform tmp -o releases/desktop
37 | #notes about nodejs and chromium versions:
38 | # Sn4A_v6 used (fixed) 0.34.5 (Chromium 70)
39 | # Sn4A_v7 used (current at the time) 0.60.0 (Chromium 97)
40 | # WindowsCOMxx issue appears in Chromium73 and continue (current version 108)
41 | # The last "smooth" version is nodejs 0.36.0 with Chromium 72.0.3626.121
42 | # But also we have our online version (always using current chromium)
43 | # ===> We implement a workaround for the COMxx issue to continue with latest versions
44 | mkdir -p releases/$1
45 | mv releases/desktop/Snap4Arduino/$platform/* releases/$1
46 | rm -rf releases/desktop/Snap4Arduino
47 |
48 | if echo $1 | grep win; then
49 | if test "$2" = "--makeinstaller"; then
50 | echo
51 | echo "======="
52 | echo "Building Microsoft Windows installer for $platform"
53 | echo "======="
54 | echo
55 | src/platforms/$1/../makeinstaller $1
56 | fi
57 | elif echo $1 | grep osx; then
58 | echo
59 | echo "======="
60 | echo "Copying OS X .icns files over..."
61 | echo "======="
62 | echo
63 | cp assets/*.icns releases/$1/Snap4Arduino.app/Contents/Resources
64 | # In old Macs, one needs to disable GPU rendering for Snap4Arduino to work
65 | echo
66 | echo "======="
67 | echo "Copying OS X additional scripts over..."
68 | echo "======="
69 | echo
70 | cp src/platforms/$1/disable_gpu.command releases/$1
71 | elif echo $1 | grep gnu; then
72 | echo
73 | echo "======="
74 | echo "Renaming executable..."
75 | echo "======="
76 | echo
77 | mv releases/$1/Snap4Arduino releases/$1/run
78 | echo
79 | echo "======="
80 | echo "Copying icon files over..."
81 | echo "======="
82 | echo
83 | cp -R assets/icons releases/$1
84 | echo
85 | echo "======="
86 | echo "Copying desktop entry over..."
87 | echo "======="
88 | echo
89 | cp src/platforms/desktop/gnu/Snap4Arduino.desktop releases/$1
90 | cp src/platforms/desktop/gnu/launcher.sh releases/$1
91 | fi
92 |
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/32/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/desktop/gnu/32/.buildme
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/32/build:
--------------------------------------------------------------------------------
1 | ../../build
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/32/root:
--------------------------------------------------------------------------------
1 | ../../root
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/64/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/desktop/gnu/64/.buildme
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/64/build:
--------------------------------------------------------------------------------
1 | ../../build
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/64/root:
--------------------------------------------------------------------------------
1 | ../../root
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/Snap4Arduino.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Version=1.0
4 | Icon=
5 | Exec=sh -c 'cd $(dirname %k) && ./launcher.sh'
6 | Name=Snap4Arduino
7 | Name[en]=Snap4Arduino
8 | GenericName[en]=Use Snap! to control Arduino boards. Arduino goes lambda!
9 |
--------------------------------------------------------------------------------
/src/platforms/desktop/gnu/launcher.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | BIN=run
3 | DESKTOP=Snap4Arduino.desktop
4 | mv "$DESKTOP" "$DESKTOP".bck
5 | sed -e "s,Icon=.*,Icon=$PWD/icons/128x128x32.png,g" "$DESKTOP".bck > "$DESKTOP"
6 | rm "$DESKTOP".bck
7 | chmod +x "$DESKTOP"
8 |
9 | ./"$BIN"
10 |
--------------------------------------------------------------------------------
/src/platforms/desktop/osx/64/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/desktop/osx/64/.buildme
--------------------------------------------------------------------------------
/src/platforms/desktop/osx/64/build:
--------------------------------------------------------------------------------
1 | ../../build
--------------------------------------------------------------------------------
/src/platforms/desktop/osx/64/disable_gpu.command:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4 | cd $DIR
5 |
6 | if [ -z "`grep "disable-gpu" Snap4Arduino.app/Contents/Resources/app.nw/package.json`" ]; then
7 | sed 's/^{$/{ "chromium-args": "--disable-gpu",/' Snap4Arduino.app/Contents/Resources/app.nw/package.json > package.json
8 | mv package.json Snap4Arduino.app/Contents/Resources/app.nw/package.json
9 | fi
10 |
--------------------------------------------------------------------------------
/src/platforms/desktop/osx/64/package.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/desktop/osx/64/package.json
--------------------------------------------------------------------------------
/src/platforms/desktop/osx/64/root:
--------------------------------------------------------------------------------
1 | ../../root
--------------------------------------------------------------------------------
/src/platforms/desktop/root/libraries/leap-library.xml:
--------------------------------------------------------------------------------
1 |
x1
yaw1
x1
1
1
2 |
--------------------------------------------------------------------------------
/src/platforms/desktop/root/loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/desktop/root/loading.png
--------------------------------------------------------------------------------
/src/platforms/desktop/root/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "index.html",
3 | "version": "override_me",
4 | "name": "Snap4Arduino",
5 | "description": "Snap4Arduino",
6 | "window": {
7 | "title": "Snap4Arduino",
8 | "icon": "s4a/icon-128.png",
9 | "frame": true,
10 | "position": "center",
11 | "width": 960,
12 | "height": 640,
13 | "min_width": 960,
14 | "min_height": 640
15 | },
16 | "build": {
17 | "linux": {
18 | "icon": "s4a/icon-128.png"
19 | },
20 | "win": {
21 | "icon": "s4a.ico"
22 | }
23 | },
24 | "dependencies": {
25 | "firmata": ">=0.3.3",
26 | "serialport": ">=0.7.5"
27 | },
28 | "licenses": [
29 | {
30 | "type": "AGPLv2",
31 | "url": "https://raw.githubusercontent.com/bromagosa/Snap4Arduino/master/LICENSE"
32 | }
33 | ],
34 | "maintainers":[
35 | {
36 | "name": "Joan Guillén",
37 | "email": "jguille2@xtec.cat",
38 | "web": "https://github.com/jguille2"
39 | },
40 | {
41 | "name": "Bernat Romagosa",
42 | "email": "bernat@snap4arduino.rocks",
43 | "web": "http://romagosa.work"
44 | }
45 | ],
46 | "repositories": [
47 | {
48 | "type": "git",
49 | "url": "https://github.com/bromagosa/Snap4Arduino.git"
50 | }
51 | ],
52 | "chromium-args": "--disable-raf-throttling"
53 | }
54 |
--------------------------------------------------------------------------------
/src/platforms/desktop/win/32/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/desktop/win/32/.buildme
--------------------------------------------------------------------------------
/src/platforms/desktop/win/32/build:
--------------------------------------------------------------------------------
1 | ../../build
--------------------------------------------------------------------------------
/src/platforms/desktop/win/32/root:
--------------------------------------------------------------------------------
1 | ../../root
--------------------------------------------------------------------------------
/src/platforms/desktop/win/64/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/desktop/win/64/.buildme
--------------------------------------------------------------------------------
/src/platforms/desktop/win/64/build:
--------------------------------------------------------------------------------
1 | ../../build
--------------------------------------------------------------------------------
/src/platforms/desktop/win/64/root:
--------------------------------------------------------------------------------
1 | ../../root
--------------------------------------------------------------------------------
/src/platforms/desktop/win/Snap4Arduino.iss:
--------------------------------------------------------------------------------
1 | ; Script generated by the Inno Setup Script Wizard.
2 | ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3 |
4 | [Setup]
5 | ; NOTE: The value of AppId uniquely identifies this application.
6 | ; Do not use the same AppId value in installers for other applications.
7 | ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
8 | AppId={{79712027-5DAE-425B-8534-1CA699720EA5}
9 | AppName=Snap4Arduino
10 | AppVersion=@AppVersion
11 | AppVerName=Snap4Arduino-@AppVersion
12 | AppPublisher=Snap4Arduino team
13 | AppPublisherURL=https://snap4arduino.rocks
14 | AppSupportURL=https://snap4arduino.rocks
15 | AppUpdatesURL=https://snap4arduino.rocks
16 | DefaultDirName={pf}\Snap4Arduino
17 | DefaultGroupName=Snap4Arduino
18 | AllowNoIcons=no
19 | OutputDir=.
20 | OutputBaseFilename=Snap4Arduino-@AppVersion-@Architecture
21 | SetupIconFile=s4a.ico
22 | Compression=lzma
23 | SolidCompression=yes
24 |
25 | [Languages]
26 | Name: "english"; MessagesFile: "compiler:Default.isl"
27 | Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
28 | Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
29 |
30 | [Tasks]
31 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
32 | Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
33 |
34 | [Files]
35 | Source: "*.*"; Excludes: "Snap4Arduino.iss"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
36 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
37 |
38 | [Icons]
39 | Name: "{group}\Snap4Arduino"; Filename: "{app}\Snap4Arduino.exe"; IconFilename: "{app}\s4a.ico"; WorkingDir: "{app}"
40 | Name: "{group}\{cm:ProgramOnTheWeb,Snap4Arduino}"; Filename: "http://snap4arduino.rocks"
41 | Name: "{group}\{cm:UninstallProgram,Snap4Arduino}"; Filename: "{uninstallexe}"
42 | Name: "{commondesktop}\Snap4Arduino"; Filename: "{app}\Snap4Arduino.exe"; IconFilename: "{app}\s4a.ico"; Tasks: desktopicon; WorkingDir: "{app}"
43 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Snap4Arduino"; Filename: "{app}\Snap4Arduino.exe"; Tasks: quicklaunchicon; WorkingDir: "{app}"
44 |
45 | [Run]
46 | Filename: "{app}\Snap4Arduino.exe"; Description: "{cm:LaunchProgram,Snap4Arduino}"; Flags: nowait postinstall skipifsilent
47 |
--------------------------------------------------------------------------------
/src/platforms/desktop/win/makeinstaller:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | unset DISPLAY
4 |
5 | # set the version and platform architecture in the corresponding template fields in the Inno Setup file
6 | cat src/platforms/desktop/win/Snap4Arduino.iss | sed -E 's/@AppVersion/'`cat src\/version`'/' | sed -E 's/@Architecture/'`echo $1 | tail -c 3`'/' > releases/$1/Snap4Arduino.iss
7 |
8 | cp assets/s4a.ico releases/$1
9 | cd releases/$1
10 | wine "`find ~/.wine/drive_c | grep ISCC.exe`" ./Snap4Arduino.iss
11 | cd -
12 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/embedded/cli/.buildme
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/build:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Particular build script for NodeJS command line version.
4 |
5 | echo
6 | echo "======="
7 | echo "Reorganizing directory tree"
8 | echo "======="
9 | echo
10 |
11 | mkdir tmp/snap
12 | mv tmp/* tmp/snap 2>/dev/null
13 | cp src/version tmp
14 | rm -R tmp/snap/Backgrounds
15 | rm -R tmp/snap/Costumes
16 | rm -R tmp/snap/Sounds
17 | rm -R tmp/snap/Examples
18 | rm -R tmp/snap/help
19 |
20 | echo
21 | echo "======="
22 | echo "Setting up Node dependencies..."
23 | echo "======="
24 | echo
25 |
26 | cp -Rv environments/embedded/cli/node_modules tmp
27 |
28 | echo
29 | echo "======="
30 | echo "Fetching more platform-specific files"
31 | echo "======="
32 | echo
33 |
34 | cp src/platforms/embedded/cli/super_root/* tmp
35 |
36 | echo
37 | echo "======="
38 | echo "Creating release for embedded/cli"
39 | echo "======="
40 | echo
41 |
42 | rm -rf releases/embedded/cli
43 | mkdir -p releases/embedded
44 | cp -R tmp releases/embedded/cli
45 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/root/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Snap4Arduino @AppVersion
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/root/linino/blocks.js:
--------------------------------------------------------------------------------
1 | function pinsSettableToMode(aMode) {
2 | var pinNumbers = {},
3 | pins = world.board.pins;
4 |
5 | if (aMode === 'analog') {
6 | return world.board.analogPins;
7 | }
8 |
9 | pins.forEach(
10 | function(each){
11 | if (each.supportedModes.indexOf(aMode) > -1) {
12 | var number = pins.indexOf(each).toString();
13 | pinNumbers[number] = number;
14 | }
15 | }
16 | );
17 |
18 | return pinNumbers;
19 | }
20 |
21 |
22 | // labelPart() proxy
23 |
24 | SyntaxElementMorph.prototype.originalLabelPart = SyntaxElementMorph.prototype.labelPart;
25 | SyntaxElementMorph.prototype.labelPart = function(spec) {
26 | var part,
27 | block = this;
28 |
29 | switch (spec) {
30 | case '%servoValue':
31 | part = new InputSlotMorph(
32 | null,
33 | false,
34 | {
35 | 'angle (0-180)' : 90,
36 | 'stopped' : ['stopped'],
37 | 'clockwise' : ['clockwise'],
38 | 'counter-clockwise' : ['counter-clockwise'],
39 | 'disconnected' : ['disconnected']
40 | }
41 | );
42 | break;
43 | case '%pinMode':
44 | part = new InputSlotMorph(
45 | null,
46 | false,
47 | {
48 | 'digital input' : ['digital input'],
49 | 'digital output' : ['digital output'] ,
50 | 'PWM' : ['PWM'],
51 | 'servo' : ['servo']
52 | },
53 | true
54 | );
55 | break;
56 | case '%servoPin':
57 | part = new InputSlotMorph(
58 | null,
59 | true,
60 | function() {
61 | return pinsSettableToMode('servo');
62 | }
63 | );
64 | break;
65 | case '%pwmPin':
66 | part = new InputSlotMorph(
67 | null,
68 | true,
69 | function() {
70 | return pinsSettableToMode('pwm');
71 | }
72 | );
73 | break;
74 | case '%analogPin':
75 | part = new InputSlotMorph(
76 | null,
77 | true,
78 | function() {
79 | return pinsSettableToMode('analog');
80 | }
81 | );
82 | part.originalChanged = part.changed;
83 | part.changed = function () { part.originalChanged(); if (block.toggle) { block.toggle.refresh(); } };
84 | break;
85 | case '%digitalPin':
86 | part = new InputSlotMorph(
87 | null,
88 | true,
89 | function() {
90 | return pinsSettableToMode('digital');
91 | }
92 | );
93 | part.originalChanged = part.changed;
94 | part.changed = function () { part.originalChanged(); if (block.toggle) { block.toggle.refresh(); } };
95 | break;
96 | default:
97 | part = this.originalLabelPart(spec);
98 | }
99 | return part;
100 | };
101 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/root/linino/gui.js:
--------------------------------------------------------------------------------
1 | ../../../../web/chromium/root/plugin/gui.js
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/root/linino/linino.js:
--------------------------------------------------------------------------------
1 | // Linino WebSockets protocol
2 |
3 | WorldMorph.prototype.initWebsockets = function () {
4 | var myself = this;
5 |
6 | this.ws = new WebSocket('ws://' + window.location.hostname + ':8888');
7 |
8 | this.ws.binaryType = 'arraybuffer';
9 |
10 | this.ws.onmessage = function (evt) {
11 | if (!WorldMorph.prototype.board) {
12 | WorldMorph.prototype.initBoard(JSON.parse(evt.data));
13 | } else {
14 | try {
15 | var data = JSON.parse(evt.data);
16 | world.board.pins[data[0]].value = data[1];
17 | } catch (err) {
18 | console.error('Unparseable message!\n' + evt.data + '\n' + err);
19 | return;
20 | }
21 | }
22 | };
23 |
24 | this.ws.onclose = function () {
25 | ide.confirm(
26 | 'WebSockets connection dropped!\nDo you wish to try to reconnect?',
27 | 'Connection error',
28 | function () {
29 | myself.ws.onclose = nop;
30 | myself.initWebsockets();
31 | }
32 | );
33 | };
34 |
35 | };
36 |
37 | WorldMorph.prototype.send = function (array) {
38 | this.ws.send(new Uint8Array(array).buffer);
39 | };
40 |
41 | WorldMorph.prototype.initBoard = function (pinConfig) {
42 | var myself = this;
43 |
44 | this.board = {
45 | pins: [
46 | { supportedModes: [] },
47 | { supportedModes: [] }
48 | ]
49 | };
50 |
51 | Object.keys(pinConfig.digital).forEach(
52 | function (each) {
53 | if (each === Number(each).toString()) {
54 | myself.board.pins[Number(each)] = { supportedModes: ['digital'] };
55 | }
56 | });
57 |
58 | myself.board.analogPins = Object.keys(pinConfig.analog).filter(
59 | function (pinName) {
60 | myself.board.pins['A' + Number(pinName)] = { supportedModes: ['analog'] };
61 | return pinName === Number(pinName).toString();
62 | });
63 |
64 | ['servo', 'pwm'].forEach(function (modeName) {
65 | Object.keys(pinConfig[modeName]).forEach(
66 | function (each) {
67 | if (each === Number(each).toString()) {
68 | myself.board.pins[Number(each)].supportedModes.push(modeName);
69 | }
70 | });
71 | });
72 | };
73 |
74 | WorldMorph.prototype.originalInit = WorldMorph.prototype.init;
75 | WorldMorph.prototype.init = function (aCanvas, fillPage) {
76 | this.originalInit(aCanvas, fillPage);
77 | this.initWebsockets();
78 | };
79 |
80 | Arduino = nop;
81 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/root/linino/objects.js:
--------------------------------------------------------------------------------
1 | // blockTemplates decorator
2 |
3 | SpriteMorph.prototype.blockTemplates = function(category) {
4 | var myself = this;
5 |
6 | var blocks = myself.originalBlockTemplates(category);
7 |
8 | function arduinoWatcherToggle (selector) {
9 | if (StageMorph.prototype.hiddenPrimitives[selector]) {
10 | return null;
11 | }
12 | var info = SpriteMorph.prototype.blocks[selector];
13 |
14 | return new ToggleMorph(
15 | 'checkbox',
16 | this,
17 | function () {
18 | var reporter = detect(blocks, function (each) {
19 | return (each.selector === selector)
20 | }),
21 | pin = reporter.inputs()[0].contents().text;
22 |
23 | if (!pin) { return };
24 |
25 | myself.arduinoWatcher(
26 | selector,
27 | localize(info.spec),
28 | myself.blockColor[info.category],
29 | pin
30 | );
31 | },
32 | null,
33 | function () {
34 | var reporter = detect(blocks, function (each) {
35 | return (each && each.selector === selector)
36 | });
37 |
38 | return reporter &&
39 | myself.showingArduinoWatcher(selector, reporter.inputs()[0].contents().text);
40 | },
41 | null
42 | );
43 | };
44 |
45 | function blockBySelector (selector) {
46 | var newBlock = SpriteMorph.prototype.blockForSelector(selector, true);
47 | newBlock.isTemplate = true;
48 | return newBlock;
49 | };
50 |
51 | var analogToggle = arduinoWatcherToggle('reportAnalogReading'),
52 | reportAnalog = blockBySelector('reportAnalogReading'),
53 | digitalToggle = arduinoWatcherToggle('reportDigitalReading'),
54 | reportDigital = blockBySelector('reportDigitalReading');
55 |
56 | if (reportAnalog) {
57 | reportAnalog.toggle = analogToggle;
58 | }
59 |
60 | if (reportDigital) {
61 | reportDigital.toggle = digitalToggle;
62 | }
63 |
64 | if (category === 'arduino') {
65 | blocks.push(blockBySelector('servoWrite'));
66 | blocks.push(blockBySelector('digitalWrite'));
67 | blocks.push(blockBySelector('pwmWrite'));
68 | blocks.push('-');
69 | blocks.push(analogToggle);
70 | blocks.push(reportAnalog);
71 | blocks.push(digitalToggle);
72 | blocks.push(reportDigital);
73 | } else if (category === 'other') {
74 | button = new PushButtonMorph(
75 | null,
76 | function () {
77 | var ide = myself.parentThatIsA(IDE_Morph),
78 | stage = myself.parentThatIsA(StageMorph);
79 | new BlockDialogMorph(
80 | null,
81 | function (definition) {
82 | if (definition.spec !== '') {
83 | if (definition.isGlobal) {
84 | stage.globalBlocks.push(definition);
85 | } else {
86 | myself.customBlocks.push(definition);
87 | }
88 | ide.flushPaletteCache();
89 | ide.refreshPalette();
90 | new BlockEditorMorph(definition, myself).popUp();
91 | }
92 | },
93 | myself
94 | ).prompt(
95 | 'Make a block',
96 | null,
97 | myself.world()
98 | );
99 | },
100 | 'Make a block'
101 | );
102 | button.selector = 'addCustomBlock';
103 | button.showHelp = BlockMorph.prototype.showHelp;
104 | blocks.push(button);
105 | }
106 |
107 | return blocks;
108 | };
109 |
110 | // Needed for updating watchers
111 |
112 | SpriteMorph.prototype.reportAnalogReading = Process.prototype.reportAnalogReading;
113 | SpriteMorph.prototype.reportDigitalReading = Process.prototype.reportDigitalReading;
114 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/root/linino/store.js:
--------------------------------------------------------------------------------
1 | SnapSerializer.prototype.app = 'Snap4Linino http://s4a.cat/snap';
2 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/root/linino/threads.js:
--------------------------------------------------------------------------------
1 | /*
2 | Command keys are ints because we need to cut bottlenecks everywhere.
3 |
4 | 0 → digital write
5 | 1 → analog write
6 | 2 → servo write
7 | 3 → digital read
8 | 4 → analog read
9 | 5 → set pin mode
10 |
11 | */
12 |
13 | Process.prototype.digitalWrite = function (pin, booleanValue) {
14 | world.send([0, pin, booleanValue ? 1 : 0]);
15 | };
16 |
17 | Process.prototype.pwmWrite = function (pin, value) {
18 | world.send([1, pin, value]);
19 | };
20 |
21 | Process.prototype.servoWrite = function (pin, value) {
22 | world.send([2, pin, value]);
23 | };
24 |
25 | Process.prototype.reportDigitalReading = function (pin) {
26 | if (!pin) { return false };
27 | world.send([3, pin]);
28 | return world.board.pins[pin].value || false;
29 | };
30 |
31 | Process.prototype.reportAnalogReading = function (pin) {
32 | if (!pin) { return 0 };
33 | world.send([4, pin]);
34 | return world.board.pins['A' + pin].value || 0;
35 | };
36 |
37 | Process.prototype.setPinMode = function (pin, mode) {
38 | world.send([5, pin, mode]);
39 | };
40 |
41 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/super_root/README.md:
--------------------------------------------------------------------------------
1 | # Snap4Arduino command line interpreter
2 | Command line Snap4Arduino interpreter. You feed it an XML project file and it runs it
3 |
4 | ## Installation
5 |
6 | ### Preparing the repo
7 |
8 | First of all, clone this repo:
9 |
10 | ```
11 | $ git clone https://github.com/bromagosa/snap-interpreter.git
12 | ```
13 |
14 | Cd into its root folder and install dependencies according to your needs:
15 |
16 | ```
17 | $ cd snap-interpreter
18 | ```
19 |
20 | If you need Snap4Arduino compatibility:
21 |
22 | ```
23 | $ npm install firmata
24 | ```
25 |
26 | If you want to have full Canvas support to be able to stream your stage over HTTP:
27 |
28 | ```
29 | $ npm install canvas
30 | ```
31 |
32 | If npm fails to install canvas, you may need to install its prerequisites. In Debian/Raspbian, this should suffice:
33 |
34 | ```
35 | # apt-get install g++ build-essential libgif-dev libpango1.0-dev libjpeg-dev libcairo2-dev
36 | ```
37 |
38 | Note that you'll need Node 0.10.4x or higher. Follow instructions from https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
39 |
40 | For other systems, please refer to https://github.com/Automattic/node-canvas#installation
41 |
42 | ### System-wide installation
43 |
44 | _If you don't want to perform a system-wide install, just clone Snap4Arduino and move its ``snap`` folder into the ``snap-interpreter`` root folder._
45 |
46 | To install the snap-interpreter in your system, just run the ``install.sh`` script with root privileges.
47 |
48 | ```
49 | # ./install.sh
50 | ```
51 |
52 | You can now call ``snap.js`` from anywhere in your system to run any Snap! XML exported project.
53 |
54 | ## Usage
55 |
56 | ```
57 | snap.js yourProject.xml [--plain-snap] [--canvas] [--serve] [/path/to/serial]
58 | Runs a Berkeley Snap! project or a Snap4Arduino one on the command line.
59 |
60 | --plain-snap
61 | Runs a plain Snap! project with no Arduino capabilities.
62 | --linino
63 | Uses the LininoIO library for communication with the Arduino instead of Firmata.
64 | Meant to be used in boards with embedded GNU/Linux inside (Tian, Yun, etc).
65 | If a serial port is specified, this setting will have no effect.
66 | --canvas
67 | Renders the Stage in an HTTP-streamable canvas. Automatically adds «--serve».
68 | --serve
69 | Starts a simple HTTP server at port 42001 with the following entry points:
70 | http://[IP]:42001/stage
71 | Streams the Stage in real time. Needs «--canvas».
72 | http://[IP]:42001/broadcast=[message]
73 | Broadcasts «message» to Snap! so it can be captured by «When I receive» hat blocks.
74 | http://[IP]:42001/send-messages
75 | Lists all messages being used in the Snap! program.
76 | http://[IP]:42001/send-vars
77 | Lists all variables being used in the Snap! program.
78 | http://[IP]:42001/vars-update=[variable]=[value]
79 | Sets the Snap! variable «variable» to «value».
80 | ```
81 |
82 | Console outputs the result of *say*, *think* and *ask* blocks, all messages given by the UI and the contents of the stage via a tiny webserver accessible at http://[your-ip]:42001/stage.
83 |
84 | ## Third party NodeJS packages:
85 | * [node-canvas](https://github.com/Automattic/node-canvas) _(only with ``--canvas`` flag active)_
86 | * [firmata](https://github.com/jgautier/firmata) _(if you need Snap4Arduino compatibility)_
87 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/super_root/canvas.js:
--------------------------------------------------------------------------------
1 | // Let's tweak some files a bit (really dirty stuff!)
2 |
3 | try {
4 | if (!fs.readFileSync('node_modules/canvas/lib/context2d.js', {encoding: 'utf-8'}).match('SNAP4ARDUINO')) {
5 | fs.appendFileSync('node_modules/canvas/lib/context2d.js','\n\n// ADDED BY SNAP4ARDUINO\n\nCanvasGradient.prototype.oldAddColorStop = CanvasGradient.prototype.addColorStop;\nCanvasGradient.prototype.addColorStop = function(where, color) {\n\tthis.oldAddColorStop(where, color.toString());\n};');
6 | }
7 |
8 | if (!fs.readFileSync('node_modules/canvas/lib/canvas.js', {encoding: 'utf-8'}).match('SNAP4ARDUINO')) {
9 | fs.appendFileSync('node_modules/canvas/lib/canvas.js','\n\n// ADDED BY SNAP4ARDUINO\n\nCanvas.prototype.addEventListener = function() {};\nCanvas.prototype.focus = function() {};');
10 | }
11 | } catch (err) {
12 |
13 | }
14 |
15 | Canvas = include('canvas');
16 | HTMLCanvasElement = Canvas;
17 | Image = Canvas.Image;
18 | canvas = new Canvas(200, 200);
19 |
20 | CanvasRenderingContext2D = Canvas.Context2d;
21 |
22 | // Oh, you miss your DOM, don't you?
23 |
24 | document = {
25 | createElement: function(elementName) {
26 | if (elementName === 'canvas') {
27 | return new Canvas(200, 200);
28 | } else {
29 | console.error('I don\'t know how to make a ' + elementName);
30 | }
31 | },
32 | body: {
33 | addEventListener: function() {}
34 | }
35 | };
36 |
37 | window = {
38 | addEventListener: function() {}
39 | };
40 |
41 | location = {
42 | hash: ''
43 | }
44 |
45 | localStorage = null;
46 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/super_root/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if find . | grep "Canvas.h"; then
3 | echo "Preparing node-canvas..."
4 | if ! grep SNAP4ARDUINO node_modules/canvas/lib/context2d.js; then
5 | echo '\n\n// ADDED BY SNAP4ARDUINO\n\nCanvasGradient.prototype.oldAddColorStop = CanvasGradient.prototype.addColorStop;\nCanvasGradient.prototype.addColorStop = function(where, color) {\n\tthis.oldAddColorStop(where, color.toString());\n};' >> node_modules/canvas/lib/context2d.js
6 | fi
7 |
8 | if ! grep SNAP4ARDUINO node_modules/canvas/lib/canvas.js; then
9 | echo '\n\n// ADDED BY SNAP4ARDUINO\n\nCanvas.prototype.addEventListener = function() {};\nCanvas.prototype.focus = function() {};' >> node_modules/canvas/lib/canvas.js
10 | fi
11 | fi
12 |
13 | echo "Installing Snap! interpreter at /usr/share/snap-interpreter"
14 |
15 | rm -Rf /usr/share/snap-interpreter
16 | mkdir /usr/share/snap-interpreter
17 | cp -R * /usr/share/snap-interpreter
18 |
19 | echo "Creating snap.js symlink"
20 |
21 | rm /usr/bin/snap.js
22 | ln -s /usr/share/snap-interpreter/snap.js /usr/bin/snap.js
23 |
24 | if [ ! `command -v snap.js` ]; then
25 | (>&2 echo "Symlink creation failed, installation may not have succeeded");
26 | exit 1;
27 | fi
28 |
29 | echo "Installation done!"
30 | snap.js --help
31 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/super_root/listen.js:
--------------------------------------------------------------------------------
1 | var SnapListener,
2 | portArgument = process.argv.filter(function (any) { return Number(any).toString() === any.toString(); });
3 |
4 | function SnapListener (port) {
5 | this.init(port);
6 | };
7 |
8 | SnapListener.prototype.init = function (port) {
9 | var myself = this;
10 |
11 | this.httpServer = require('http').createServer(
12 | function(request, response) {
13 | myself.handleHTTPRequest(request, response);
14 | });
15 | this.httpServer.setTimeout(500);
16 |
17 | this.listening = false;
18 |
19 | if (port) {
20 | this.listen(port);
21 | }
22 | };
23 |
24 | SnapListener.prototype.listen = function (port) {
25 | var myself = this;
26 |
27 | this.httpServer.listen(
28 | port,
29 | function() {
30 | myself.listening = true;
31 | console.log('Listening for Snap! projects at ' + port);
32 | });
33 | };
34 |
35 | SnapListener.prototype.shutdown = function () {
36 | var myself = this;
37 |
38 | console.log('Shutting down listener...');
39 | this.httpServer.close(
40 | function () {
41 | myself.listening = false;
42 | console.log('No longer istening for Snap! projects.');
43 | });
44 | };
45 |
46 | SnapListener.prototype.handleHTTPRequest = function (request, response) {
47 | var myself = this;
48 |
49 | if (!this.listening) { return; };
50 |
51 | response.setHeader('Access-Control-Allow-Origin', '*');
52 |
53 | if (request.method === 'POST') {
54 |
55 | var body = '';
56 |
57 | request.addListener('data', function (chunk) {
58 | body += chunk;
59 | });
60 |
61 | request.addListener('end', function (chunk) {
62 | if (chunk) {
63 | body += chunk;
64 | }
65 | myself.saveFile(body, response);
66 | });
67 |
68 | }
69 | };
70 |
71 | SnapListener.prototype.saveFile = function (contents, response) {
72 | try {
73 | require('fs').writeFile(process.env['HOME'] + '/autorun.xml', contents, function (err) {
74 | response.statusCode = err ? 500 : 200;
75 | response.end(err || 'Project received by the board.');
76 | });
77 | } catch (err) {
78 | console.log(err);
79 | response.statusCode = 500;
80 | response.end(err);
81 | }
82 | };
83 |
84 | listener = new SnapListener(portArgument.length > 0 ? portArgument[0] : 8080);
85 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/super_root/nodify.js:
--------------------------------------------------------------------------------
1 | // I take care of overriding everything related to graphics, the DOM, the browser,
2 | // HTML5 Canvases and whatnot.
3 |
4 | localStorage = null;
5 |
6 | function nop() { return null };
7 |
8 | Object.originalDefineProperty = Object.defineProperty;
9 | Object.defineProperty = function (obj, prop, descriptor) {
10 | if (obj.isBogus) {
11 | return;
12 | } else {
13 | this.originalDefineProperty(obj, prop, descriptor);
14 | }
15 | };
16 |
17 | var bogusObject = {
18 | data: [0,0,0,0],
19 | width: 0,
20 | height: 0,
21 | shadowOffsetX: 0,
22 | shadowOffsetY: 0,
23 | shadowBlur: 0,
24 | addColorStop: nop,
25 | isBogus: true
26 | }
27 |
28 | function Canvas(width, height) {
29 | this.width = width;
30 | this.height = height;
31 | this.isFake = true;
32 | this.context = new FakeContext(width, height);
33 | };
34 |
35 | Canvas.prototype = bogusObject;
36 |
37 | Canvas.prototype.getContext = function() {
38 | return this.context;
39 | };
40 |
41 | Canvas.prototype.addEventListener = nop;
42 |
43 | function FakeContext(width, height) {
44 | this.width = width;
45 | this.height = height;
46 | this.isFake = true;
47 | };
48 |
49 | FakeContext.prototype = bogusObject;
50 |
51 | document = {
52 | createElement: function(elementName) {
53 | if (elementName === 'canvas') {
54 | return new Canvas(10, 10);
55 | } else {
56 | console.error('I don\'t know how to make a ' + elementName);
57 | }
58 | },
59 | body: {
60 | addEventListener: nop
61 | }
62 | };
63 |
64 | var nullableFunctions = [
65 | 'arc',
66 | 'beginPath',
67 | 'bezierCurveTo',
68 | 'clearRect',
69 | 'clip',
70 | 'closePath',
71 | 'drawImage',
72 | 'fill',
73 | 'fillRect',
74 | 'fillText',
75 | 'lineTo',
76 | 'moveTo',
77 | 'quadraticCurveTo',
78 | 'restore',
79 | 'save',
80 | 'scale',
81 | 'stroke',
82 | 'toDataURL',
83 | 'translate'
84 | ];
85 |
86 | var bogusableFunctions = [
87 | 'createLinearGradient',
88 | 'createRadialGradient',
89 | 'getImageData',
90 | 'measureText'
91 | ];
92 |
93 | nullableFunctions.forEach(function(each){
94 | FakeContext.prototype[each] = nop;
95 | });
96 |
97 | bogusableFunctions.forEach(function(each){
98 | FakeContext.prototype[each] = function() { return bogusObject };
99 | })
100 |
101 | function Image() {};
102 |
103 | HTMLCanvasElement = Canvas;
104 | CanvasRenderingContext2D = FakeContext;
105 |
106 | canvas = new Canvas();
107 |
108 | window = { addEventListener: nop };
109 |
110 | location = { hash: '' };
111 |
112 | function enableRetinaSupport () {}
113 |
114 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/super_root/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "s4a.html",
3 | "name": "Snap4Arduino",
4 | "description": "Snap4Arduino",
5 | "license": "AGPL-3.0",
6 | "repository": "https://github.com/bromagosa/Snap4Arduino",
7 | "window": {
8 | "title": "Snap4Arduino",
9 | "icon": "s4a.ico",
10 | "toolbar": false,
11 | "frame": true,
12 | "position": "mouse",
13 | "width": 960,
14 | "height": 640,
15 | "min_width": 960,
16 | "min_height": 640
17 | },
18 | "dependencies": {
19 | "firmata": "~0.3.3",
20 | "serialport": ">=0.7.5"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/platforms/embedded/cli/super_root/threads.js:
--------------------------------------------------------------------------------
1 | // In NodeJS we don't have XMLHttpRequests
2 | Process.prototype.reportURL = function (url) {
3 | var myself = this,
4 | response;
5 |
6 | if (!this.httpRequest) {
7 | this.httpRequest = include('http');
8 |
9 | this.httpRequest.request(
10 | 'http://' + url,
11 | function (response) {
12 | var str = '';
13 | response.on('data', function (chunk) {
14 | str += chunk;
15 | });
16 | response.on('end', function () {
17 | myself.httpResponse = str;
18 | myself.httpRequest = null;
19 | });
20 | }
21 | ).end();
22 | } else if (this.httpResponse) {
23 | response = this.httpResponse;
24 | this.httpResponse = null;
25 | return response;
26 | }
27 |
28 | this.pushContext('doYield');
29 | this.pushContext();
30 | };
31 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/build:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Based on Anders Evenrud's script for OS.js
3 |
4 | # First of all, build the CLI version
5 | ./build --platform=embedded/cli --keeptmp
6 |
7 | PWD="${0%/*}"
8 |
9 | if [ -z $ARCH ]
10 | then
11 | ARCH="ar71xx"
12 | fi
13 |
14 | VERSION="`cat src\/version`"
15 |
16 | mv tmp clitmp
17 | mkdir tmp
18 | mv clitmp tmp/cli_files
19 | mkdir tmp/ipkg_files
20 |
21 | PKGNAME="snap4arduino_${VERSION}_${ARCH}.ipk"
22 | SRCDIR="tmp/cli_files"
23 | OUTDIR="tmp/ipkg_files"
24 | PKGDIR="releases/packages"
25 |
26 | # Create package dirs
27 | mkdir -p $OUTDIR/ipkg/
28 | mkdir -p $OUTDIR/data/usr/share/snap4arduino
29 | mkdir -p $OUTDIR/data/usr/bin
30 | mkdir -p $OUTDIR/data/etc/init.d
31 |
32 | # Remove node_modules, they should be symlinked by postinst
33 | rm -r $SRCDIR/node_modules
34 |
35 | # Create data directory tree structure
36 | cp -R $SRCDIR/* $OUTDIR/data/usr/share/snap4arduino/.
37 |
38 | # Create control file and set version name
39 | sed -E 's/^Version.*/Version: v'`cat src\/version`'/' $PWD/src/templates/ipkg-control > $OUTDIR/ipkg/control
40 |
41 | # Add custom scripts
42 | cp $PWD/src/templates/post* $OUTDIR/ipkg/
43 | cp $PWD/src/templates/prerm $OUTDIR/ipkg/
44 |
45 | # Generic build script arrives late to the party, we need to do the copying ourselves here
46 | cp -R $PWD/root/* $OUTDIR/data/usr/share/snap4arduino/.
47 |
48 | # Add daemon script
49 | cp $PWD/src/templates/daemon.sh $OUTDIR/data/etc/init.d/snap4arduino-daemon
50 |
51 | # Create control package
52 | tar -C $OUTDIR/ipkg -czf $OUTDIR/control.tar.gz ./control ./prerm ./postinst ./postinst-pkg ./postrm
53 |
54 | # Create data image
55 | tar -C $OUTDIR/data -czf $OUTDIR/data.tar.gz ./usr ./etc
56 |
57 | # Create debian binary file
58 | echo "2.0" > $OUTDIR/debian-binary
59 |
60 | # Create ipkg
61 | tar -C $OUTDIR -cz ./debian-binary ./data.tar.gz ./control.tar.gz > $PKGDIR/$PKGNAME
62 |
63 | # Clean up
64 | #rm -rf $OUTDIR/ipkg
65 | #rm -rf $OUTDIR/data
66 | #rm $OUTDIR/debian-binary
67 | #rm $OUTDIR/data.tar.gz
68 | #rm $OUTDIR/control.tar.gz
69 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/root/daemon.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs'),
2 | cp = require('child_process'),
3 | logMode = process.argv.indexOf('--log') > -1,
4 | print = logMode ?
5 | function (str) { fs.appendFileSync('/var/log/snap4arduino', str + '\n'); } :
6 | function () {};
7 |
8 | // Unless instructed to run in foreground, we fork ourselves and behave like a daemon
9 |
10 | if (process.argv.indexOf('--fg') === -1) {
11 | console.log('starting daemon...');
12 | require('daemon')();
13 | console.log('daemon started');
14 | } else {
15 | console.log('running in foreground');
16 | print = function (str) { console.log(str) };
17 | }
18 |
19 | // Let's first check whether there's an autorunnable Snap! project
20 |
21 | if (fs.existsSync('/root/autorun.xml')) {
22 | console.log('Found autorunnable Snap4Arduino project, attempting to run it');
23 | var proc = cp.exec('snap4arduino --linino /root/autorun.xml');
24 | proc.stdout.on('data', print);
25 | proc.stderr.on('data', print);
26 | proc.on('close', function (code) { print('Snap4Arduino process stopped with exit code ' + code); });
27 | }
28 |
29 |
30 | // If passed the --ws argument, we start the websockets listener... listener?
31 |
32 | if (process.argv.indexOf('--ws') > -1) {
33 | var wsStart;
34 | wsStart = function () {
35 | cp.execFile(
36 | 'ps',
37 | function (err, stdout, stderr) {
38 | if (stdout.indexOf('ws.js') === -1) {
39 | console.log('Websockets listener not running');
40 | var proc = cp.execFile('node', ['/usr/share/snap4arduino/ws.js']);
41 | proc.stdout.on('data', print);
42 | proc.stderr.on('data', print);
43 | proc.on('close', function (code) {
44 | print('WebSockets listener stopped with exit code ' + code);
45 | print('Will restart at next check');
46 | });
47 | }
48 | });
49 | };
50 |
51 | setInterval(wsStart, 2500);
52 | }
53 |
54 |
55 | // And if passed the --listen argument, we start the project listener... listener?
56 |
57 | if (process.argv.indexOf('--listen') > -1) {
58 | var listenerStart;
59 | listenerStart = function () {
60 | cp.execFile(
61 | 'ps',
62 | function (err, stdout, stderr) {
63 | print('Checking whether project listener is running...');
64 | if (stdout.indexOf('listen.js') === -1) {
65 | console.log('Project listener not running');
66 | var proc = cp.execFile('node', ['/usr/share/snap4arduino/listen.js']);
67 | proc.stdout.on('data', print);
68 | proc.stderr.on('data', print);
69 | proc.on('close', function (code) {
70 | print('Project listener stopped with exit code ' + code);
71 | print('Will restart at next check');
72 | });
73 | }
74 | });
75 | };
76 |
77 | setInterval(listenerStart, 2500);
78 | }
79 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/src/templates/daemon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh /etc/rc.common
2 | # Snap4Arduino daemon script
3 | # description: I check for an autorunnable Snap4Arduino project on startup,
4 | # and run it if I can. I also make sure the websockets server is
5 | # always up.
6 | # processname: snap4arduino-daemon
7 |
8 | START=99
9 | EXTRA_COMMANDS="status"
10 |
11 | DAEMON_PATH="/usr/share/snap4arduino"
12 |
13 | DAEMON="node daemon.js"
14 | DAEMONOPTS="--ws --log --listen"
15 |
16 | NAME=snap4arduino-daemon
17 | DESC="Snap4Arduino daemon"
18 | PIDFILE=/var/run/$NAME.pid
19 | SCRIPTNAME=/etc/init.d/$NAME
20 |
21 | start() {
22 | printf "%-50s" "Starting $NAME..."
23 |
24 | if [ -f $PIDFILE ]; then
25 | printf "%-50s" "Found an instance of $NAME. Killing it before firing up a new one..."
26 | PID=`cat $PIDFILE`
27 | cd $DAEMON_PATH
28 | kill -HUP $PID
29 | printf "%s\n" "Ok"
30 | rm -f $PIDFILE
31 | fi
32 |
33 | cd $DAEMON_PATH
34 | PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
35 | if [ -z $PID ]; then
36 | printf "%s\n" "Fail"
37 | else
38 | echo $PID > $PIDFILE
39 | printf "%s\n" "Ok"
40 | fi
41 | }
42 |
43 | status() {
44 | printf "%-50s" "Checking $NAME..."
45 | if [ -f $PIDFILE ]; then
46 | PID=`cat $PIDFILE`
47 | if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
48 | printf "%s\n" "Process dead but pidfile exists"
49 | else
50 | echo "Running"
51 | fi
52 | else
53 | printf "%s\n" "Service not running"
54 | fi
55 | }
56 |
57 | stop() {
58 | printf "%-50s" "Stopping $NAME"
59 | PID=`cat $PIDFILE`
60 | cd $DAEMON_PATH
61 | if [ -f $PIDFILE ]; then
62 | kill -HUP $PID
63 | printf "%s\n" "Ok"
64 | rm -f $PIDFILE
65 | else
66 | printf "%s\n" "pidfile not found"
67 | fi
68 | }
69 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/src/templates/ipkg-control:
--------------------------------------------------------------------------------
1 | Package: snap4arduino
2 | Version: CHANGEME
3 | Depends: libc, node, node-canvas, node-firmata, node-ws, node-ideino-linino-lib, node-es6-shim
4 | Source: package/linino/snap4arduino
5 | Section: lang
6 | Architecture: ar71xx
7 | Installed-Size: 16604029
8 | Description: Program the virtual and physical world with Snap4Arduino.
9 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/src/templates/postinst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | [ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
3 | . ${IPKG_INSTROOT}/lib/functions.sh
4 | default_postinst $0 $@
5 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/src/templates/postinst-pkg:
--------------------------------------------------------------------------------
1 | if [ -d /usr/share/snap4arduino ]
2 | then
3 | ln -fs /usr/share/snap4arduino/snap.js /usr/bin/snap4arduino
4 | ln -fs /usr/lib/node_modules /usr/share/snap4arduino/node_modules
5 | ln -fs /usr/share/snap4arduino/snap /osjs/dist/snap
6 | fi
7 |
8 | if [ -z "`lininoio -s | grep ENABLED`" ]
9 | then
10 | lininoio start -f
11 | fi
12 |
13 | chmod +x /etc/init.d/snap4arduino-daemon
14 |
15 | if [ -e /sys/class/gpio/SCK/ ]
16 | then
17 | echo "==============================================================="
18 | echo "= WARNING! OLD BATHOS! ="
19 | echo "==============================================================="
20 | echo "Your BathOS is too old!"
21 | echo "Snap4Arduino won't be able to work through the lininoio library"
22 | echo "Please update your BathOS to a newer version"
23 | echo "==============================================================="
24 | fi
25 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/src/templates/postrm:
--------------------------------------------------------------------------------
1 | if [ -d /usr/share/snap4arduino ]
2 | then
3 | rm -rf /usr/share/snap4arduino
4 | rm -rf /osjs/dist/snap
5 | rm /usr/bin/snap4arduino
6 | fi
7 |
--------------------------------------------------------------------------------
/src/platforms/embedded/ipkg/src/templates/prerm:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . ${IPKG_INSTROOT}/lib/functions.sh
3 | default_prerm $0 $@
4 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/mobile/android/.buildme
--------------------------------------------------------------------------------
/src/platforms/mobile/android/build:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Particular build script for Android
4 |
5 | echo
6 | echo "======="
7 | echo "Reorganizing directory tree"
8 | echo "======="
9 | echo
10 |
11 | mv tmp tmp_www
12 | mkdir tmp
13 |
14 | echo "======="
15 | echo "Creating Cordova application skeleton..."
16 | echo "======="
17 | echo
18 |
19 | cd tmp
20 | cordova create Snap4Arduino
21 | cd Snap4Arduino
22 | cordova platform remove android
23 | cordova platform add android@5.2.2
24 | cordova plugin add http://github.com/don/cordova-filechooser.git
25 | mv ../../tmp_www/* www
26 | cd ../../
27 | rm -r tmp_www
28 |
29 | echo
30 | echo "======="
31 | echo "Setting heap size..."
32 | echo "======="
33 | echo
34 |
35 | cp src/platforms/mobile/android/build-extras.gradle tmp/Snap4Arduino/platforms/android
36 |
37 | echo
38 | echo "======="
39 | echo "Setting version name..."
40 | echo "======="
41 | echo
42 |
43 | sed -E 's/^\s*version.*/ version="'`cat src\/version`'"/' src/platforms/mobile/android/config.xml > tmp/Snap4Arduino/config.xml
44 |
45 | echo
46 | echo "======="
47 | echo "Asking Cordova to build Snap4Arduino for Android"
48 | echo "======="
49 | echo
50 |
51 | rm -rf releases/mobile/android
52 | mkdir -p releases/mobile/android
53 | cd tmp/Snap4Arduino
54 | cordova build
55 | #mv platforms/android/build/outputs/apk/android-debug.apk ../../releases/mobile/android/Snap4Arduino.apk
56 | mv platforms/android/build/outputs/apk/android-armv7-debug.apk ../../releases/mobile/android/Snap4Arduino.apk
57 | cd ../..
58 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/build-extras.gradle:
--------------------------------------------------------------------------------
1 | android {
2 | dexOptions {
3 | javaMaxHeapSize "2048m"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Snap4Arduino
8 |
9 | Snap4Arduino for Android
10 |
11 |
12 | Bernat Romagosa - Arduino.org
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Snap4Arduino @AppVersion
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/mobile/arduino.js:
--------------------------------------------------------------------------------
1 | Arduino.prototype.attemptConnection = function () {
2 | var myself = this,
3 | networkPortsEnabled = Arduino.prototype.networkPortsEnabled;
4 |
5 | if (!this.connecting) {
6 | if (this.board === undefined) {
7 | // Get list of ports (Arduino compatible)
8 | world.Arduino.getSerialPorts(function (ports) {
9 | var portMenu = new MenuMorph(this, 'select a port'),
10 | portCount = Object.keys(ports).length;
11 |
12 | if (portCount >= 1) {
13 | Object.keys(ports).forEach(function (each) {
14 | portMenu.addItem(each, function () {
15 | myself.connect(ports[each]);
16 | })
17 | });
18 | }
19 | if (networkPortsEnabled) {
20 | portMenu.addLine();
21 | portMenu.addItem('Network port', function () {
22 | myself.networkDialog();
23 | });
24 | }
25 | if (networkPortsEnabled || portCount > 1) {
26 | portMenu.popUpAtHand(world);
27 | } else if (!networkPortsEnabled && portCount === 1) {
28 | myself.connect(ports[0]);
29 | }
30 | });
31 | } else {
32 | ide.inform(myself.name, localize('There is already a board connected to this sprite'));
33 | }
34 | }
35 |
36 | if (this.justConnected) {
37 | this.justConnected = undefined;
38 | return;
39 | }
40 | };
41 |
42 | Arduino.prototype.closeHandler = function (silent) {
43 |
44 | var portName = 'unknown';
45 |
46 | clearInterval(this.keepAliveIntervalID);
47 |
48 | if (this.board) {
49 | portName = this.board.sp.path;
50 |
51 | this.board.sp = undefined;
52 |
53 | this.board = undefined;
54 | };
55 |
56 | Arduino.unlockPort(this.port);
57 | this.connecting = false;
58 | this.disconnecting = false;
59 |
60 | if (this.gotUnplugged & !silent) {
61 | ide.inform(
62 | this.owner.name,
63 | localize('Board was disconnected from port\n')
64 | + portName
65 | + '\n\nIt seems that someone pulled the cable!');
66 | this.gotUnplugged = false;
67 | } else if (!silent) {
68 | ide.inform(this.owner.name, localize('Board was disconnected from port\n') + portName);
69 | }
70 | };
71 |
72 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/mobile/blocks.js:
--------------------------------------------------------------------------------
1 | BlockMorph.prototype.originalJustDropped = BlockMorph.prototype.justDropped;
2 | BlockMorph.prototype.justDropped = function () {
3 | ide = world.children[0]; // ouch (>_<)'
4 | this.originalJustDropped();
5 | ide.shrinkStage();
6 | ide.hideGarbageBin();
7 | };
8 |
9 | BlockMorph.prototype.originalPrepareToBeGrabbed = BlockMorph.prototype.prepareToBeGrabbed;
10 | BlockMorph.prototype.prepareToBeGrabbed = function (hand) {
11 | ide = world.children[0]; // ouch (>_<)'
12 | this.originalPrepareToBeGrabbed(hand);
13 | ide.showGarbageBin();
14 | };
15 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/mobile/events.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | function EventEmitter() {}
4 |
5 | EventEmitter.prototype.on = function (name, callback) {
6 | if (!this.hasOwnProperty("_handlers")) this._handlers = {};
7 | var handlers = this._handlers;
8 | if (!handlers.hasOwnProperty(name)) handlers[name] = [];
9 | var list = handlers[name];
10 | list.push(callback);
11 | };
12 | EventEmitter.prototype.addListener = EventEmitter.prototype.on;
13 |
14 | EventEmitter.prototype.once = function (name, callback) {
15 | this.on(name, callback);
16 | this.on(name, remove);
17 | function remove() {
18 | this.off(name, callback);
19 | this.off(name, remove);
20 | }
21 | };
22 |
23 | EventEmitter.prototype.emit = function (name/*, args...*/) {
24 | if (!this.hasOwnProperty("_handlers")) return;
25 | var handlers = this._handlers;
26 | if (!handlers.hasOwnProperty(name)) return;
27 | var list = handlers[name];
28 | var args = Array.prototype.slice.call(arguments, 1);
29 | for (var i = 0, l = list.length; i < l; i++) {
30 | if (!list[i]) continue;
31 | list[i].apply(this, args);
32 | }
33 | }
34 |
35 | EventEmitter.prototype.off = function (name, callback) {
36 | if (!this.hasOwnProperty("_handlers")) return;
37 | var handlers = this._handlers;
38 | if (!handlers.hasOwnProperty(name)) return;
39 | var list = handlers[name];
40 | var index = list.indexOf(callback);
41 | if (index < 0) return;
42 | list[index] = false;
43 | if (index === list.length - 1) {
44 | while (index >= 0 && !list[index]) {
45 | list.length--;
46 | index--;
47 | }
48 | }
49 | };
50 | EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
51 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/mobile/mobile.js:
--------------------------------------------------------------------------------
1 | var firmata = {},
2 | require = function (moduleName) {
3 | // For now we're only requiring the Firmata module
4 | return { firmata: firmata }[moduleName];
5 | };
6 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/mobile/serialport.js:
--------------------------------------------------------------------------------
1 | // SerialPort wrapper for BluetoothSerial
2 |
3 | function SerialPort (port, options) {
4 | var self = this,
5 | reading = false;
6 |
7 | function onOpen (info) {
8 | if (info === 'OK') {
9 | self.path = port;
10 | self.emit('open');
11 | } else {
12 | console.log('can\'t connect to ', port);
13 | }
14 | };
15 |
16 | bluetoothSerial.connect(port, onOpen, function (err) { alert(err); });
17 | };
18 |
19 | SerialPort.prototype.on = function (evt, callback) {
20 | if (evt === 'data') {
21 | bluetoothSerial.subscribeRawData(
22 | function (rawData) {
23 | callback(new Uint8Array(rawData))
24 | },
25 | function () {
26 | console.log('Lost some data!');
27 | });
28 | }
29 | };
30 |
31 | SerialPort.prototype.write = function (data) {
32 | function onWrite (result) {
33 | }
34 | bluetoothSerial.write(data, onWrite, function (err) { console.log(err); });
35 | };
36 |
37 | SerialPort.prototype.close = function() {
38 | bluetoothSerial.disconnect();
39 | };
40 |
41 | util.inherits(SerialPort, EventEmitter);
42 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/mobile/util.js:
--------------------------------------------------------------------------------
1 | // tiny util.inherits shim.
2 |
3 | util = {};
4 |
5 | util.inherits = function (Class, Parent) {
6 | Class.prototype.__proto__ = Parent.prototype;
7 | };
8 |
9 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/plugin/arduino.js:
--------------------------------------------------------------------------------
1 | Arduino.prototype.attemptConnection = function () {
2 | var myself = this;
3 |
4 | if (!this.connecting) {
5 | if (this.board === undefined) {
6 | // Get list of ports (Arduino compatible)
7 | var ports = world.Arduino.getSerialPorts(function (ports) {
8 | var portMenu = new MenuMorph(this, 'select a port');
9 | if (Object.keys(ports).length >= 1) {
10 | Object.keys(ports).forEach(function (each) {
11 | portMenu.addItem(each, function () {
12 | myself.connect(each);
13 | })
14 | });
15 | }
16 | portMenu.popUpAtHand(world);
17 | });
18 | } else {
19 | ide.inform(myself.name, localize('There is already a board connected to this sprite'));
20 | }
21 | }
22 |
23 | if (this.justConnected) {
24 | this.justConnected = undefined;
25 | return;
26 | }
27 | };
28 |
29 | window.onunload = function (evt) {
30 | ide.sprites.asArray().forEach(function (each) { each.arduino.disconnect(true); });
31 | };
32 |
33 | Arduino.prototype.connect = function (port) {
34 | var myself = this;
35 |
36 | this.disconnect(true);
37 |
38 | this.showMessage(localize('Connecting board at port\n') + port);
39 | this.connecting = true;
40 |
41 | // Hyper convoluted due to the async nature of Firmata
42 | // Brace yourselves, you're about to dive into the Amazing Callback Vortex
43 | new world.Arduino.firmata.Board(port, function (boardId) {
44 | var board,
45 | retries = 0,
46 | boardReadyInterval = setInterval(
47 | function () {
48 | postal.sendCommand('getBoard', [ boardId ], function (board) {
49 | myself.board = board;
50 | if (board && board.versionReceived) {
51 | clearInterval(boardReadyInterval);
52 | // We need to populate the board with functions that make use of the browser plugin
53 | myself.populateBoard(myself.board);
54 |
55 | myself.keepAliveIntervalID = setInterval(function() { myself.keepAlive() }, 5000);
56 |
57 | // These should be handled at plugin side
58 | // myself.board.sp.on('disconnect', myself.disconnectHandler);
59 | // myself.board.sp.on('close', myself.closeHandler);
60 | // myself.board.sp.on('error', myself.errorHandler);
61 |
62 | world.Arduino.lockPort(port);
63 | myself.port = myself.board.sp.path;
64 | myself.connecting = false;
65 | myself.justConnected = true;
66 | myself.board.connected = true;
67 |
68 | myself.hideMessage();
69 | ide.inform(myself.owner.name, localize('An Arduino board has been connected. Happy prototyping!'));
70 | }
71 | });
72 |
73 | if (retries > 40) {
74 | clearInterval(boardReadyInterval);
75 | myself.board = null;
76 | myself.hideMessage();
77 | ide.inform(
78 | myself.owner.name,
79 | localize('Could not talk to Arduino in port\n')
80 | + port + '\n\n' + localize('Check if firmata is loaded.')
81 | );
82 | }
83 |
84 | retries ++;
85 | },
86 | 250);
87 | });
88 | };
89 |
90 | Arduino.prototype.populateBoard = function (board) {
91 | board.sp.close = postal.commandSender('closeSerial', board.id);
92 | board.sp.removeListener = nop;
93 |
94 | // pin is already converted to absolute position, we don't care whether it's analog or not
95 | board.pinMode = function (pin, mode) { postal.sendCommand('pinMode', [ board.id, pin, mode ], function() { board.pins[pin].mode = mode }) };
96 | board.digitalWrite = function (pin, value) { postal.sendCommand('digitalWrite', [ board.id, pin, value ]) };
97 | board.servoWrite = function (pin, value) { postal.sendCommand('servoWrite', [ board.id, pin, value ]) };
98 | board.analogWrite = function (pin, value) { postal.sendCommand('analogWrite', [ board.id, pin, value ]) };
99 | board.digitalRead = function (pin, callback) { postal.sendCommand('digitalRead', [ board.id, pin ], callback) };
100 | board.analogRead = function (pin, callback) { postal.sendCommand('analogRead', [ board.id, pin ], callback) };
101 | };
102 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/plugin/gui.js:
--------------------------------------------------------------------------------
1 | IDE_Morph.prototype.settingsMenu = IDE_Morph.prototype.originalSettingsMenu;
2 | IDE_Morph.prototype.getCostumesList = IDE_Morph.prototype.originalGetCostumesList;
3 |
4 | // Snap4Arduino logo
5 |
6 | IDE_Morph.prototype.createLogo = function () {
7 | var myself = this;
8 |
9 | if (this.logo) {
10 | this.logo.destroy();
11 | }
12 |
13 | this.logo = new Morph();
14 | this.logo.texture = 's4a_logo_sm.png'; // Overriden
15 | this.logo.drawNew = function () {
16 | this.image = newCanvas(this.extent());
17 | var context = this.image.getContext('2d'),
18 | gradient = context.createLinearGradient(
19 | 0,
20 | 0,
21 | this.width(),
22 | 0
23 | );
24 | gradient.addColorStop(0, 'black');
25 | gradient.addColorStop(0.5, myself.frameColor.toString());
26 | context.fillStyle = MorphicPreferences.isFlat ?
27 | myself.frameColor.toString() : gradient;
28 | context.fillRect(0, 0, this.width(), this.height());
29 | if (this.texture) {
30 | this.drawTexture(this.texture);
31 | }
32 | };
33 |
34 | this.logo.drawCachedTexture = function () {
35 | var context = this.image.getContext('2d');
36 | context.drawImage(
37 | this.cachedTexture,
38 | 5,
39 | Math.round((this.height() - this.cachedTexture.height) / 2)
40 | );
41 | this.changed();
42 | };
43 |
44 | this.logo.mouseClickLeft = function () {
45 | myself.snapMenu();
46 | };
47 |
48 | this.logo.color = new Color();
49 | this.logo.setExtent(new Point(200, 28)); // dimensions are fixed
50 | this.add(this.logo);
51 | };
52 |
53 | // Exporting
54 |
55 | IDE_Morph.prototype.exportProject = IDE_Morph.prototype.originalExportProject;
56 |
57 | IDE_Morph.prototype.version = function() {
58 | return this.getURL('version');
59 | };
60 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/plugin/morphic.js:
--------------------------------------------------------------------------------
1 | WorldMorph.prototype.Arduino.firmata = firmata;
2 |
3 | WorldMorph.prototype.Arduino.getSerialPorts = function (callback) {
4 | var myself = this,
5 | portList = [],
6 | portcheck = /usb|DevB|rfcomm|acm|^com/i;
7 |
8 | chrome.serial.getDevices(function (devices) {
9 | devices.forEach(function (device) {
10 | if (!myself.isPortLocked(device.path) && portcheck.test(device.path)) {
11 | portList[device.path] = device.path;
12 | }
13 | });
14 | callback(portList);
15 | });
16 | };
17 |
18 | // Reverting some changes
19 | WorldMorph.prototype.init = WorldMorph.prototype.originalInit;
20 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/plugin/plugin.js:
--------------------------------------------------------------------------------
1 | var extensionId = 'meajklokhjoflbimamdbhpdjlondmgpi',
2 | postal = new Postal(),
3 | firmata = {
4 | Board: function(port, callback) {
5 | chrome.runtime.sendMessage(extensionId, { command: 'connectBoard', args: [ port ] }, callback)
6 | }
7 | },
8 | require = function () {};
9 |
10 |
11 | // Messaging between web client and plugin
12 |
13 | function Postal() {};
14 |
15 | // Command sender function factory
16 | Postal.prototype.commandSender = function () {
17 | var myself = this,
18 | command = arguments[0],
19 | args = Array.from(arguments).slice(1),
20 | callback = typeof args[args.length - 1] === 'function' ? args.splice(args.length - 1) : null;
21 |
22 | return function () { myself.sendCommand(command, args, callback); };
23 | }
24 |
25 | Postal.prototype.sendCommand = function (command, args, callback) {
26 | chrome.runtime.sendMessage(extensionId, { command: command, args: args }, callback);
27 | }
28 |
29 | chrome.serial = {
30 | getDevices: function (callback) { postal.sendCommand('getDevices', null, callback) }
31 | };
32 |
--------------------------------------------------------------------------------
/src/platforms/mobile/android/root/plugin/threads.js:
--------------------------------------------------------------------------------
1 | Process.prototype.reportAnalogReading = function (pin) {
2 | var sprite = this.blockReceiver();
3 |
4 | if (sprite.arduino.isBoardReady()) {
5 | var board = sprite.arduino.board;
6 |
7 | if (board.pins[board.analogPins[pin]].mode !== board.MODES.ANALOG) {
8 | board.pinMode(board.analogPins[pin], board.MODES.ANALOG);
9 | }
10 |
11 | board.analogRead(pin, function(value) { board.pins[board.analogPins[pin]].value = value });
12 |
13 | // Ugly hack that fixes issue #5
14 | // "say" block inside a "forever" loop shows only first reading on GNU/Linux and MS-Windows
15 | // Until we find the source of the problem and a cleaner solution...
16 |
17 | if (!this.context.justRead) {
18 | this.context.justRead = true;
19 | } else {
20 | this.context.justRead = false;
21 | return board.pins[board.analogPins[pin]].value;
22 | }
23 |
24 | this.pushContext('doYield');
25 | this.pushContext();
26 |
27 | } else {
28 | throw new Error(localize('Arduino not connected'));
29 | }
30 | };
31 |
32 | Process.prototype.reportDigitalReading = function (pin) {
33 | var sprite = this.blockReceiver();
34 |
35 | if (sprite.arduino.isBoardReady()) {
36 | var board = sprite.arduino.board;
37 |
38 | if (board.pins[pin].mode !== board.MODES.INPUT) {
39 | board.pinMode(pin, board.MODES.INPUT);
40 | }
41 |
42 | board.digitalRead(pin, function(value) { board.pins[pin].value = value });
43 | return board.pins[pin].value === 1;
44 |
45 | } else {
46 | throw new Error(localize('Arduino not connected'));
47 | }
48 | };
49 |
50 |
--------------------------------------------------------------------------------
/src/platforms/mobile/ios/build:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Particular build script for iOS
4 |
5 | echo
6 | echo "======="
7 | echo "Reorganizing directory tree"
8 | echo "======="
9 | echo
10 |
11 | mv tmp tmp_www
12 | mkdir tmp
13 |
14 | echo "======="
15 | echo "Creating Cordova application skeleton..."
16 | echo "======="
17 | echo
18 |
19 | cd tmp
20 | cordova create Snap4Arduino
21 | cd Snap4Arduino
22 | cordova platform add ios
23 | mv ../../tmp_www/* www
24 | cd ../../
25 | rm -r tmp_www
26 |
27 | echo
28 | echo "======="
29 | echo "Setting version name..."
30 | echo "======="
31 | echo
32 |
33 | sed -E 's/^\s*version.*/ version="'`cat src\/version`'"/' src/platforms/mobile/ios/config.xml > tmp/Snap4Arduino/config.xml
34 |
35 | echo
36 | echo "======="
37 | echo "Asking Cordova to build Snap4Arduino for iOS"
38 | echo "======="
39 | echo
40 |
41 | rm -rf releases/mobile/ios
42 | mkdir -p releases/mobile/ios
43 | cd tmp/Snap4Arduino
44 | cordova build
45 | #mv platforms/android/build/outputs/apk/android-debug.apk ../../releases/mobile/android/Snap4Arduino.apk
46 | cd ../..
47 |
--------------------------------------------------------------------------------
/src/platforms/mobile/ios/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Snap4Arduino
8 |
9 | Snap4Arduino for iOS
10 |
11 |
12 | Bernat Romagosa - Arduino.org
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/platforms/mobile/ios/root:
--------------------------------------------------------------------------------
1 | ../android/root
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromeos/.buildme
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/build:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Particular build script for ChromeOS App.
3 |
4 | # Include print_utils
5 | . ./print_utils
6 |
7 | echo
8 | echo "======="
9 | echo "Setting up Node dependencies..."
10 | echo "======="
11 | echo
12 |
13 | cp -Rv environments/web/chromeos/node_modules tmp
14 |
15 | echo
16 | echo "======="
17 | echo "Setting version name"
18 | echo "======="
19 | echo
20 |
21 | sed -E 's/.*"version".*/ "version": "'`cat src\/version | sed -E "s/[a-z]|-//g" `'",/' src/platforms/web/chromeos/root/manifest.json | sed -E 's/.*version_name.*/ "version_name": "'`cat src\/version`'",/' > tmp/manifest.json
22 |
23 | echo
24 | echo "======="
25 | echo "Changing all occurrences of localStorage for chrome.storage.local"
26 | echo "======="
27 | echo
28 |
29 | sed -i.bak -E 's/localStorage/chrome\.storage\.local/g' tmp/*.js
30 | rm tmp/*.bak
31 |
32 | echo
33 | echo "======="
34 | echo "Building ChromeOS app"
35 | echo "======="
36 | echo
37 |
38 | if ! test -e environments/web/chromeos/Snap4Arduino.pem; then
39 | print_error "There isn't Snap4Arduino.pem (chromium extension private key) under environments/web/chromeos\nChromium extension is being built into a folder. To build the crx file, you need the pem key."
40 | else
41 | if command -v chromium-browser; then
42 | chromium-browser --pack-extension=tmp --pack-extension-key=environments/web/chromeos/Snap4Arduino.pem
43 | elif command -v google-chrome; then
44 | google-chrome --pack-extension=tmp --pack-extension-key=environments/web/chromeos/Snap4Arduino.pem
45 | fi
46 | if test $? = 1; then
47 | print_error "The extension could not be packaged.\nMake sure the Chromium browser or Google Chrome are installed in the system, and also that the extension private key can be found under environments/web/chromeos/"
48 | fi
49 | fi
50 |
51 | echo
52 | echo "======="
53 | echo "Creating release for web/chromeos"
54 | echo "======="
55 | echo
56 |
57 | rm -rf releases/web/chromeos
58 | mkdir -p releases/web/chromeos
59 |
60 | if test -e tmp.crx; then
61 | mv tmp.crx releases/web/chromeos/Snap4Arduino.crx
62 | else
63 | mv tmp releases/web/chromeos/crx
64 | fi
65 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/background.js:
--------------------------------------------------------------------------------
1 | chrome.app.runtime.onLaunched.addListener(function() {
2 | chrome.app.window.create('index.html', {
3 | 'outerBounds': {
4 | 'width': 960,
5 | 'height': 640
6 | }
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/chromeos/chromefs.js:
--------------------------------------------------------------------------------
1 | function saveFile (name, contents, extension, target) {
2 | chrome.fileSystem.chooseEntry(
3 | {
4 | type: 'saveFile',
5 | suggestedName: name + extension,
6 | accepts: [ { extensions: [extension]} ]
7 | },
8 | function (writableFileEntry) {
9 | writableFileEntry.createWriter(function (writer) {
10 | writer.onerror = function (err) { target.showMessage(err); };
11 | writer.onwriteend = function (e) { target.showMessage('Exported!', 3); };
12 | writer.write(new Blob([contents], { type: 'text/plain' }));
13 | },
14 | function (err) { target.showMessage(err); });
15 | });
16 | };
17 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/chromeos/gui.js:
--------------------------------------------------------------------------------
1 | IDE_Morph.prototype.version = function () {
2 | return this.versionName;
3 | };
4 |
5 | IDE_Morph.prototype.originalGetURL = IDE_Morph.prototype.getURL;
6 | IDE_Morph.prototype.getURL = function (url, callback) {
7 | var request = new XMLHttpRequest();
8 |
9 | request.open('GET', url, true);
10 | request.onload = function(e) {
11 | callback(this.responseText);
12 | };
13 | request.send();
14 | };
15 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/chromeos/morphic.js:
--------------------------------------------------------------------------------
1 | WorldMorph.prototype.Arduino = Arduino;
2 |
3 | WorldMorph.prototype.originalInit = WorldMorph.prototype.init;
4 | WorldMorph.prototype.init = function (aCanvas, fillPage) {
5 | this.originalInit(aCanvas, fillPage);
6 |
7 | // We need to override reportVersion and queryFirmware so that, in the event that the
8 | // cable is unplugged during a connection attempt, it does not try to write to the serial.
9 | // For some reason, the chrome.serial API freezes the serial port forever otherwise.
10 |
11 | this.Arduino.firmata.Board.prototype.originalReportVersion = this.Arduino.firmata.Board.prototype.reportVersion;
12 | this.Arduino.firmata.Board.prototype.reportVersion = function (callback) {
13 | if (this.transport.connectionId === undefined || this.transport.connectionId > 0) {
14 | this.originalReportVersion(callback);
15 | }
16 | };
17 | this.Arduino.firmata.Board.prototype.originalQueryFirmware = this.Arduino.firmata.Board.prototype.queryFirmware;
18 | this.Arduino.firmata.Board.prototype.queryFirmware = function (callback) {
19 | if (this.transport.connectionId === undefined || this.transport.connectionId > 0) {
20 | this.originalQueryFirmware(callback);
21 | }
22 | };
23 |
24 | };
25 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/chromeos/startup.js:
--------------------------------------------------------------------------------
1 | var world,
2 | ide;
3 |
4 | // We rewrite some functions
5 |
6 | BlockMorph.prototype.transpileToC = function () {
7 | var ide = this.parentThatIsA(IDE_Morph);
8 |
9 | try {
10 | saveFile(
11 | ide.projectName ? ide.projectName.replace(/[^a-zA-Z]/g,'') : 'snap4arduino',
12 | this.world().Arduino.transpile(
13 | this.mappedCode(),
14 | this.parentThatIsA(ScriptsMorph).children.filter(
15 | function (each) {
16 | return each instanceof HatBlockMorph &&
17 | each.selector == 'receiveMessage';
18 | })),
19 | '.ino',
20 | ide);
21 | } catch (error) {
22 | ide.inform('Error exporting to Arduino sketch!', error.message)
23 | }
24 | };
25 |
26 | // Actual startup
27 |
28 | window.onload = function () {
29 | initInterval = setInterval(initLoop, 50);
30 | };
31 |
32 | function initLoop() {
33 | if (window.firmata) {
34 |
35 | Arduino.firmata = window.firmata;
36 |
37 | clearInterval(initInterval);
38 |
39 | world = new WorldMorph(document.getElementById('world'));
40 |
41 | ide = new IDE_Morph();
42 | ide.openIn(world);
43 |
44 | ide.getURL('version', function (version) {
45 | ide.versionName = version;
46 | });
47 |
48 | ide.inform = function(title, message, callback) {
49 | var myself = this;
50 | if (!myself.informing) {
51 | var box = new DialogBoxMorph();
52 | myself.informing = true;
53 | box.ok = function() {
54 | myself.informing = false;
55 | if (callback) { callback() };
56 | this.accept();
57 | };
58 | box.inform(title, message, world)
59 | }
60 | };
61 |
62 | setInterval(loop, 1);
63 | }
64 | };
65 |
66 | function loop () {
67 | world.doOneCycle();
68 | };
69 |
70 | function Buffer (data) {
71 | return data;
72 | };
73 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/chromeos/threads.js:
--------------------------------------------------------------------------------
1 | Process.prototype.reportJSFunction = function (parmNames, body) {
2 | try {
3 | return document.getElementById("sandboxFrame").contentWindow.reportJSFunction(this, parmNames, body);
4 | }
5 | catch(error) {
6 | if (error.toString().indexOf("from accessing a cross-origin") != -1) {
7 | throw new Error("To run JS in this ChomeOS app, you must launch Chrome/Chromium with this parameters: --disable-web-security --user-data-dir");
8 | } else {
9 | throw new Error(error);
10 | }
11 | }
12 |
13 | };
14 | Process.prototype.originalEvaluate = Process.prototype.evaluate;
15 | Process.prototype.evaluate = function (context, args, isCommand) {
16 | if (typeof context == 'function') {
17 | return context.apply(
18 | this.blockReceiver(),
19 | args.asArray().concat([this])
20 | );
21 | }
22 | this.originalEvaluate(context, args, isCommand);
23 | };
24 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/events.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | exports.EventEmitter = EventEmitter;
4 |
5 | function EventEmitter() {}
6 |
7 | EventEmitter.prototype.on = function (name, callback) {
8 | if (!this.hasOwnProperty("_handlers")) this._handlers = {};
9 | var handlers = this._handlers;
10 | if (!handlers.hasOwnProperty(name)) handlers[name] = [];
11 | var list = handlers[name];
12 | list.push(callback);
13 | };
14 | EventEmitter.prototype.addListener = EventEmitter.prototype.on;
15 |
16 | EventEmitter.prototype.once = function (name, callback) {
17 | this.on(name, callback);
18 | this.on(name, remove);
19 | function remove() {
20 | this.off(name, callback);
21 | this.off(name, remove);
22 | }
23 | };
24 |
25 | EventEmitter.prototype.emit = function (name/*, args...*/) {
26 | if (!this.hasOwnProperty("_handlers")) return;
27 | var handlers = this._handlers;
28 | if (!handlers.hasOwnProperty(name)) return;
29 | var list = handlers[name];
30 | var args = Array.prototype.slice.call(arguments, 1);
31 | for (var i = 0, l = list.length; i < l; i++) {
32 | if (!list[i]) continue;
33 | list[i].apply(this, args);
34 | }
35 | }
36 |
37 | EventEmitter.prototype.off = function (name, callback) {
38 | if (!this.hasOwnProperty("_handlers")) return;
39 | var handlers = this._handlers;
40 | if (!handlers.hasOwnProperty(name)) return;
41 | var list = handlers[name];
42 | var index = list.indexOf(callback);
43 | if (index < 0) return;
44 | list[index] = false;
45 | if (index === list.length - 1) {
46 | while (index >= 0 && !list[index]) {
47 | list.length--;
48 | index--;
49 | }
50 | }
51 | };
52 | EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
53 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromeos/root/icon-128.png
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/icon-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromeos/root/icon-16.png
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Snap4Arduino
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/main.js:
--------------------------------------------------------------------------------
1 | firmata = require('./firmata.js');
2 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Snap4Arduino",
3 | "description": "Use Berkeley Snap! to program and control all kinds of Arduino boards",
4 | "version": "changeme",
5 | "version_name": "changeme",
6 | "manifest_version": 2,
7 | "offline_enabled": true,
8 | "app": {
9 | "background": {
10 | "scripts": ["background.js"]
11 | }
12 | },
13 | "permissions": [
14 | "serial",
15 | {
16 | "fileSystem": ["write", "retainEntries", "directory"]
17 | },
18 | "storage"
19 | ],
20 | "icons": { "16": "icon-16.png", "128": "icon-128.png" },
21 | "sandbox": {
22 | "pages": ["sandbox.html"]
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/sandbox.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Sandbox page from Snap4Arduino ChromeOS app
5 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/serialport.js:
--------------------------------------------------------------------------------
1 | /*global chrome*/
2 | var EventEmitter = require('./events.js').EventEmitter;
3 | var util = require('./util.js');
4 |
5 | function SerialPort(port, options) {
6 |
7 | var self = this;
8 | var id;
9 | var bytesToRead = options.buffersize || 1;
10 | var reading = false;
11 |
12 | function onOpen (info) {
13 | console.log('onOpen', info);
14 | if(info){
15 | id = self.id = info.connectionId;
16 | if (id < 0) {
17 | self.emit("error", new Error("Cannot connect to " + port));
18 | return;
19 | }
20 | self.path = port;
21 | self.emit("open");
22 | chrome.serial.onReceive.addListener(function(obj){
23 | if(id == obj.connectionId){
24 | var data = new Uint8Array(obj.data);
25 | self.emit("data", data);
26 | }
27 | });
28 | } else {
29 | console.log('can\'t connect to ', port);
30 | }
31 |
32 | }
33 |
34 | chrome.serial.connect(port, {
35 | bitrate: options.baudrate || 9600
36 | }, onOpen);
37 |
38 | }
39 |
40 | SerialPort.prototype.write = function (data) {
41 | function onWrite() {
42 | // log("onWrite", arguments);
43 | }
44 |
45 | data = new Uint8Array(data);
46 | // console.log("OUT", data);
47 | if(this.id){
48 | chrome.serial.send(this.id, data.buffer, onWrite);
49 | }
50 |
51 | };
52 |
53 | SerialPort.prototype.close = function() {
54 | chrome.serial.disconnect(this.id, function() {});
55 | }
56 |
57 | util.inherits(SerialPort, EventEmitter);
58 |
59 | exports.SerialPort = SerialPort;
60 |
--------------------------------------------------------------------------------
/src/platforms/web/chromeos/root/util.js:
--------------------------------------------------------------------------------
1 | // tiny util.inherits shim.
2 | exports.inherits = function (Class, Parent) {
3 | Class.prototype.__proto__ = Parent.prototype;
4 | };
5 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/.buildme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/.buildme
--------------------------------------------------------------------------------
/src/platforms/web/chromium/build:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Particular build script for Chromium extension and web-based version.
3 |
4 | # Include print_utils
5 | . ./print_utils
6 |
7 | echo
8 | echo "======="
9 | echo "Reorganizing directory tree"
10 | echo "======="
11 | echo
12 |
13 | mkdir tmp/www
14 | mv tmp/* tmp/www 2>/dev/null
15 |
16 | echo
17 | echo "======="
18 | echo "Fetching more platform-specific files"
19 | echo "======="
20 | echo
21 |
22 | cp -RL src/platforms/web/chromium/crx tmp
23 |
24 | #echo
25 | #echo "======="
26 | #echo "Setting version name..."
27 | #echo "======="
28 | #echo
29 |
30 | #sed -E 's/.*"version".*/ "version": "'`cat src\/version`'",/' src/platforms/web/chromium/crx/manifest.json > tmp/crx/manifest.json
31 |
32 | echo
33 | echo "======="
34 | echo "Building Chromium extension"
35 | echo "======="
36 | echo
37 |
38 | if ! test -e environments/web/chromium/Snap4Arduino.pem; then
39 | print_error "There isn't Snap4Arduino.pem (chromium extension private key) under environments/web/chromium\nChromium extension is being built into a folder. To build the crx file, you need the pem key."
40 | else
41 | if command -v chromium-browser; then
42 | chromium-browser --pack-extension=tmp/crx --pack-extension-key=environments/web/chromium/Snap4Arduino.pem
43 | elif command -v chromium; then
44 | chromium --pack-extension=tmp/crx --pack-extension-key=environments/web/chromium/Snap4Arduino.pem
45 | elif command -v google-chrome; then
46 | google-chrome --pack-extension=tmp/crx --pack-extension-key=environments/web/chromium/Snap4Arduino.pem
47 | fi
48 | if test $? = 1; then
49 | print_error "The extension could not be packaged.\nMake sure the Chromium browser or Google Chrome are installed in the system, and also that the extension private key can be found under environments/web/chromium/"
50 | fi
51 | fi
52 |
53 | echo
54 | echo "======="
55 | echo "Creating release for web/chromium"
56 | echo "======="
57 | echo
58 |
59 | rm -rf releases/web/chromium
60 | mkdir -p releases/web/chromium
61 | mv tmp/www releases/web/chromium/
62 | if test -e tmp/crx.crx; then
63 | mv tmp/crx.crx releases/web/chromium/Snap4Arduino.crx
64 | else
65 | mv tmp/crx releases/web/chromium/
66 | fi
67 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/chromeExtensions.txt:
--------------------------------------------------------------------------------
1 | https://chrome.google.com/webstore/devconsole
2 | Snap4Arduino Team
3 |
4 | ===Snap4Arduino connector===
5 |
6 | ==Versions==
7 | - Usually, same as the current version
8 | - 6.2 but 6.2.5 (domains updated) i 6.2.6 (odissea, agora and cesire added)
9 | - Custom versions labeled manually
10 |
11 | ==App vs Extension (connector)
12 | - "Snap4Arduino connector" is the official extension
13 | - "Snap4Arduino" (app) not maintained
14 |
15 | ==Old version==
16 | - Web version runs with both versions
17 | - ChromeStore with "current version" (published again on 11/02/2021)
18 | - Github and web downloads turn to "current version" on 14/02/2021
19 | - Manual crx file built from ChromeWebStore (not pem files)
20 |
21 | ==Public IDs==
22 | //Extensions ID
23 | 32 characters
24 | currentExtensionId = 'fhmkennllhhclkcjcdaegceilcefedle',
25 | oldExtensionId = 'meajklokhjoflbimamdbhpdjlondmgpi',
26 |
27 | //public keys
28 | 392 characters
29 |
30 | //currentConnector
31 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/TZdN2upa+vnxAIQKWQ/mhyZpw+Rc48ByKRcXCFBSbjnmN2gvKw6wT3lFAaWYKWoKImLgNhF3gzc9Mo0Nijoh3JTo0XLIJDqV9hOaIJy0ZKOPNVJ8HmyAtCBPQMmiWVlq+0UIvs+bUxn/kVKnlDGymgUJZyf/5wmaU+C4bNNOTwPgn7pnvWb0zyYelzyFq4fATd1xmWVJJTw2Vd5Ypdg6Ew37FeipjgTyTF4vLdahhwe5Wqu5HE7yK7NbvaG0ubVxI2MUxuhDPbmus5f7K89lRmcAs1Z8TvCpETxuGs4BpXcVp2/OacKvCWRo7Gkh9c+SikNvGAmtcjzOdMboGOEQIDAQAB
32 |
33 | //oldConnector
34 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAryxXD9KBQe4/H/Xqpbj7Uz8V4pXtst4jb9olXllFRWQJbOx4OkTPkiF9Fmm5q4HCldD/XVuKOCGbiafdMlrZI2iRT2Jwr9UAf1VB0ajiqTUrSxzfn3Aiwa8LaiiAI3krmD8QyoCZTuxTsyIUMXCzIf4pVmgzanWmHX+lfu1TExXrmzsFy0BLOWFFJ8VPs/ArhoqoNRw3oLXczXcjbyRDMyhuj6/GYCJXOy/wwINLsXnJdhsyPPbsX3cin/tWnqb3a2ElY/tUsJdqK0RRF7aqJOLYIzWbegIQRcUsUwkTgZRaJkBbH+dLdG7J2yici2JZ12882mdU4mRSYOnuGN+lIwIDAQAB
35 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/crx/background.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Snap4Arduino Plugin
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/crx/icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/crx/icon-128.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/crx/icon-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/crx/icon-16.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/crx/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Snap4Arduino connector",
3 | "description": "Connect Berkeley Snap! to Arduino boards",
4 | "version": "8.0",
5 | "manifest_version": 2,
6 | "app": {
7 | "background": {
8 | "page": "background.html"
9 | }
10 | },
11 | "permissions": [
12 | "serial"
13 | ],
14 | "externally_connectable": {
15 | "matches": [
16 | "http://localhost:8080/*",
17 | "http://localhost/*",
18 | "http://snap4arduino.local/*",
19 | "http://snap4arduino.rocks/*",
20 | "https://snap4arduino.rocks/*",
21 | "https://snap.berkeley.edu/*",
22 | "http://extensions.snap.berkeley.edu/*",
23 | "https://snapstudio.rocks/*",
24 | "https://odissea.xtec.cat/*",
25 | "https://agora.xtec.cat/*",
26 | "https://educaciodigital.cat/*",
27 | "https://cesire.cat/*",
28 | "https://www.robolot.online/*",
29 | "https://campus.innovadidactic.com/*",
30 | "https://snap2make.click/*"
31 | ],
32 | "accepts_tls_channel_id": false
33 | },
34 | "icons": { "16": "icon-16.png", "128": "icon-128.png" },
35 | "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/TZdN2upa+vnxAIQKWQ/mhyZpw+Rc48ByKRcXCFBSbjnmN2gvKw6wT3lFAaWYKWoKImLgNhF3gzc9Mo0Nijoh3JTo0XLIJDqV9hOaIJy0ZKOPNVJ8HmyAtCBPQMmiWVlq+0UIvs+bUxn/kVKnlDGymgUJZyf/5wmaU+C4bNNOTwPgn7pnvWb0zyYelzyFq4fATd1xmWVJJTw2Vd5Ypdg6Ew37FeipjgTyTF4vLdahhwe5Wqu5HE7yK7NbvaG0ubVxI2MUxuhDPbmus5f7K89lRmcAs1Z8TvCpETxuGs4BpXcVp2/OacKvCWRo7Gkh9c+SikNvGAmtcjzOdMboGOEQIDAQAB"
36 | }
37 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_120.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_128.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_144.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_152.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_192.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_256.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_384.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_384.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_512.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_72.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/img/app_96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/platforms/web/chromium/root/img/app_96.png
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/index_fast.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Snap4Arduino @AppVersion
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Snap4Arduino",
3 | "short_name": "Snap4Arduino",
4 | "icons": [{
5 | "src": "img/app_72.png",
6 | "sizes": "72x72",
7 | "type": "image/png"
8 | }, {
9 | "src": "img/app_96.png",
10 | "sizes": "96x96",
11 | "type": "image/png"
12 | }, {
13 | "src": "img/app_120.png",
14 | "sizes": "120x120",
15 | "type": "image/png"
16 | }, {
17 | "src": "img/app_128.png",
18 | "sizes": "128x128",
19 | "type": "image/png"
20 | }, {
21 | "src": "img/app_144.png",
22 | "sizes": "144x144",
23 | "type": "image/png"
24 | }, {
25 | "src": "img/app_152.png",
26 | "sizes": "152x152",
27 | "type": "image/png"
28 | }, {
29 | "src": "img/app_192.png",
30 | "sizes": "192x192",
31 | "type": "image/png",
32 | "purpose": "any maskable"
33 | }, {
34 | "src": "img/app_256.png",
35 | "sizes": "256x256",
36 | "type": "image/png"
37 | }, {
38 | "src": "img/app_384.png",
39 | "sizes": "384x384",
40 | "type": "image/png"
41 | }, {
42 | "src": "img/app_512.png",
43 | "sizes": "512x512",
44 | "type": "image/png"
45 | }],
46 | "lang": "en-US",
47 | "start_url": "./index.html",
48 | "display": "standalone",
49 | "background_color": "white",
50 | "theme_color": "white"
51 | }
52 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/plugin/gui.js:
--------------------------------------------------------------------------------
1 | IDE_Morph.prototype.sn4a_version = function() {
2 | return this.getURL('version');
3 | };
4 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/plugin/morphic.js:
--------------------------------------------------------------------------------
1 | WorldMorph.prototype.Arduino.firmata = firmata;
2 |
3 | WorldMorph.prototype.Arduino.getSerialPorts = function (callback) {
4 | var myself = this,
5 | portList = [],
6 | portcheck = /usb|DevB|rfcomm|acm|^com|^com|^\\\\\.\\com/i;
7 |
8 | chrome.serial.getDevices(function (devices) {
9 | devices.forEach(function (device) {
10 | if (!myself.isPortLocked(device.path) && portcheck.test(device.path)) {
11 | portList[device.path] = device.path;
12 | }
13 | });
14 | callback(portList);
15 | });
16 | };
17 |
18 | // Reverting some changes
19 | WorldMorph.prototype.init = WorldMorph.prototype.originalInit;
20 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/plugin/objects.js:
--------------------------------------------------------------------------------
1 | SpriteMorph.prototype.reportAnalogReading = function (pin) {
2 | if (this.arduino.isBoardReady()) {
3 | var board = this.arduino.board;
4 |
5 | if (!pin) { return 0 };
6 |
7 | if (board.pins[board.analogPins[pin]].mode != board.MODES.ANALOG) {
8 | board.pinMode(board.analogPins[pin], board.MODES.ANALOG);
9 | }
10 | board.getAnalogPinValue(board.analogPins[pin]);
11 | return board.pins[board.analogPins[pin]].value;
12 |
13 | } else {
14 | return 0;
15 | }
16 | };
17 |
18 | SpriteMorph.prototype.reportDigitalReading = function (pin) {
19 | if (this.arduino.isBoardReady() && pin) {
20 | var board = this.arduino.board;
21 | if (board.pins[pin].mode != board.MODES.INPUT) {
22 | board.pinMode(pin, board.MODES.INPUT);
23 | board.pins[pin].watcherReport = 1;
24 | } else {
25 | if (board.pins[pin].watcherReport == 1) {
26 | board.reportDigitalPin(pin, 1);
27 | board.pins[pin].watcherReport = 0;
28 | } else {
29 | board.getDigitalPinValue(pin);
30 | return board.pins[pin].value == 1;
31 | }
32 | }
33 | }
34 | return false;
35 | };
36 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/plugin/plugin.js:
--------------------------------------------------------------------------------
1 | var currentExtensionId = 'fhmkennllhhclkcjcdaegceilcefedle',
2 | oldExtensionId = 'meajklokhjoflbimamdbhpdjlondmgpi',
3 | extensionId = currentExtensionId,
4 | postal = new Postal(),
5 | firmata = {
6 | Board: function(port, callback) {
7 | chrome.runtime.sendMessage(extensionId, { command: 'connectBoard', args: [ port ] }, callback)
8 | }
9 | },
10 | require = function () {};
11 |
12 | // Messaging between web client and plugin
13 |
14 | function Postal() {};
15 |
16 | // Command sender function factory
17 | Postal.prototype.commandSender = function () {
18 | var myself = this,
19 | command = arguments[0],
20 | args = Array.from(arguments).slice(1),
21 | callback = typeof args[args.length - 1] === 'function' ? args.splice(args.length - 1) : null;
22 |
23 | return function () { myself.sendCommand(command, args, callback); };
24 | };
25 |
26 | Postal.prototype.sendCommand = function (command, args, callback) {
27 | chrome.runtime.sendMessage(extensionId, { command: command, args: args }, callback);
28 | };
29 |
30 | chrome.serial = {
31 | getDevices: function (callback) { postal.sendCommand('getDevices', null, callback) }
32 | };
33 |
34 | // Checking if Snap4Arduino Connector (current or old, with different 'extensionId') are present
35 | chrome.runtime.sendMessage(extensionId, {command:'getDevices'}, function (devices) {
36 | if (chrome.runtime.lastError) {
37 | console.log("Current connector not found");
38 | extensionId = oldExtensionId;
39 | chrome.runtime.sendMessage(extensionId, {command:'getDevices'}, function (devices) {
40 | if (chrome.runtime.lastError) {
41 | console.log("Old connector has not been found either");
42 | extensionId = currentExtensionId;
43 | } else {
44 | console.log("Old connector found successfully");
45 | }
46 | });
47 | } else {
48 | console.log("Current connector found successfully");
49 | }
50 | });
51 |
--------------------------------------------------------------------------------
/src/platforms/web/chromium/root/plugin/threads.js:
--------------------------------------------------------------------------------
1 | Process.prototype.reportAnalogReading = function (pin) {
2 | var sprite = this.blockReceiver();
3 |
4 | if (sprite.arduino.isBoardReady()) {
5 |
6 | var board = sprite.arduino.board;
7 |
8 | if (board.pins[board.analogPins[pin]].mode != board.MODES.ANALOG) {
9 | board.pinMode(board.analogPins[pin], board.MODES.ANALOG);
10 | board.pins[board.analogPins[pin]].report = -1;
11 | } else {
12 | if (board.pins[board.analogPins[pin]].report == -1) {
13 | board.pins[board.analogPins[pin]].report = 1;
14 | } else if (board.pins[board.analogPins[pin]].report == 1) {
15 | board.pins[board.analogPins[pin]].report = 0;
16 | board.getAnalogPinValue(board.analogPins[pin]);
17 | } else if (board.pins[board.analogPins[pin]].report == 2) {
18 | board.pins[board.analogPins[pin]].report = 1;
19 | return board.pins[board.analogPins[pin]].value;
20 | }
21 | }
22 |
23 | this.pushContext('doYield');
24 | this.pushContext();
25 | } else {
26 | throw new Error(localize('Arduino not connected'));
27 | }
28 | };
29 |
30 | Process.prototype.reportDigitalReading = function (pin) {
31 | var sprite = this.blockReceiver(),
32 | check;
33 |
34 | if (sprite.arduino.isBoardReady()) {
35 |
36 | var board = sprite.arduino.board;
37 |
38 | if (board.pins[pin].mode != board.MODES.INPUT) {
39 | board.pinMode(pin, board.MODES.INPUT);
40 | board.pins[pin].report = -1;
41 | } else {
42 | if (board.pins[pin].report == -1) {
43 | board.reportDigitalPin(pin, 1);
44 | board.pins[pin].report = 1;
45 | }else if (board.pins[pin].report == 1) {
46 | board.pins[pin].report = 0;
47 | board.getDigitalPinValue(pin);
48 | } else if (board.pins[pin].report == 2) {
49 | board.pins[pin].report = 1;
50 | return board.pins[pin].value == 1;
51 | }
52 | }
53 |
54 | this.pushContext('doYield');
55 | this.pushContext();
56 | } else {
57 | throw new Error(localize('Arduino not connected'));
58 | }
59 | };
60 |
61 |
--------------------------------------------------------------------------------
/src/s4a/cloud.js:
--------------------------------------------------------------------------------
1 | Cloud.prototype.urlForMyProject = function (projectName) {
2 | if (!this.username) {
3 | throw new Error('You are not logged in');
4 | return;
5 | }
6 |
7 | return 'http://snap4arduino.rocks/run#present:Username=' +
8 | encodeURIComponent(this.username) + '&ProjectName=' +
9 | encodeURIComponent(projectName);
10 | };
11 |
12 |
--------------------------------------------------------------------------------
/src/s4a/firmware/uploader.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/s4a/icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/s4a/icon-128.png
--------------------------------------------------------------------------------
/src/s4a/icon-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/s4a/icon-16.png
--------------------------------------------------------------------------------
/src/s4a/icon-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bromagosa/Snap4Arduino/10650e0ca7dda8e1b8a9592ca415878536914202/src/s4a/icon-256.png
--------------------------------------------------------------------------------
/src/s4a/lang-ca.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'About Snap4Arduino...': 'Sobre Snap4Arduino...',
3 | 'An Arduino board has been connected. Happy prototyping!': 'S\'ha connectat correctament una placa Arduino.\nFeliç prototipatge!',
4 | 'An error was detected on the board\n\n': 'S\'ha detectat un error a la placa\n\n',
5 | 'Board is not connected': 'La placa no està connectada',
6 | 'Board was disconnected from port\n': 'S\'ha desconnectat la placa del port\n',
7 | 'Check if firmata is loaded.': 'Reviseu que Firmata hi estigui carregat.',
8 | 'Connect Arduino': 'Connecta Arduino',
9 | 'Connecting board at port\n': 'Connectant placa al port\n',
10 | 'Connecting to network port:\n': 'Connectant a port de xarxa:\n',
11 | 'Could not connect an Arduino\nNo boards found': 'No s\'ha pogut connectar cap Arduino\nNo s\'ha trobat cap placa',
12 | 'Could not talk to Arduino in port\n': 'No s\'ha pogut establir comunicació amb Arduino al port\n',
13 | 'Disconnect Arduino': 'Desconnecta Arduino',
14 | 'Enter hostname or ip address:': 'Introdueix el nom de l\'host o adreça IP',
15 | 'Error connecting the board.': 'Error en connectar a la placa',
16 | 'HTTP server': 'Servidor HTTP',
17 | 'It seems that someone pulled the cable!': 'Sembla que algú ha desconnectat el cable!',
18 | 'Loading Snap Jr.': 'S\'està carregant Snap Júnior',
19 | 'More supported devices': 'Altres dispositus compatibles',
20 | 'Network port': 'Port de xarxa',
21 | 'Network serial ports': 'Ports sèrie sobre xarxa',
22 | 'New Arduino translatable project': 'Nou projecte traduïble a Arduino',
23 | 'Open from URL...': 'Obre des d\'una URL...',
24 | 'PWM': 'PWM',
25 | 'Public stage': 'Escenari públic',
26 | 'Save, share and get URL...': 'Desa, comparteix i mostra la URL...',
27 | 'Show project URL': 'Mostra la URL del projecte',
28 | 'Snap4Arduino connector required': 'Connector d\'Snap4Arduino requerit',
29 | 'Snap4Arduino repository': 'Repositori de Snap4Arduino',
30 | 'Snap4Arduino website': 'Web de Snap4Arduino',
31 | 'Start Snap4Arduino in an\nicon-based blocks mode\nfor the youngest programmers': 'Inicia Snap4Arduino en un\nmode de blocs amb icones\nper els/les programadors/es més joves',
32 | 'Start a Snap Jr. session': 'Inicia una sessió de Snap Júnior',
33 | 'There is already a board connected to this sprite': 'Aquest objecte ja té una placa connectada',
34 | 'This may take a few seconds...': 'Aquesta operació pot trigar uns segons...',
35 | 'This project is now public at the following URL:': 'Aquest projecte és públic, accessible des de la URL:',
36 | 'Upload firmware on UNO boards': 'Actualitza el firmware de plaques UNO',
37 | 'analog reading _': 'lectura analògica _',
38 | 'angle (0-180)': 'angle (0-180)',
39 | 'arduino connected?': 'arduino connectat?',
40 | 'blue': 'blau',
41 | 'check to allow the stage\nto be viewed\nfrom the HTTP server': 'marqueu per permetre que l\'escenari\nes vegi des del servidor HTTP',
42 | 'check to start\nHTTP server, allowing\nremote control\nof Snap4Arduino': 'marqueu per iniciar\nel servidor HTTP, permetent\nel control remot\nde Snap4Arduino',
43 | 'clockwise (1500-1000)': 'sentit horari (1500-1000)',
44 | 'clockwise': 'sentit horari',
45 | 'connect arduino at _': 'connecta l\'Arduino al port _',
46 | 'connect to Arduino': 'connecta a Arduino',
47 | 'counter-clockwise (1500-2000)': 'sentit anti-horari (1500-2000)',
48 | 'counter-clockwise': 'sentit anti-horari',
49 | 'digital input': 'entrada digital',
50 | 'digital output': 'sortida digital',
51 | 'digital reading _': 'lectura digital _',
52 | 'disconnect Arduino': 'desconnecta Arduino',
53 | 'disconnect arduino': 'desconnecta l\'Arduino',
54 | 'disconnected': 'desconnectat',
55 | 'red': 'vermell',
56 | 'select a port': 'selecciona un port',
57 | 'servo': 'servo',
58 | 'set digital pin _ to _': 'posa el pin digital _ a _',
59 | 'set pin _ to value _': 'posa el pin _ al valor _',
60 | 'set servo _ to _': 'posa el servo _ a _',
61 | 'setup digital pin _ as _': 'configura pin _ com a _',
62 | 'stopped (1500)': 'aturat (1500)',
63 | 'stopped': 'aturat',
64 | 'uncheck to prevent the stage\nfrom being viewed\nfrom the HTTP server': 'desmarqueu per evitar que l\'escenari\nes vegi des del servidor HTTP',
65 | 'uncheck to stop\nHTTP server': 'desmarqueu per aturar\nel servidor HTTP'
66 | };
67 | // Add attributes to original SnapTranslator.dict.ca
68 | for (var attrname in s4aTempDict) { SnapTranslator.dict.ca[attrname] = s4aTempDict[attrname]; }
69 |
--------------------------------------------------------------------------------
/src/s4a/lang-cs.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Deska Arduino byla připojena. Veselé prototypování!',
3 | 'An error was detected on the board\n\n': 'Detekována chyba na desce\n\n',
4 | 'Board is not connected': 'Deska není připojena',
5 | 'Board was disconnected from port\n': 'Deska byla odpojena od portu\n',
6 | 'Check if firmata is loaded.': 'Zkontrolujte, zda je na desce nahrána Firmata.',
7 | 'Connect Arduino': 'Připojit Arduino',
8 | 'Connecting board at port\n': 'Připojuji desku na port\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Nezdařilo se připojení k Arduinu\nNenalezena žádná deska',
10 | 'Could not talk to Arduino in port\n': 'Komunikace s Arduinem se nedaří na portu\n',
11 | 'Disconnect Arduino': 'Odpojit Arduino',
12 | 'Error connecting the board.': 'Chyba při připojení k desce.',
13 | 'It seems that someone pulled the cable!': 'Zdá se, že někdo vytáhl kabel!',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'K tomuto sprite je již deska připojena',
16 | 'analog reading _': 'analogový vstup _',
17 | 'angle (0-180)': 'úhel (0-180)',
18 | 'clockwise (1500-1000)': 'po směru hodin (1500-1000)',
19 | 'clockwise': 'po směru hodin',
20 | 'connect arduino at _': 'připojit Arduino na portu _',
21 | 'connect to Arduino': 'připojit Arduino',
22 | 'counter-clockwise (1500-2000)': 'proti směru hodin (1500-2000)',
23 | 'counter-clockwise': 'proti směru hodin',
24 | 'digital input': 'digitální vstup',
25 | 'digital output': 'digitální výstup',
26 | 'digital reading _': 'digitální vstup _',
27 | 'disconnect Arduino': 'odpojit Arduino',
28 | 'disconnect arduino': 'odpojit Arduino',
29 | 'servo': 'servo',
30 | 'set digital pin _ to _': 'nastav digitální pin _ na _',
31 | 'set pin _ to value _': 'nastav PWM pin _ na _',
32 | 'set servo _ to _': 'nastav servo _ na _',
33 | 'setup digital pin _ as _': 'nastav digitální pin _ jako _',
34 | 'stopped (1500)': 'zastaveno (1500)',
35 | 'stopped': 'zastaveno'
36 | };
37 | // Add attributes to original SnapTranslator.dict.cs
38 | for (var attrname in s4aTempDict) { SnapTranslator.dict.cs[attrname] = s4aTempDict[attrname]; }
39 |
--------------------------------------------------------------------------------
/src/s4a/lang-de.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Ein Arduino-Board wurde verbunden. Fröhliches Prototyping!',
3 | 'An error was detected on the board\n\n': 'Es wurde ein Fehler auf dem Board festgestellt\n\n',
4 | 'Board is not connected': 'Board ist nicht verbunden',
5 | 'Board was disconnected from port\n': 'Verbindung zum Board wurde getrennt an Port\n',
6 | 'Check if firmata is loaded.': 'Überprüfe, ob die Firmata geladen wurde.',
7 | 'Connect Arduino': 'Mit Arduino verbinden',
8 | 'Connecting board at port\n': 'Verbinde mit Board an Port\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Konnte nicht mit Arduino verbinden\nKeine Boards gefunden',
10 | 'Could not talk to Arduino in port\n': 'Kommunikation mit Arduino fehlgeschlagen an Port\n',
11 | 'Disconnect Arduino': 'Verbindung zu Arduino trennen',
12 | 'Error connecting the board.': 'Fehler beim verbinden mit dem Board.',
13 | 'It seems that someone pulled the cable!': 'Scheinbar hat jemand das Kabel gezogen!',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'Es ist bereits ein Board mit diesem Sprite verbunden',
16 | 'analog reading _': 'lies analogen Pin _',
17 | 'angle (0-180)': 'Winkel (0-180)',
18 | 'clockwise (1500-1000)': 'im Uhrzeigersinn (1500-1000)',
19 | 'clockwise': 'im Uhrzeigersinn',
20 | 'connect arduino at _': 'verbinde Arduino an Port _',
21 | 'connect to Arduino': 'mit Arduino verbinden',
22 | 'counter-clockwise (1500-2000)': 'gegen den Uhrzeigersinn (1500-2000)',
23 | 'counter-clockwise': 'gegen den Uhrzeigersinn',
24 | 'digital input': 'digitaler Eingang',
25 | 'digital output': 'digitaler Ausgang',
26 | 'digital reading _': 'lies digitalen Pin _',
27 | 'disconnect Arduino': 'Verbindung zu Arduino trennen',
28 | 'disconnect arduino': 'verbindung zu Arduino trennen',
29 | 'servo': 'Servo',
30 | 'set digital pin _ to _': 'Setze digitalen Pin _ auf _',
31 | 'set pin _ to value _': 'Setze Pin _ auf _',
32 | 'set servo _ to _': 'Setze Servo _ auf _',
33 | 'setup digital pin _ as _': 'Einrichten des digitalen Pins _ als _',
34 | 'stopped (1500)': 'gestoppt (1500)',
35 | 'stopped': 'gestoppt'
36 | };
37 | // Add attributes to original SnapTranslator.dict.de
38 | for (var attrname in s4aTempDict) { SnapTranslator.dict.de[attrname] = s4aTempDict[attrname]; }
39 |
--------------------------------------------------------------------------------
/src/s4a/lang-es.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'About Snap4Arduino...': 'Sobre Snap4Arduino...',
3 | 'An Arduino board has been connected. Happy prototyping!': 'Se conectó exitosamente una tarjeta Arduino.\n¡Feliz prototipado!',
4 | 'An error was detected on the board\n\n': 'Se detectó un error en la tarjeta\n\n',
5 | 'Board is not connected': 'La tarjeta no está conectada',
6 | 'Board was disconnected from port\n': 'Se deconectó la tarjeta de la puerta\n',
7 | 'Check if firmata is loaded.': 'Revise si tiene cargado el firmware Firmata.',
8 | 'Connect Arduino': 'Conectar Arduino',
9 | 'Connecting board at port\n': 'Conectando tarjeta en la puerta\n',
10 | 'Connecting to network port:\n': 'Conectando a puerta de red:\n',
11 | 'Could not connect an Arduino\nNo boards found': 'No se pudo conectar un Arduino\nNo se encontró ninguna tarjeta',
12 | 'Could not talk to Arduino in port\n': 'No se pudo comunicar con Arduino en la puerta\n',
13 | 'Disconnect Arduino': 'Desconectar Arduino',
14 | 'Enter hostname or ip address:': 'Introduzca el nombre del host o su dirección IP',
15 | 'Error connecting the board.': 'Error al conectar la tarjeta',
16 | 'HTTP server': 'Servidor HTTP',
17 | 'It seems that someone pulled the cable!': '¡Parece que alguien desconectó el cable!',
18 | 'More supported devices': 'Otros dispositivos compatibles',
19 | 'Network port': 'Puerta de red',
20 | 'Network serial ports': 'Puertas serie sobre red',
21 | 'New Arduino translatable project': 'Nuevo proyecto traducible a Arduino',
22 | 'Open from URL...': 'Abre desde una URL...',
23 | 'PWM': 'PWM',
24 | 'Public stage': 'Escenario público',
25 | 'Save, share and get URL...': 'Guarda, comparte y muestra la URL...',
26 | 'Snap4Arduino connector required': 'Conector de Snap4Arduino requerido',
27 | 'Snap4Arduino repository': 'Repositorio de Snap4Arduino',
28 | 'Snap4Arduino website': 'Web de Snap4Arduino',
29 | 'Start a Snap Jr. session': 'Inicia una sesión de Snap Junior',
30 | 'There is already a board connected to this sprite': 'Ya existe una tarjeta conectada a este objeto',
31 | 'This may take a few seconds...': 'Esto puede tardar unos segundos...',
32 | 'This project is now public at the following URL:': 'Este proyecto es público, accessible desde la URL:',
33 | 'Upload firmware on UNO boards': 'Actualitzar el firmware de placas UNO',
34 | 'analog reading _': 'lectura analógica _',
35 | 'angle (0-180)': 'ángulo (0-180)',
36 | 'arduino connected?': '¿arduino connectado?',
37 | 'check to allow the stage\nto be viewed\nfrom the HTTP server': 'marcar para permitir que el escenario\nse visualice desde el servidor HTTP',
38 | 'check to start\nHTTP server, allowing\nremote control\nof Snap4Arduino': 'marcar para iniciar\nel servidor HTTP, habilitando\nel control remoto\nde Snap4Arduino',
39 | 'clockwise (1500-1000)': 'sentido horario (1500-1000)',
40 | 'clockwise': 'sentido horario',
41 | 'connect arduino at _': 'conectar arduino al puerto _',
42 | 'connect to Arduino': 'conectar a Arduino',
43 | 'counter-clockwise (1500-2000)': 'sentido anti-horario (1500-2000)',
44 | 'counter-clockwise': 'sentido anti-horario',
45 | 'digital input': 'entrada digital',
46 | 'digital output': 'salida digital',
47 | 'digital reading _': 'lectura digital _',
48 | 'disconnect Arduino': 'desconectar Arduino',
49 | 'disconnect arduino': 'desconectar arduino',
50 | 'disconnected': 'desconectado',
51 | 'select a port': 'seleccione una puerta',
52 | 'servo': 'servo',
53 | 'set digital pin _ to _': 'fijar pin digital _ en _',
54 | 'set pin _ to value _': 'fijar pin _ al valor _',
55 | 'set servo _ to _': 'fijar servo _ en _',
56 | 'setup digital pin _ as _': 'configurar pin _ como _',
57 | 'stopped (1500)': 'parado (1500)',
58 | 'stopped': 'parado',
59 | 'uncheck to prevent the stage\nfrom being viewed\nfrom the HTTP server': 'desmarcar para evitar que el escenario\nse visualice desde el servidor HTTP',
60 | 'uncheck to stop\nHTTP server': 'desmarcar para detener\nel servidor HTTP'
61 | };
62 | // Add attributes to original SnapTranslator.dict.es
63 | for (var attrname in s4aTempDict) { SnapTranslator.dict.es[attrname] = s4aTempDict[attrname]; }
64 |
--------------------------------------------------------------------------------
/src/s4a/lang-et.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Arduino plaat on ühendatud. Jõudu tööle!',
3 | 'An error was detected on the board\n\n': 'Viga plaadil\n\n',
4 | 'Board is not connected': 'Plaat pole ühendatud',
5 | 'Board was disconnected from port\n': 'Plaat eemaldati pordist\n',
6 | 'Check if firmata is loaded.': 'Veendu, et firmata oleks laaditud.',
7 | 'Connect Arduino': 'Ühenda Arduino',
8 | 'Connecting board at port\n': 'Ühenduse loomine plaadiga pordis\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Arduinoga ei saadud ühendust.\nPlaate ei leitud.',
10 | 'Could not talk to Arduino in port\n': 'Arduinoga suhtlemine ei õnnestu pordis\n',
11 | 'Disconnect Arduino': 'Katkesta ühendus Arduinoga',
12 | 'Error connecting the board.': 'Viga plaadiga ühenduse loomisel.',
13 | 'It seems that someone pulled the cable!': 'Paistab, et keegi tõmbas kaabli välja.',
14 | 'New Arduino translatable project': 'Uus tõlgitav Arduino projekt',
15 | 'PWM': 'PWM',
16 | 'There is already a board connected to this sprite': 'Selle spraidiga on juba plaat seotud.',
17 | 'analog reading _': 'analooglugem viigult _',
18 | 'angle (0-180)': 'nurk (0-180)',
19 | 'clockwise (1500-1000)': 'päripäeva (1500-1000)',
20 | 'clockwise': 'päripäeva',
21 | 'connect arduino at _': 'tekita ühendus arduinoga pordis _',
22 | 'connect to Arduino': 'ühenda Arduino',
23 | 'counter-clockwise (1500-2000)': 'vastupäeva (1500-2000)',
24 | 'counter-clockwise': 'vastupäeva',
25 | 'digital input': 'digitaalne sisend',
26 | 'digital output': 'digitaalne väljund',
27 | 'digital reading _': 'digitaallugem viigult _',
28 | 'disconnect Arduino': 'katkesta ühendus Arduinoga',
29 | 'disconnect arduino': 'katkesta ühendus arduinoga',
30 | 'disconnected': 'ühendus katkestatud',
31 | 'servo': 'servo',
32 | 'set digital pin _ to _': 'määra digitaalviigule _ väärtus _',
33 | 'set pin _ to value _': 'määra viigule _ väärtus _',
34 | 'set servo _ to _': 'määra servoviigule _ väärtus _',
35 | 'setup digital pin _ as _': 'määra digitaalviigu _ režiimiks _',
36 | 'stopped (1500)': 'peatatud (1500)',
37 | 'stopped': 'peatatud'
38 | };
39 | // Add attributes to original SnapTranslator.dict.et
40 | for (var attrname in s4aTempDict) { SnapTranslator.dict.et[attrname] = s4aTempDict[attrname]; }
41 |
--------------------------------------------------------------------------------
/src/s4a/lang-eu.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'About Snap4Arduino...': 'Snap4Arduino-ri buruz...',
3 | 'An Arduino board has been connected. Happy prototyping!': 'Arduino plaka bat konektatu da.\nPrototipatze zoriontsua!',
4 | 'An error was detected on the board\n\n': 'Errore bat detektatu da plakan\n\n',
5 | 'Board is not connected': 'Plaka ez dago konektatuta',
6 | 'Board was disconnected from port\n': 'Plaka atakatik deskonektatu da\n',
7 | 'Check if firmata is loaded.': 'Egiaztatu firmata kargatuta dagoen.',
8 | 'Connect Arduino': 'Konektatu Arduinoa',
9 | 'Connecting board at port\n': 'Plaka atakan konektatzen\n',
10 | 'Connecting to network port:\n': 'Sareko atakara konektatzen:\n',
11 | 'Could not connect an Arduino\nNo boards found': 'Ezin izan da Arduinoa konektatu\nEz da plakarik aurkitu',
12 | 'Could not talk to Arduino in port\n': 'Ezin izan da atakako Arduinoarekin komunikatu\n',
13 | 'Disconnect Arduino': 'Deskonektatu Arduinoa',
14 | 'Enter hostname or ip address:': 'Sartu ostalari-izena edo IP helbidea:',
15 | 'Error connecting the board.': 'Errorea plaka konektatzean.',
16 | 'It seems that someone pulled the cable!': 'Norbaitek kablea atera duela dirudi!',
17 | 'Loading Snap Jr.': 'Snap Jr. kargatzen',
18 | 'Network port': 'Sareko ataka',
19 | 'Network serial ports': 'Sareko serieko atakak',
20 | 'New Arduino translatable project': 'Arduino proiektu itzulgarri berria',
21 | 'Open from URL...': 'Ireki URLtik...',
22 | 'PWM': 'PWM',
23 | 'Save, share and get URL...': 'Gorde, partekatu eta eskuratu URLa...',
24 | 'Snap4Arduino repository': 'Snap4Arduino biltegia',
25 | 'Snap4Arduino website': 'Snap4Arduino webgunea',
26 | 'Start Snap4Arduino in an\nicon-based blocks mode\nfor the youngest programmers': 'Hasi Snap4Arduino\nikonoetan oinarritutako bloke moduan\nprogramatzaile gazteenentzat',
27 | 'Start a Snap Jr. session': 'Hasi Snap Jr. saioa',
28 | 'There is already a board connected to this sprite': 'Dagoeneko plaka bat dago objektu honetara konektatuta',
29 | 'This may take a few seconds...': 'Honek segundo batzuk beharko ditu...',
30 | 'This project is now public at the following URL:': 'Proiektu hau publikoki eskuragarri dago ondorengo URLan:',
31 | 'analog reading _': 'irakurketa analogikoa _ pinean',
32 | 'angle (0-180)': 'angelua (0-180)',
33 | 'arduino connected?': 'arduinoa konektatuta?',
34 | 'clockwise (1500-1000)': 'erlojuaren noranzkoan (1500-1000)',
35 | 'clockwise': 'erlojuaren noranzkoan',
36 | 'connect arduino at _': 'konektatu arduinoa _ atakan',
37 | 'connect to Arduino': 'konektatu Arduinoa',
38 | 'counter-clockwise (1500-2000)': 'erlojuaren aurkako noranzkoan (1500-2000)',
39 | 'counter-clockwise': 'erlojuaren aurkako noranzkoan',
40 | 'digital input': 'sarrera digitala',
41 | 'digital output': 'irteera digitala',
42 | 'digital reading _': 'irakurketa digitala _ pinean',
43 | 'disconnect Arduino': 'deskonektatu Arduinoa',
44 | 'disconnect arduino': 'deskonektatu arduinoa',
45 | 'disconnected': 'deskonektatuta',
46 | 'select a port': 'hautatu ataka',
47 | 'servo': 'serbomotorra',
48 | 'set digital pin _ to _': 'ezarri _ pin digitalean _ balioa',
49 | 'set pin _ to value _': 'ezarri _ pinean _ balioa',
50 | 'set servo _ to _': 'ezarri _ serbomotorra _ bezala',
51 | 'setup digital pin _ as _': 'konfiguratu _ pin digitala _ bezala',
52 | 'stopped (1500)': 'geldituta (1500)',
53 | 'stopped': 'geldituta'
54 | };
55 | // Add attributes to original SnapTranslator.dict.eu
56 | for (var attrname in s4aTempDict) { SnapTranslator.dict.eu[attrname] = s4aTempDict[attrname]; }
57 |
--------------------------------------------------------------------------------
/src/s4a/lang-fr.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'La carte Arduino a \u00E9t\u00E9 connect\u00E9e. Bon prototypage !',
3 | 'An error was detected on the board\n\n': 'Une erreur a \u00E9t\u00E9 d\u00E9tect\u00E9e sur la carte\n\n',
4 | 'Board is not connected': 'La carte n\'est pas connect\u00E9',
5 | 'Board was disconnected from port\n': 'La carte a \u00E9t\u00E9 d\u00E9connect\u00E9e du port\n',
6 | 'Check if firmata is loaded.': 'V\u00E9rifier que firmata est charg\u00E9.',
7 | 'Connect Arduino': 'Connecter Arduino',
8 | 'Connecting board at port\n': 'Connexion de la carte au port\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Impossible de se connecter \u00E0 Arduino\nAucune carte trouv\u00E9e',
10 | 'Could not talk to Arduino in port\n': 'Impossible de communiquer avec Arduino sur le port\n',
11 | 'Disconnect Arduino': 'D\u00E9connecter Arduino',
12 | 'Error connecting the board.': 'Erreur de connexion \u00E0 la carte',
13 | 'It seems that someone pulled the cable!': 'Il semble que quelqu\'un ait arrach\u00E9 le cable !',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'Il y a d\u00E9j\u00E0 une carte connect\u00E9e \u00E0 ce lutin',
16 | 'analog reading _': 'lecture analogique _',
17 | 'angle (0-180)': 'angle (0-180)',
18 | 'clockwise (1500-1000)': 'sens horaire (1500-1000)',
19 | 'clockwise': 'sens horaire',
20 | 'connect arduino at _': 'connecte arduino au port _',
21 | 'connect to Arduino': 'connect\u00E9 \u00E0 Arduino',
22 | 'counter-clockwise (1500-2000)': 'sens anti-horaire (1500-2000)',
23 | 'counter-clockwise': 'sens anti-horaire',
24 | 'digital input': 'entr\u00E9e num\u00E9rique',
25 | 'digital output': 'sortie num\u00E9rique',
26 | 'digital reading _': 'lecture num\u00E9rique _',
27 | 'disconnect Arduino': 'd\u00E9connect\u00E9 \u00E0 Arduino',
28 | 'disconnect arduino': 'd\u00E9connecte arduino',
29 | 'servo': 'servo',
30 | 'set digital pin _ to _': 'mettre la pin num\u00E9rique _ \u00E0 _',
31 | 'set pin _ to value _': 'mettre la pin _ \u00E0 _',
32 | 'set servo _ to _': 'mettre le servo _ \u00E0 _',
33 | 'setup digital pin _ as _': 'mettre la pin num\u00E9rique _ en _',
34 | 'stopped (1500)': 'arr\u00E9t (1500)',
35 | 'stopped': 'arr\u00E9t'
36 | };
37 | // Add attributes to original SnapTranslator.dict.fr
38 | for (var attrname in s4aTempDict) { SnapTranslator.dict.fr[attrname] = s4aTempDict[attrname]; }
39 |
--------------------------------------------------------------------------------
/src/s4a/lang-gl.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'About Snap4Arduino...': 'Sobre Snap4Arduino...',
3 | 'An Arduino board has been connected. Happy prototyping!': 'Conectouse satisfactoriamente unha tarxeta Arduino.\nFeliz prototipaxe!',
4 | 'An error was detected on the board\n\n': 'Detectouse un erro na tarxeta\n\n',
5 | 'Blocks for TdRSTEAM shield v1, using SA5Firmata firmware.': 'Bloques para a TdRSTEAM v1, empregado o SA5Firmata.',
6 | 'Blocks for TdRSTEAM shield v2, using SA5Firmata firmware.': 'Bloques para a TdRSTEAM v2, empregando o SA5Firmata.',
7 | 'Board is not connected': 'A tarxeta non está conectada',
8 | 'Board was disconnected from port\n': 'Desconectouse a tarxeta do porto\n',
9 | 'Check if firmata is loaded.': 'Verifique se o firmware Firmata foi cargado.',
10 | 'Connect Arduino': 'Conectar Arduino',
11 | 'Connecting board at port\n': 'Conectando tarxeta no porto\n',
12 | 'Connecting to network port:\n': 'Conectando ao porto de rede:\n',
13 | 'Could not connect an Arduino\nNo boards found': 'Non se puido conectar un Arduino\nNon se atopou ningunha tarxeta',
14 | 'Could not talk to Arduino in port\n': 'Non se puido comunicar con Arduino no porto\n',
15 | 'Disconnect Arduino': 'Desconectar Arduino',
16 | 'End of Snap4Arduino libraries.': 'Final das bibliotecas do Snap4Arduino.',
17 | 'Enter hostname or ip address:': 'Introduza o nome da máquina ou o seu enderezo IP',
18 | 'Error connecting the board.': 'Produciuse un erro ao conectar a tarxeta',
19 | 'Extra blocks for SnapJunior.': 'Bloques para engadir funcionalidades ao Snap Junior',
20 | 'HTTP server': 'Servidor HTTP',
21 | 'Icon-based blocks for the youngest programmers.': 'Bloques con iconas para os programadores e programadoras máis novos/as.',
22 | 'It seems that someone pulled the cable!': 'Parece que alguén desconectou o cable!',
23 | 'Libraries below this point are specific to Snap4Arduino.': 'As bibliotecas baixo este punto son específicas para Snap4Arduino.',
24 | 'Loading Snap Jr.': 'Snap Junior está a cargarse',
25 | 'Network port': 'Porto de rede',
26 | 'Network serial ports': 'Portos serie sobre rede',
27 | 'New Arduino translatable project': 'Novo proxecto traducible a Arduino',
28 | 'Open from URL...': 'Abrir dende un URL...',
29 | 'PWM': 'PWM',
30 | 'Public stage': 'Escenario público',
31 | 'Save, share and get URL...': 'Garda, comparte e amosa o URL...',
32 | 'Snap4Arduino repository': 'Repositoro do Snap4Arduino',
33 | 'Snap4Arduino website': 'Web do Snap4Arduino',
34 | 'SnapJunior Blocks': 'Bloques do Snap Junior',
35 | 'SnapJuniorPlus Blocks': 'Máis bloques para o Snap Junior',
36 | 'Start Snap4Arduino in an\nicon-based blocks mode\nfor the youngest programmers': 'Inicia Snap4Arduino nun\nmodo de bloques con iconas\npara os/as programadores/as máis novos/as',
37 | 'Start a Snap Jr. session': 'Iniciar unha sesión de Snap Junior',
38 | 'There is already a board connected to this sprite': 'Xa existe unha tarxeta conectada a este obxecto',
39 | 'This may take a few seconds...': 'isto pode levar uns segundos...',
40 | 'This project is now public at the following URL:': 'Este proxecto é público, accesíbel dende o URL:',
41 | 'analog reading _': 'lectura analóxica _',
42 | 'angle (0-180)': 'ángulo (0-180)',
43 | 'arduino connected?': 'Arduino está conectado?',
44 | 'blue': 'azul',
45 | 'check to allow the stage\nto be viewed\nfrom the HTTP server': 'márqueo para permitir que o escenario\nsexa visto dende o servidor HTTP',
46 | 'check to start\nHTTP server, allowing\nremote control\nof Snap4Arduino': 'márqueo para iniciar\no servidor HTTP, permitindo\no control remoto\nde Snap4Arduino',
47 | 'clockwise (1500-1000)': 'sentido horario (1500-1000)',
48 | 'clockwise': 'sentido horario',
49 | 'connect arduino at _': 'conectar Arduino ao porto _',
50 | 'connect to Arduino': 'conectar a Arduino',
51 | 'counter-clockwise (1500-2000)': 'sentido anti-horario (1500-2000)',
52 | 'counter-clockwise': 'sentido anti-horario',
53 | 'digital input': 'entrada dixital',
54 | 'digital output': 'saída dixital',
55 | 'digital reading _': 'lectura dixital _',
56 | 'disconnect Arduino': 'desconectar Arduino',
57 | 'disconnect arduino': 'desconectar Arduino',
58 | 'disconnected': 'desconectado',
59 | 'red': 'vermello',
60 | 'select a port': 'seleccione un porto',
61 | 'servo': 'servo',
62 | 'set digital pin _ to _': 'fixar pin dixital _ en _',
63 | 'set pin _ to value _': 'fixar pin _ ao valor _',
64 | 'set servo _ to _': 'fixar servo _ en _',
65 | 'setup digital pin _ as _': 'configurar pin _ como _',
66 | 'stopped (1500)': 'parado (1500)',
67 | 'stopped': 'parado',
68 | 'uncheck to prevent the stage\nfrom being viewed\nfrom the HTTP server': 'desmarqueo para evitar que o escenario\nsexa visto dende o servidor HTTP',
69 | 'uncheck to stop\nHTTP server': 'desmarque para deter\no servidor HTTP'
70 | };
71 | // Add attributes to original SnapTranslator.dict.gl
72 | for (var attrname in s4aTempDict) { SnapTranslator.dict.gl[attrname] = s4aTempDict[attrname]; }
73 |
--------------------------------------------------------------------------------
/src/s4a/lang-he.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'ארדוינו חובר בהצלחה!',
3 | 'An error was detected on the board\n\n': 'אותרה שגיאה בארדוינו\n\n' ,
4 | 'Arduino':'ארדוינו' ,
5 | 'Board is not connected': 'הארדוינו לא מחובר',
6 | 'Board was disconnected from port\n': 'המעגל נותק\n',
7 | 'Check if firmata is loaded.': 'נא בדוק שפירמטה טעון בארדוינו' ,
8 | 'Connect Arduino': 'התחבר לארדוינו',
9 | 'Connecting board at port\n': 'חבר לכניסה\n',
10 | 'Could not connect an Arduino\nNo boards found': 'לא נמצא ארדוינו לחבר',
11 | 'Could not talk to Arduino in port\n': 'לא ניתן לתקשר עם הארדוינו\n',
12 | 'Disconnect Arduino': 'התנתק מהארדוינו',
13 | 'Error connecting the board.': 'שגיאה בחיבור' ,
14 | 'It seems that someone pulled the cable!': 'נראה שמישהו ניתק את הכבל!',
15 | 'PWM': 'מנוע' ,
16 | 'There is already a board connected to this sprite': 'יש ארדוינו שכבר מחובר לספרייט הזה' ,
17 | 'analog reading _': '_ מ אנלוגית קריאה',
18 | 'angle (0-180)': '(זווית (0-180',
19 | 'clockwise (1500-1000)': '(1500-1000) השעון כוון עם' ,
20 | 'clockwise': 'השעון כוון עם' ,
21 | 'connect arduino at _': '_ לפורט ארדוינו חבר',
22 | 'connect to Arduino': 'התחבר לארדוינו',
23 | 'counter-clockwise (1500-2000)': '(1500-2000) השעון כוון נגד',
24 | 'counter-clockwise': 'השעון כוון נגד',
25 | 'digital input':'כניסה דיגיטלית' ,
26 | 'digital output': 'יציאה דיגיטלית' ,
27 | 'digital reading _': '_ מ ספרתית קריאה' ,
28 | 'disconnect Arduino': 'התנתק מהארדוינו',
29 | 'disconnect arduino': 'התנתק מהארדוינו',
30 | 'servo': 'סרבו',
31 | 'set digital pin _ to _': '_ -ל _ דיגיטליית רגל שנה',
32 | 'set pin _ to value _': '_ -ל _ ברגל PWM קבע',
33 | 'set servo _ to _': '_ -ל _ ברגל מנוע הבא',
34 | 'setup digital pin _ as _': '_ -ב _ רגל קבע',
35 | 'stopped (1500)': '(1500) עצור',
36 | 'stopped': 'עצור'
37 | };
38 | // Add attributes to original SnapTranslator.dict.he
39 | for (var attrname in s4aTempDict) { SnapTranslator.dict.he[attrname] = s4aTempDict[attrname]; }
40 |
--------------------------------------------------------------------------------
/src/s4a/lang-id.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Target telah terhubung. Selamat berkarya!',
3 | 'An error was detected on the board\n\n': 'Ditemukan adanya kesalahan pada target\n\n',
4 | 'Board is not connected': 'Target tidak terhubung',
5 | 'Board was disconnected from port\n': 'Target telah terlepas dari port\n',
6 | 'Check if firmata is loaded.': 'Periksalah apakah firmata telah terpasang.',
7 | 'Connect Arduino': 'Hubungkan Arduino',
8 | 'Connecting board at port\n': 'Menghubungkan target pada port\n',
9 | 'Connecting to network port:\n': 'Menghubungkan ke port jaringan:\n',
10 | 'Could not connect an Arduino\nNo boards found': 'Tidak dapat terhubung dengan Arduino\nTarget tidak ditemukan',
11 | 'Could not talk to Arduino in port\n': 'Tidak dapat terhubung dengan Arduino pada port\n',
12 | 'Disconnect Arduino': 'Lepaskan hubungan Arduino',
13 | 'Enter hostname or ip address:': 'masukkan nama host atau alamat ip:',
14 | 'Error connecting the board.': 'Terjadi kesalahan saat menghubungkan target',
15 | 'It seems that someone pulled the cable!': 'Sepertinya ada yang mencabut kabelnya!',
16 | 'Network port': 'Port jaringan',
17 | 'Network serial ports': 'Port serial jaringan',
18 | 'New Arduino translatable project': 'Buat proyek yang dapat dikonversi ke Arduino',
19 | 'PWM': 'PWM',
20 | 'There is already a board connected to this sprite': 'Sudah ada target yang terhubung ke sprite ini',
21 | 'This may take a few seconds...': 'Ini mungkin membutuhkan beberapa detik...',
22 | 'analog reading _': 'pembacaan analog _',
23 | 'angle (0-180)': 'sudut (0-180)',
24 | 'clockwise (1500-1000)': 'searah jarum jam (1500-1000)',
25 | 'clockwise': 'searah jarum jam',
26 | 'connect arduino at _': 'hubungkan arduino ke port _',
27 | 'connect to Arduino': 'hubungkan dengan Arduino',
28 | 'counter-clockwise (1500-2000)': 'berlawanan jarum jam (1500-2000)',
29 | 'counter-clockwise': 'berlawanan jarum jam',
30 | 'digital input': 'masukan digital',
31 | 'digital output': 'keluaran digital',
32 | 'digital reading _': 'pembacaan digital _',
33 | 'disconnect Arduino': 'lepaskan hubungan dengan Arduino',
34 | 'disconnect arduino': 'lepaskan hubungan dengan arduino',
35 | 'select a port': 'pilih port',
36 | 'servo': 'servo',
37 | 'set digital pin _ to _': 'set pin digital _ menjadi _',
38 | 'set pin _ to value _': 'set pin _ menjadi bernilai _',
39 | 'set servo _ to _': 'set servo _ menjadi _',
40 | 'setup digital pin _ as _': 'atur pin digital _ sebagai _',
41 | 'stopped (1500)': 'berhenti (1500)',
42 | 'stopped': 'berhenti'
43 | };
44 | // Add attributes to original SnapTranslator.dict.id
45 | for (var attrname in s4aTempDict) { SnapTranslator.dict.id[attrname] = s4aTempDict[attrname]; }
46 |
--------------------------------------------------------------------------------
/src/s4a/lang-it.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'La scheda Arduino è correttamente collegata.\nBuona sperimentazione!',
3 | 'An error was detected on the board\n\n': 'Un errore è stato riscontrato sulla scheda\n\n',
4 | 'Board is not connected': 'La scheda non è collegata',
5 | 'Board was disconnected from port\n': 'La scheda è stata scollegata dalla porta\n',
6 | 'Check if firmata is loaded.': 'Verifica che Firmata sia caricato sulla scheda.',
7 | 'Connect Arduino': 'Collega Arduino',
8 | 'Connecting board at port\n': 'Sto collegando la scheda alla porta\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Impossibile collegarsi ad Arduino\nNessuna scheda trovata',
10 | 'Could not talk to Arduino in port\n': 'Impossibile comunicare con Arduino alla porta\n',
11 | 'Disconnect Arduino': 'Scollega Arduino',
12 | 'Error connecting the board.': 'Errore di connessione alla scheda',
13 | 'It seems that someone pulled the cable!': 'Sembra che qualcuno ha staccato il cavo!',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'C\'è già una scheda collegata a questo oggetto',
16 | 'analog reading _': 'lettura analogica _',
17 | 'angle (0-180)': 'angolo (0-180)',
18 | 'clockwise': 'senso orario',
19 | 'clockwise (1500-1000)': 'senso orario (1500-1000)',
20 | 'connect arduino at _': 'collega arduino alla porta _',
21 | 'connect to Arduino': 'collegati ad Arduino',
22 | 'counter-clockwise': 'senso anti-orario',
23 | 'counter-clockwise (1500-2000)': 'senso anti-orario (1500-2000)',
24 | 'digital input': 'ingresso digitale',
25 | 'digital output': 'uscita digitale',
26 | 'digital reading _': 'lettura digitale _',
27 | 'disconnect Arduino': 'scollega Arduino',
28 | 'disconnect arduino': 'scollega arduino',
29 | 'servo': 'servo',
30 | 'set digital pin _ to _': 'imposta il pin digitale _ a _',
31 | 'set pin _ to value _': 'imposta il pin _ a _',
32 | 'set servo _ to _': 'imposta servo _ a _',
33 | 'setup digital pin _ as _': 'imposta il pin _ come _',
34 | 'stopped': 'fermo',
35 | 'stopped (1500)': 'fermo (1500)'
36 | };
37 | // Add attributes to original SnapTranslator.dict.it
38 | for (var attrname in s4aTempDict) { SnapTranslator.dict.it[attrname] = s4aTempDict[attrname]; }
39 |
--------------------------------------------------------------------------------
/src/s4a/lang-ko.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'About Snap4Arduino...': 'Snap4Arduino에 대해...',
3 | 'An Arduino board has been connected. Happy prototyping!': '아두이노 보드가 연결되었습니다!',
4 | 'An error was detected on the board\n\n': '보드에서 오류가 발견되었습니다.\n\n',
5 | 'Board is not connected': '보드가 연결되지 않았습니다.',
6 | 'Board was disconnected from port\n': '다음 포트에서 보드 연결이 끊겼습니다.:\n',
7 | 'Check if firmata is loaded.': 'firmata가 로드되었는지 확인하십시오.',
8 | 'Connect Arduino': '아두이노 연결',
9 | 'Connecting board at port\n': '다음 포트의 보드를 연결 중입니다:\n',
10 | 'Connecting to network port:\n': '다음 네트워크 포트에 연결 중입니다:\n',
11 | 'Could not connect an Arduino\nNo boards found': '아두이노에 연결할 수 없습니다.\n아무 보드도 발견되지 않았습니다.',
12 | 'Could not talk to Arduino in port\n': '다음 포트의 아두이노와 통신할 수 없습니다:\n',
13 | 'Disconnect Arduino': '아두이노 연결 끊기',
14 | 'Enter hostname or ip address:': 'hostname이나 ip 주소를 입력하십시오:',
15 | 'Error connecting the board.': '보드 연결에 오류가 발생했습니다.',
16 | 'It seems that someone pulled the cable!': '케이블이 뽑힌 것 같습니다.',
17 | 'Loading Snap Jr.': 'Snap Jr. 로드 중',
18 | 'Network port': '네트워크 포트',
19 | 'Network serial ports': '네트워크 시리얼 포트',
20 | 'New Arduino translatable project': '새로운 아두이노 변환 가능 프로젝트',
21 | 'Open from URL...': 'URL로부터 열기...',
22 | 'PWM': 'PWM',
23 | 'Save, share and get URL...': '저장, 공유하고 URL 얻기...',
24 | 'Snap4Arduino repository': 'Snap4Arduino 레포지터리',
25 | 'Snap4Arduino website': 'Snap4Arduino 웹사이트',
26 | 'Start Snap4Arduino in an\nicon-based blocks mode\nfor the youngest programmers': '어린 프로그래머를 위해,\nSnap4Arduino를 아이콘 기반 블록 모드로 시작합니다.',
27 | 'Start a Snap Jr. session': 'Snap Jr. 세션 시작하기',
28 | 'There is already a board connected to this sprite': '이 스프라이트에 이미 연결된 보드가 있습니다.',
29 | 'This may take a few seconds...': '몇 초가 걸릴 수 있습니다...',
30 | 'This project is now public at the following URL:': '이 프로젝트는 다음 URL로 접근할 수 있습니다:',
31 | 'analog reading _': '아날로그 입력 _ 번 핀',
32 | 'angle (0-180)': '각도(0-180)',
33 | 'arduino connected?': '아두이노 연결됨?',
34 | 'clockwise (1500-1000)': '시계 방향 (1500-1000)',
35 | 'clockwise': '시계 방향',
36 | 'connect arduino at _': '_ 번 포트의 아두이노 연결하기',
37 | 'connect to Arduino': '아두이노 연결',
38 | 'counter-clockwise (1500-2000)': '반시계 방향 (1500-2000)',
39 | 'counter-clockwise': '반시계 방향',
40 | 'digital input': '디지털 입력',
41 | 'digital output': '디지털 출력',
42 | 'digital reading _': '디지털 입력 _ 번 핀',
43 | 'disconnect Arduino': '아두이노 연결 끊기',
44 | 'disconnect arduino': '아두이노 연결 끊기',
45 | 'disconnected': '연결 끊김',
46 | 'select a port': '포트를 선택하십시오.',
47 | 'servo': '서보',
48 | 'set digital pin _ to _': '디지털 핀 _ 을 _ 로 설정하기',
49 | 'set pin _ to value _': 'PWM 핀 _ 을 _ 으로 설정하기',
50 | 'set servo _ to _': '서보 핀 _ 을 _ 로 설정하기',
51 | 'setup digital pin _ as _': '디지털 핀 _ 을 _ 로 설정하기',
52 | 'stopped (1500)': '정지 (1500)',
53 | 'stopped': '정지'
54 | };
55 | // Add attributes to original SnapTranslator.dict.ko
56 | for (var attrname in s4aTempDict) { SnapTranslator.dict.ko[attrname] = s4aTempDict[attrname]; }
57 |
--------------------------------------------------------------------------------
/src/s4a/lang-nl.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Een Arduino is verbonden. Veel prototyping-plezier!',
3 | 'An error was detected on the board\n\n': 'Er is een fout opgetreden in de Arduino\n\n',
4 | 'Board is not connected': 'Arduino is niet verbonden',
5 | 'Board was disconnected from port\n': 'De verbinding is verbroken op poort\n',
6 | 'Check if firmata is loaded.': 'Controleer of Firmata is geladen.',
7 | 'Connect Arduino': 'verbinding maken',
8 | 'Connecting board at port\n': 'Verbinding maken op poort\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Het is niet gelukt om verbinding te maken met de Arduino\nEr is geen Arduino gevonden',
10 | 'Could not talk to Arduino in port\n': 'Er is geen communicatie mogelijk op poort\n',
11 | 'Disconnect Arduino': 'verbinding verbreken',
12 | 'Error connecting the board.': 'Fout bij het maken van de verbinding.',
13 | 'It seems that someone pulled the cable!': 'Blijkbaar heeft iemand de kabel eruit getrokken!',
14 | 'New Arduino translatable project': 'Nieuw Arduino-project maken',
15 | 'PWM': 'PWM',
16 | 'There is already a board connected to this sprite': 'Er is al een verbinding voor deze sprite',
17 | 'analog reading _': 'lees analoge pin _ uit',
18 | 'angle (0-180)': 'hoek (0-180)',
19 | 'clockwise (1500-1000)': 'rechtsom (1500-1000)',
20 | 'clockwise': 'rechtsom',
21 | 'connect arduino at _': 'verbind Arduino met _',
22 | 'connect to Arduino': 'maak verbinding met Arduino',
23 | 'counter-clockwise (1500-2000)': 'linksom (1500-2000)',
24 | 'counter-clockwise': 'linksom',
25 | 'digital input': 'digitale ingang',
26 | 'digital output': 'digitale uitgang',
27 | 'digital reading _': 'lees digitale pin _ uit',
28 | 'disconnect Arduino': 'verbreek verbinding met Arduino',
29 | 'disconnect arduino': 'verbinding verbreken',
30 | 'servo': 'servo',
31 | 'set digital pin _ to _': 'zet digitale pin _ op _',
32 | 'set pin _ to value _': 'zet pin _ op _',
33 | 'set servo _ to _': 'zet servo _ op _',
34 | 'setup digital pin _ as _': 'stel digitale pin _ in als _',
35 | 'stopped (1500)': 'gestopt (1500)',
36 | 'stopped': 'gestopt'
37 | };
38 | // Add attributes to original SnapTranslator.dict.nl
39 | for (var attrname in s4aTempDict) { SnapTranslator.dict.nl[attrname] = s4aTempDict[attrname]; }
40 |
--------------------------------------------------------------------------------
/src/s4a/lang-pl.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Arduino zostało podłączone. Miłego prototypowania!',
3 | 'An error was detected on the board\n\n': 'Wykryto błąd na płytce\n\n',
4 | 'Board is not connected': 'Płytka nie jest podłączona',
5 | 'Board was disconnected from port\n': 'Płytka została odłączona od portu\n',
6 | 'Check if firmata is loaded.': 'Sprawdź, czy Firmata jest wgrana.',
7 | 'Connect Arduino': 'Połącz z Arduino',
8 | 'Connecting board at port\n': 'Łączenie z płytką na porcie\n',
9 | 'Connecting to network port:\n': 'Łączenie z portem sieciowym:\n',
10 | 'Could not connect an Arduino\nNo boards found': 'Nie udało się połączyć z Arduino\nNie znaleziono płytki',
11 | 'Could not talk to Arduino in port\n': 'Brak komunikacji z Arduino na porcie\n',
12 | 'Disconnect Arduino': 'Odłącz Arduino',
13 | 'Enter hostname or ip address:': 'Wpisz nazwę hosta lub adres ip:',
14 | 'Error connecting the board.': 'Błąd w trakcie podłączania do płytki.',
15 | 'It seems that someone pulled the cable!': 'Wygląda na to że ktoś odłączył kabel!',
16 | 'Network port': 'Port sieciowy',
17 | 'Network serial ports': 'Sieciowe porty szeregowe',
18 | 'PWM': 'PWM',
19 | 'There is already a board connected to this sprite': 'Jest już płytka podłączona do tego duszka',
20 | 'This may take a few seconds...': 'To może potrwać kilka sekund...',
21 | 'analog reading _': 'odczyt analogowy _',
22 | 'angle (0-180)': 'kąt (0-180)',
23 | 'arduino connected?': 'Arduino podłączone?',
24 | 'clockwise (1500-1000)': 'zgodnie z ruchem wskazówek (1500-1000)',
25 | 'clockwise': 'zgodnie z ruchem wskazówek',
26 | 'connect arduino at _': 'połącz z Arduino przez port _',
27 | 'connect to Arduino': 'połącz z Arduino',
28 | 'counter-clockwise (1500-2000)': 'przeciwnie do ruchu wskazówek (1500-2000)',
29 | 'counter-clockwise': 'przeciwnie do ruchu wskazówek',
30 | 'digital input': 'wejście cyfrowe',
31 | 'digital output': 'wyjście cyfrowe',
32 | 'digital reading _': 'odczyt cyfrowy _',
33 | 'disconnect Arduino': 'odłącz Arduino',
34 | 'disconnect arduino': 'odłącz Arduino',
35 | 'disconnected': 'odłączony',
36 | 'select a port': 'wybierz port',
37 | 'servo': 'serwo',
38 | 'set digital pin _ to _': 'ustaw cyfrowy pin _ na _',
39 | 'set pin _ to value _': 'ustaw PWM pin _ na _',
40 | 'set servo _ to _': 'ustaw serwo _ na _',
41 | 'setup digital pin _ as _': 'ustal cyfrowy pin _ jako _',
42 | 'stopped (1500)': 'zatrzymany (1500)',
43 | 'stopped': 'zatrzymany'
44 | };
45 | // Add attributes to original SnapTranslator.dict.pl
46 | for (var attrname in s4aTempDict) { SnapTranslator.dict.pl[attrname] = s4aTempDict[attrname]; }
47 |
--------------------------------------------------------------------------------
/src/s4a/lang-pt.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Uma placa Arduino foi ligada.\nFeliz prototipagem!',
3 | 'An error was detected on the board\n\n': 'Detectou-se um erro na placa\n\n',
4 | 'Board is not connected': 'A placa não está ligada',
5 | 'Board was disconnected from port\n': 'A placa foi desligada do porto\n',
6 | 'Check if firmata is loaded.': 'Verifique se a firmata já foi carregada.',
7 | 'Connect Arduino': 'Ligar Arduino',
8 | 'Connecting board at port\n': 'Ligando placa no porto\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Não foi possível ligar a um Arduino\nNão foram encontradas placas',
10 | 'Could not talk to Arduino in port\n': 'Não foi possível comunicar com o Arduino no porto\n',
11 | 'Disconnect Arduino': 'Desligar Arduino',
12 | 'Error connecting the board.': 'Erro ao ligar à placa',
13 | 'It seems that someone pulled the cable!': 'Parece que alguém desligou o cabo!',
14 | 'New Arduino translatable project': 'Novo projecto traduzível para Arduino',
15 | 'PWM': 'PWM',
16 | 'There is already a board connected to this sprite': 'Este objecto já tem uma placa ligada',
17 | 'analog reading _': 'o valor analógico no pino _',
18 | 'angle (0-180)': 'com ângulo (0-180)',
19 | 'clockwise (1500-1000)': 'no sentido dos ponteiros do relógio (1500-1000)',
20 | 'clockwise': 'no sentido dos ponteiros do relógio',
21 | 'connect arduino at _': 'liga ao Arduino em _',
22 | 'connect to Arduino': 'ligar ao Arduino',
23 | 'counter-clockwise (1500-2000)': 'no sentido contrário aos ponteiros do relógio (1500-2000)',
24 | 'counter-clockwise': 'no sentido contrário aos ponteiros do relógio',
25 | 'digital input': 'entrada digital',
26 | 'digital output': 'saída digital',
27 | 'digital reading _': 'o valor booleano no pino digital _ é «verdadeiro»',
28 | 'disconnect Arduino': 'desligar do Arduino',
29 | 'disconnect arduino': 'desliga do Arduino',
30 | 'disconnected': 'desligado',
31 | 'servo': 'servo',
32 | 'set digital pin _ to _': 'coloca no pino digital _ o valor booleano _',
33 | 'set pin _ to value _': 'coloca no pino (PWM) _ o valor _',
34 | 'set servo _ to _': 'coloca o servo _ _',
35 | 'setup digital pin _ as _': 'configura o pino digital _ como _',
36 | 'stopped (1500)': 'parado (1500)',
37 | 'stopped': 'parado'
38 | };
39 | // Add attributes to original SnapTranslator.dict.pt
40 | for (var attrname in s4aTempDict) { SnapTranslator.dict.pt[attrname] = s4aTempDict[attrname]; }
41 |
--------------------------------------------------------------------------------
/src/s4a/lang-pt_BR.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Um Arduino foi conectado.\nFeliz prototipagem!',
3 | 'An error was detected on the board\n\n': 'Foi detectado um erro na placa\n\n',
4 | 'Board is not connected': 'O Arduino não está conectado',
5 | 'Board was disconnected from port\n': 'A placa foi desconectada da porta\n',
6 | 'Check if firmata is loaded.': 'Verifique se Firmata foi gravado no Arduino',
7 | 'Connect Arduino': 'Conectar Arduino',
8 | 'Connecting board at port\n': 'Conectando o Arduino na porta\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Não consegui conectar a um Arduino\nNão encontrei nenhuma placa',
10 | 'Could not talk to Arduino in port\n': 'Não consegui comunicar com Arduino na porta\n',
11 | 'Disconnect Arduino': 'Desconectar Arduino',
12 | 'Error connecting the board.': 'Erro ao conectar ao Arduino',
13 | 'It seems that someone pulled the cable!': 'Parece que alguém desconectou o cabo!',
14 | 'New Arduino translatable project': 'Novo projeto tradutível para Arduino',
15 | 'PWM': 'PWM',
16 | 'There is already a board connected to this sprite': 'Já há um Arduino conectado e este ator',
17 | 'analog reading _': 'o valor analógico no pino _',
18 | 'angle (0-180)': 'com ângulo (0-180)',
19 | 'clockwise (1500-1000)': 'no sentido horário (1500-1000)',
20 | 'clockwise': 'no sentido horário',
21 | 'connect arduino at _': 'conecte Arduino em _',
22 | 'connect to Arduino': 'conectar ao Arduino',
23 | 'counter-clockwise (1500-2000)': 'no sentido anti-horário (1500-2000)',
24 | 'counter-clockwise': 'no sentido anti-horário',
25 | 'digital input': 'entrada digital',
26 | 'digital output': 'saída digital',
27 | 'digital reading _': 'o valor booleano no pino digital _ é «verdadeiro»',
28 | 'disconnect Arduino': 'desconectar do Arduino',
29 | 'disconnect arduino': 'desconecte Arduino',
30 | 'disconnected': 'desligado',
31 | 'servo': 'servo',
32 | 'set digital pin _ to _': 'coloque no pino digital _ o valor booleano _',
33 | 'set pin _ to value _': 'coloque no pino _ o valor _',
34 | 'set servo _ to _': 'posicione o servo _ em _',
35 | 'setup digital pin _ as _': 'configure o pino digital _ como _',
36 | 'stopped (1500)': 'parado (1500)',
37 | 'stopped': 'parado'
38 | };
39 | // Add attributes to original SnapTranslator.dict.pt_BR
40 | for (var attrname in s4aTempDict) { SnapTranslator.dict.pt_BR[attrname] = s4aTempDict[attrname]; }
41 |
--------------------------------------------------------------------------------
/src/s4a/lang-ru.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Плата Arduino успешно подключена.\nИнтересных экспериментов!',
3 | 'An error was detected on the board\n\n': 'С данной платой возникли проблемы\n\n',
4 | 'Board is not connected': 'Плата отключена',
5 | 'Board was disconnected from port\n': 'Плату была отключена от порта\n',
6 | 'Check if firmata is loaded.': 'Проверить, загружен ли скетч Firmata.',
7 | 'Connect Arduino': 'Подключиться к Arduino',
8 | 'Connecting board at port\n': 'Подключение к плате через порт\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Невозможно пдключиться к Arduino\nНе найдено ни одной платы',
10 | 'Could not talk to Arduino in port\n': 'Ошибка обмена данными с Arduino через порт\n',
11 | 'Disconnect Arduino': 'Отключиться от Arduino',
12 | 'Error connecting the board.': 'Невозможно подключиться к плате.',
13 | 'It seems that someone pulled the cable!': 'Возможно, USB кабель был отключен!',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'К этому спрайту уже подключена плата',
16 | 'analog reading _': 'аналоговое значение _',
17 | 'angle (0-180)': 'угол (0-180)',
18 | 'clockwise (1500-1000)': 'по часовой стрелке (1500-1000)',
19 | 'clockwise': 'по часовой стрелке',
20 | 'connect arduino at _': 'подключиться к arduino через _',
21 | 'connect to Arduino': 'подключиться к Arduino',
22 | 'counter-clockwise (1500-2000)': 'против часовой стрелки (1500-2000)',
23 | 'counter-clockwise': 'против часовой стрелки',
24 | 'digital input': 'цифровой вход',
25 | 'digital output': 'цифровой виход',
26 | 'digital reading _': 'цифровое значение _',
27 | 'disconnect Arduino': 'отключиться от Arduino',
28 | 'disconnect arduino': 'Отключиться от arduino',
29 | 'servo': 'серво',
30 | 'set digital pin _ to _': 'изменить статус цифрового разъема _ на _',
31 | 'set pin _ to value _': 'изменить статус разъема PWM _ на _',
32 | 'set servo _ to _': 'изменить статус разъема серво _ нa _',
33 | 'setup digital pin _ as _': 'настроить режим цифрового разъема _ как _',
34 | 'stopped (1500)': 'остановлен (1500)',
35 | 'stopped': 'остановлен'
36 | };
37 | // Add attributes to original SnapTranslator.dict.ru
38 | for (var attrname in s4aTempDict) { SnapTranslator.dict.ru[attrname] = s4aTempDict[attrname]; }
39 |
--------------------------------------------------------------------------------
/src/s4a/lang-sv.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Ett Arduino kort har anslutits. Skapa n\u00e5got trevligt.',
3 | 'An error was detected on the board\n\n': 'Ett fel har uppt\u00e4ckts på arduino kortet\n\n',
4 | 'Are you sure you want to leave?': '\u00C4r du s\u00E4ker du vill avsluta?',
5 | 'Board is not connected': 'Arduino \u00e4r inte ansluten',
6 | 'Board was disconnected from port\n': 'Ett Arduino kort har fr\u00e5nkopplats fr\u00e5n port\n',
7 | 'Check if firmata is loaded.': 'Kontrollera att firmata \u00e4r installerad.',
8 | 'Connect Arduino': 'Anslut Arduino',
9 | 'Connecting board at port\n': 'Ansluter arduino till port\n',
10 | 'Connecting to network port:\n': 'Ansluter till n\u00e4tverksport:\n',
11 | 'Could not connect an Arduino\nNo boards found': 'Kunde inte ansluta\nInga Arduino kort hittades',
12 | 'Could not talk to Arduino in port\n': 'Kan inte kommunicera med Arduino på port\n',
13 | 'Disconnect Arduino': 'Fr\u00e5koppla Arduino',
14 | 'Enter hostname or ip address:': 'Ange v\u00e4rdnamn eller ip-adress:',
15 | 'Error connecting the board.': 'Ett fel uppstod n\u00e4r Arduino kortet skulle anslutas.',
16 | 'It seems that someone pulled the cable!': 'Det ser ut som att n\u00e5gon drog ur kabeln!',
17 | 'Network port': 'N\u00e4tverksport',
18 | 'Network serial ports': 'N\u00e4tverksserieportar',
19 | 'New Arduino translatable project': 'Nytt \u00f6vers\u00e4ttningsbart Arduino projekt',
20 | 'PWM': 'PWM',
21 | 'There is already a board connected to this sprite': 'Ett Arduino kort \u00e4r redan anslutet till denna sprite',
22 | 'This may take a few seconds...': 'Det kan ta n\u00e5gra sekunder...',
23 | 'analog reading _': 'analog avl\u00e4sning _',
24 | 'angle (0-180)': 'vinkel (0-180)',
25 | 'clockwise (1500-1000)': 'medsols (1500-1000)',
26 | 'clockwise': 'medsols',
27 | 'connect arduino at _': 'anslut arduino till _',
28 | 'connect to Arduino': 'anslut Arduino',
29 | 'counter-clockwise (1500-2000)': 'motsols (1500-2000)',
30 | 'counter-clockwise': 'motsols',
31 | 'digital input': 'Digital ing\u00e5ng',
32 | 'digital output': 'Digital utg\u00e5ng',
33 | 'digital reading _': 'digital avl\u00e4sning _',
34 | 'disconnect Arduino': 'fr\u00e5koppla Arduino',
35 | 'disconnect arduino': 'fr\u00e5koppla arduino',
36 | 'disconnected': 'fr\u00e5nkopplad',
37 | 'select a port': 'v\u00e4lj en port',
38 | 'servo': 'servo',
39 | 'set digital pin _ to _': 's\u00e4tt digital pin _ till _',
40 | 'set pin _ to value _': 's\u00e4tt pin _ till v\u00e4rde _',
41 | 'set servo _ to _': 's\u00e4tt servo _ till _',
42 | 'setup digital pin _ as _': 'konfigurera digital pin _ som _',
43 | 'stopped (1500)': 'stoppad (1500)',
44 | 'stopped': 'stoppad'
45 | };
46 | // Add attributes to original SnapTranslator.dict.sv
47 | for (var attrname in s4aTempDict) { SnapTranslator.dict.sv[attrname] = s4aTempDict[attrname]; }
48 |
--------------------------------------------------------------------------------
/src/s4a/lang-tr.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Arduino kartına bağlanıldı. İyi eğlenceler!',
3 | 'An error was detected on the board\n\n': 'HATA! Arduino kartı üzerinde hata bulundu.\n\n',
4 | 'Board is not connected': 'Arduino kartı bağlı değil.',
5 | 'Board was disconnected from port\n': 'Port bağlantısı kesildi port\n',
6 | 'Check if firmata is loaded.': 'Frimata nın yüklü oldup olmadığını kontrol edin.',
7 | 'Connect Arduino': 'Seri Porta Bağlan',
8 | 'Connecting board at port\n': 'Arduino kartına bağlanıyor port\n ',
9 | 'Could not connect an Arduino\nNo boards found': 'Aruino ya bağlanılamadı\nKart bulunamadı.',
10 | 'Could not talk to Arduino in port\n': 'Arduino ile iletişim kurulamadı port\n',
11 | 'Disconnect Arduino': 'Bağlantıyı Kes',
12 | 'Error connecting the board.': 'HATA! Arduino ya bağlanırken hata oluştu.',
13 | 'It seems that someone pulled the cable!': 'HATA! Bağlantı kablosunu kontrol edin!',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'Bu karakter zaten bir Arduino ya bağlı.',
16 | 'analog reading _': 'Analog pin oku A _',
17 | 'angle (0-180)': 'Açı (0-180)',
18 | 'clockwise (1500-1000)': 'Saat Yönü (1500-1000)',
19 | 'clockwise': 'Saat Yönü',
20 | 'connect arduino at _': 'Ardunio ya bağlan port: _',
21 | 'connect to Arduino': 'Arduino ya bağlan',
22 | 'counter-clockwise (1500-2000)': 'Saat Yönünün Tersi (1500-2000)',
23 | 'counter-clockwise': 'Saat Yönünün Tersi',
24 | 'digital input': 'Sayısal Giriş',
25 | 'digital output': 'Sayısal Çıkış',
26 | 'digital reading _': 'Sayısal pin oku D _',
27 | 'disconnect Arduino': 'Arduino Bağlantısını Kes',
28 | 'disconnect arduino': 'Ardunio bağlantısını kes',
29 | 'servo': 'Servo',
30 | 'set digital pin _ to _': 'Sayısal pin D _ değerini _ yap',
31 | 'set pin _ to value _': 'Sayısal pin D _ değerini _ yap',
32 | 'set servo _ to _': 'Servo pin D _ değerini _ yap',
33 | 'setup digital pin _ as _': 'Sayısal pin D _ durumunu _ yap',
34 | 'stopped (1500)': 'Durduruldu (1500)',
35 | 'stopped': 'Durduruldu'
36 | };
37 | for (var attrname in s4aTempDict) { SnapTranslator.dict.tr[attrname] = s4aTempDict[attrname]; }
38 |
--------------------------------------------------------------------------------
/src/s4a/lang-ua.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Вдале з\u2019єднання з платою Arduino.\nЦікавих експериментів!',
3 | 'An error was detected on the board\n\n': 'З цією платою виникли проблеми\n\n',
4 | 'Board is not connected': 'Плату від\u2019єднано',
5 | 'Board was disconnected from port\n': 'Плату було від\u2019єднано від порту\n',
6 | 'Check if firmata is loaded.': 'Перевірити, чи завантажено скетч Firmata.',
7 | 'Connect Arduino': 'З\u2019єднатися з Arduino',
8 | 'Connecting board at port\n': 'З\u2019єднання з платою через порт\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Неможлио з\u2019єднатися з Arduino\nНе знайдено жодної плати',
10 | 'Could not talk to Arduino in port\n': 'Помилка обміну даними з Arduino через порт\n',
11 | 'Disconnect Arduino': 'Від\u2019єднатися від Arduino',
12 | 'Error connecting the board.': 'Неможило з\u2019єднатися з платою.',
13 | 'It seems that someone pulled the cable!': 'Можливо, USB кабель було від\u2019єднано!',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'З цим спрайтом вже існує з\u2019єднання',
16 | 'analog reading _': 'аналогове значення _',
17 | 'angle (0-180)': 'кут (0-180)',
18 | 'arduino connected?': 'arduino під\u2019єднано?',
19 | 'clockwise (1500-1000)': 'за годинниковою стрілкою (1500-1000)',
20 | 'clockwise': 'за годинниковою стрілкою',
21 | 'connect arduino at _': 'з\u2019єднатися з arduino використовуючи _',
22 | 'connect to Arduino': 'з\u2019єднатися з Arduino',
23 | 'counter-clockwise (1500-2000)': 'проти годинникової стрілки (1500-2000)',
24 | 'counter-clockwise': 'проти годинникової стрілки',
25 | 'digital input': 'цифровий вхід',
26 | 'digital output': 'цифровий вихід',
27 | 'digital reading _': 'цифрове значення _',
28 | 'disconnect Arduino': 'від\u2019єднатися від Arduino',
29 | 'disconnect arduino': 'від\u2019єднатися від arduino',
30 | 'servo': 'серво',
31 | 'set digital pin _ to _': 'встановити цифровий пін _ як _',
32 | 'set pin _ to value _': 'встановити пін PWM _ як _',
33 | 'set servo _ to _': 'встановити пін серво _ як _',
34 | 'setup digital pin _ as _': 'налаштувати цифровий пін _ як _',
35 | 'stopped (1500)': 'зупинено (1500)',
36 | 'stopped': 'зупинено'
37 | };
38 | // Add attributes to original SnapTranslator.dict.ua
39 | for (var attrname in s4aTempDict) { SnapTranslator.dict.ua[attrname] = s4aTempDict[attrname]; }
40 |
--------------------------------------------------------------------------------
/src/s4a/lang-uk.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': 'Вдале з\u2019єднання з платою Arduino.\nЦікавих експериментів!',
3 | 'An error was detected on the board\n\n': 'З цією платою виникли проблеми\n\n',
4 | 'Board is not connected': 'Плату від\u2019єднано',
5 | 'Board was disconnected from port\n': 'Плату було від\u2019єднано від порту\n',
6 | 'Check if firmata is loaded.': 'Перевірити, чи завантажено скетч Firmata.',
7 | 'Connect Arduino': 'З\u2019єднатися з Arduino',
8 | 'Connecting board at port\n': 'З\u2019єднання з платою через порт\n',
9 | 'Could not connect an Arduino\nNo boards found': 'Неможлио з\u2019єднатися з Arduino\nНе знайдено жодної плати',
10 | 'Could not talk to Arduino in port\n': 'Помилка обміну даними з Arduino через порт\n',
11 | 'Disconnect Arduino': 'Від\u2019єднатися від Arduino',
12 | 'Error connecting the board.': 'Неможило з\u2019єднатися з платою.',
13 | 'It seems that someone pulled the cable!': 'Можливо, USB кабель було від\u2019єднано!',
14 | 'PWM': 'PWM',
15 | 'There is already a board connected to this sprite': 'З цим спрайтом вже існує з\u2019єднання',
16 | 'analog reading _': 'аналогове значення _',
17 | 'angle (0-180)': 'під кутом (0-180)',
18 | 'clockwise (1500-1000)': 'за годинниковою стрілкою (1500-1000)',
19 | 'clockwise': 'за годинниковою стрілкою',
20 | 'connect arduino at _': 'З\u2019єднатися з arduino використовуючи _',
21 | 'connect to Arduino': 'з\u2019єднатися з Arduino',
22 | 'counter-clockwise (1500-2000)': 'проти годинникової стрілки (1500-2000)',
23 | 'counter-clockwise': 'проти годинникової стрілки',
24 | 'digital input': 'цифровий вхід',
25 | 'digital output': 'цифровий вихід',
26 | 'digital reading _': 'цифрове значення _',
27 | 'disconnect Arduino': 'від\u2019єднатися від Arduino',
28 | 'disconnect arduino': 'Від\u2019єднатися від arduino',
29 | 'servo': 'серво',
30 | 'set digital pin _ to _': 'змінити статус цифрового роз\u2019єму _ на _',
31 | 'set pin _ to value _': 'змінити статус роз\u2019єму PWM _ на _',
32 | 'set servo _ to _': 'змінити статус роз\u2019єму серво _ нa _',
33 | 'setup digital pin _ as _': 'налаштувати режим цифрового роз\u2019єму _ як _',
34 | 'stopped (1500)': 'зупинено (1500)',
35 | 'stopped': 'зупинено'
36 | };
37 | // Add attributes to original SnapTranslator.dict.uk
38 | for (var attrname in s4aTempDict) { SnapTranslator.dict.uk[attrname] = s4aTempDict[attrname]; }
39 |
--------------------------------------------------------------------------------
/src/s4a/lang-zh_CN.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': '接上Arduino板了,祝你玩得愉快!',
3 | 'An error was detected on the board\n\n': '在控制板上发现错误\n\n',
4 | 'Board is not connected': '没有连接控制板',
5 | 'Board was disconnected from port\n': '控制板已中断连接,端口:\n',
6 | 'Check if firmata is loaded.': '检查是否已经加载Firmata固件。',
7 | 'Connect Arduino': '连接到Arduino板',
8 | 'Connecting board at port\n': '正在连接控制板,端口:\n',
9 | 'Connecting to network port:\n': '连线到网络端口:\n',
10 | 'Could not connect an Arduino\nNo boards found': '无法连接到Arduino\n找不到控制板',
11 | 'Could not talk to Arduino in port\n': '无法与Arduino联系,端口:\n',
12 | 'Disconnect Arduino': '断开与Arduino的连接',
13 | 'Enter hostname or ip address:': '输入主机名或IP地址:',
14 | 'Error connecting the board.': '连接控制板时发生错误',
15 | 'It seems that someone pulled the cable!': '看来有人拔掉连接线了!',
16 | 'Network port': '网络端口 ',
17 | 'Network serial ports': '网络串口',
18 | 'New Arduino translatable project': '新增Arduino可转译项目',
19 | 'PWM': 'PWM',
20 | 'There is already a board connected to this sprite': '已经有一个控制板连接到这个角色了',
21 | 'This may take a few seconds...': '可能要等数秒…',
22 | 'analog reading _': '模拟输入值 _',
23 | 'angle (0-180)': '角度 (0-180)',
24 | 'clockwise (1500-1000)': '顺时针 (1500-1000)',
25 | 'clockwise': '顺时针',
26 | 'connect arduino at _': '连接位于 _ 的Arduino板',
27 | 'connect to Arduino': '连接到Arduino板',
28 | 'counter-clockwise (1500-2000)': '逆时针 (1500-2000)',
29 | 'counter-clockwise': '逆时针',
30 | 'digital input': '数字输入',
31 | 'digital output': '数字输出',
32 | 'digital reading _': '数字输入值 _',
33 | 'disconnect Arduino': '断开与Arduino的连接',
34 | 'disconnect arduino': '断开与Arduino的连接',
35 | 'disconnected': '断开连接',
36 | 'select a port': '选择一个端口',
37 | 'servo': '舵机',
38 | 'set digital pin _ to _': '数字脚 _ 设置成 _',
39 | 'set pin _ to value _': '_ 脚的值设置成 _',
40 | 'set servo _ to _': '_ 脚的舵机设置成 _',
41 | 'setup digital pin _ as _': '数字脚 _ 设置成 _',
42 | 'stopped (1500)': '停止 (1500)',
43 | 'stopped': '停止'
44 | };
45 | // Add attributes to original SnapTranslator.dict.zh_CN
46 | for (var attrname in s4aTempDict) { SnapTranslator.dict.zh_CN[attrname] = s4aTempDict[attrname]; }
47 |
--------------------------------------------------------------------------------
/src/s4a/lang-zh_TW.js:
--------------------------------------------------------------------------------
1 | s4aTempDict = {
2 | 'An Arduino board has been connected. Happy prototyping!': '接上Arduino板了,祝你玩得愉快!',
3 | 'An error was detected on the board\n\n': '在控制板上發現錯誤\n\n',
4 | 'Board is not connected': '沒有連接控制板',
5 | 'Board was disconnected from port\n': '控制板已中斷連線了,通訊埠:\n',
6 | 'Check if firmata is loaded.': '檢查是否已經載入Firmata韌體。',
7 | 'Connect Arduino': '連接到Arduino板',
8 | 'Connecting board at port\n': '正在連接控制板,通訊埠:\n',
9 | 'Connecting to network port:\n': '連線到網路通訊埠:\n',
10 | 'Could not connect an Arduino\nNo boards found': '無法連接到Arduino\n找不到控制板',
11 | 'Could not talk to Arduino in port\n': '無法與Arduino聯繫,通訊埠:\n',
12 | 'Disconnect Arduino': '斷開與Arduino的連接',
13 | 'Enter hostname or ip address:': '輸入主機名稱或IP位址:',
14 | 'Error connecting the board.': '連接控制板時發生錯誤',
15 | 'It seems that someone pulled the cable!': '看來有人拔掉連接線了!',
16 | 'Network port': '網路通訊埠',
17 | 'Network serial ports': '網路序列埠',
18 | 'New Arduino translatable project': '新增Arduino可轉譯專案',
19 | 'PWM': 'PWM',
20 | 'There is already a board connected to this sprite': '已經有一個控制板連接到這個角色了',
21 | 'This may take a few seconds...': '可能要等數秒…',
22 | 'analog reading _': '類比輸入值 _',
23 | 'angle (0-180)': '角度 (0-180)',
24 | 'clockwise (1500-1000)': '順時針 (1500-1000)',
25 | 'clockwise': '順時針',
26 | 'connect arduino at _': '連接位於 _ 的Arduino板',
27 | 'connect to Arduino': '連接到Arduino板',
28 | 'counter-clockwise (1500-2000)': '逆時針 (1500-2000)',
29 | 'counter-clockwise': '逆時針',
30 | 'digital input': '數位輸入',
31 | 'digital output': '數位輸出',
32 | 'digital reading _': '數位輸入值 _',
33 | 'disconnect Arduino': '斷開與Arduino的連接',
34 | 'disconnect arduino': '斷開與Arduino的連接',
35 | 'disconnected': '斷開連接',
36 | 'select a port': '選擇一個通訊埠',
37 | 'servo': '伺服馬達',
38 | 'set digital pin _ to _': '數位腳 _ 設定成 _',
39 | 'set pin _ to value _': '_ 腳的值設定成 _',
40 | 'set servo _ to _': '_ 腳的伺服馬達設定成 _',
41 | 'setup digital pin _ as _': '數位腳 _ 設置成 _',
42 | 'stopped (1500)': '停止 (1500)',
43 | 'stopped': '停止'
44 | };
45 | // Add attributes to original SnapTranslator.dict.zh_TW
46 | for (var attrname in s4aTempDict) { SnapTranslator.dict.zh_TW[attrname] = s4aTempDict[attrname]; }
47 |
--------------------------------------------------------------------------------
/src/s4a/lists.js:
--------------------------------------------------------------------------------
1 | List.prototype.toJSON = function () {
2 | return this.itemsArray();
3 | };
4 |
5 | List.prototype.toCSV = function () {
6 | // Expects the list to be properly mappable into a
7 | // two-dimensional table.
8 | return this.asArray().map(function (eachRow) {
9 | return eachRow.asArray().map(function (eachCell) {
10 | return JSON.stringify(eachCell);
11 | }).join(',');
12 | }).join('\n');
13 | };
14 |
--------------------------------------------------------------------------------
/src/s4a/morphic.js:
--------------------------------------------------------------------------------
1 | WorldMorph.prototype.Arduino = Arduino;
2 |
3 | WorldMorph.prototype.originalInit = WorldMorph.prototype.init;
4 | WorldMorph.prototype.init = function (aCanvas, fillPage) {
5 | this.originalInit(aCanvas, fillPage);
6 |
7 | // We need to override reportVersion and queryFirmware so that, in the event that the
8 | // cable is unplugged during a connection attempt, it does not try to write to the serial.
9 | // For some reason, the chrome.serial API freezes the serial port forever otherwise.
10 |
11 | this.Arduino.firmata.prototype.originalReportVersion = this.Arduino.firmata.prototype.reportVersion;
12 | this.Arduino.firmata.prototype.reportVersion = function (callback) {
13 | if (this.transport.connectionId === undefined || this.transport.connectionId > 0) {
14 | this.originalReportVersion(callback);
15 | }
16 | };
17 | this.Arduino.firmata.prototype.originalQueryFirmware = this.Arduino.firmata.prototype.queryFirmware;
18 | this.Arduino.firmata.prototype.queryFirmware = function (callback) {
19 | if (this.transport.connectionId === undefined || this.transport.connectionId > 0) {
20 | this.originalQueryFirmware(callback);
21 | }
22 | };
23 |
24 | };
25 |
--------------------------------------------------------------------------------
/src/s4a/store.js:
--------------------------------------------------------------------------------
1 | // Force disconnection of connected sprites before opening a new project
2 | SnapSerializer.prototype.originalOpenProject = SnapSerializer.prototype.openProject;
3 | SnapSerializer.prototype.openProject = function (project, ide) {
4 | // Disconnect each sprite before opening the new project
5 | var sprites = ide.sprites.asArray();
6 | sprites.forEach(function(sprite) {
7 | if (sprite.arduino && sprite.arduino.board) {
8 | sprite.arduino.disconnect(true);
9 | }
10 | });
11 |
12 | this.originalOpenProject(project, ide);
13 | };
14 |
15 | IDE_Morph.prototype.getURL('version', function (version) {
16 | SnapSerializer.prototype.app = 'Snap4Arduino ' + version + ', http://snap4arduino.rocks';
17 | });
18 |
19 | SnapSerializer.prototype.watcherLabels['reportAnalogReading'] = 'analog reading %analogPin';
20 | SnapSerializer.prototype.watcherLabels['reportDigitalReading'] = 'digital reading %digitalPin';
21 |
22 | WatcherMorph.prototype.originalToXML = WatcherMorph.prototype.toXML;
23 | WatcherMorph.prototype.toXML = function (serializer) {
24 | var color = this.readoutColor,
25 | position = this.parent ?
26 | this.topLeft().subtract(this.parent.topLeft())
27 | : this.topLeft();
28 |
29 | if (this.getter === 'reportAnalogReading'
30 | || this.getter === 'reportDigitalReading') {
31 | console.log('got u');
32 | return serializer.format(
33 | '',
34 | serializer.format(' scope="@"', this.target.name),
35 | serializer.format('s="@" p="@"', this.getter, this.pin),
36 | this.style,
37 | '',
38 | position.x,
39 | position.y,
40 | color.r,
41 | color.g,
42 | color.b,
43 | '',
44 | this.isVisible ? '' : ' hidden="true"'
45 | );
46 | } else {
47 | return this.originalToXML(serializer);
48 | }
49 |
50 | };
51 |
--------------------------------------------------------------------------------
/src/version:
--------------------------------------------------------------------------------
1 | 10.3.6
2 |
--------------------------------------------------------------------------------