Giter VIP home page Giter VIP logo

scratch-arduino-extension's People

Contributors

damellis avatar khanning avatar mourgolikos avatar

Stargazers

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

Watchers

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

scratch-arduino-extension's Issues

Impossible to install the plugins for firefox

Hi guys,

i try to download the plugins for firefox by following this :
http://khanning.github.io/scratch-arduino-extension/gettingstarted.html
https://scratch.mit.edu/info/ext_download/
when i click on ScratchDevice.msi windows open and close after fews sec i dont see any new plugins in my firefox.

then i run :
http://scratchx.org/?url=http://khanning.github.io/scratch-arduino-extension/arduino_extension.js&lang=fr.com#scratch

Button on arduino stay on red even with my arduino plug on usb with standardfirmdata sketch uploaded on it.

Can you Help me ? thanks

scratch-arduino-extension and Grove module

Hi Khanning,

this is Ruiyun from Seeedstudio, we noticed that your scratch-arduino-extension project are very helpful in education field. I think we can make it better together.

Could you pls contact me to discuss this project? my mail is [email protected].

Looking for your reply!

Ruiyun

Indicator under "More Blocks" stays yellow, disconnected, Chrome, Windows 8.1

I am at a loss about what to do next. I have installed both halves of the browser extension. I ran a simple blink program to verify that pin 9 of the Arduino board was correctly connected to the LED. I then installed the StandardFirmata from the examples library. This seems to have worked.
But the indicator stays yellow. Opening the javascript console reveals these messages.

59 Attempting connection with COM3
arduino_extension.js:521 Uncaught TypeError: Cannot read property 'set_receive_handler' of null
2 arduino_extension.js:508 Attempting connection with COM3
48 arduino_extension.js:508 Attempting connection with COM3
arduino_extension.js:508 Attempting connection with COM3
230 arduino_extension.js:508 Attempting connection with COM3

COM3 is, in fact, the correct serial device. It is the one I use in the Arduino software. Furthermore, when the scratchx extension is loaded, the transmit and receive lights are flashing on the board, more or less constantly, several times per 10 seconds. If I kill that tab, the lights stop flashing.

If I then click on http://scratchx.org/?url=http://khanning.github.io/scratch-arduino-extension/arduino_extension.js#scratch then the transmit and receive conversation starts again. The pin 13 light flashes. The RX and TX lights flash. The indicator on the page stays yellow.

So SOMETHING that is associated with that tab has com3 open and is talking to it. But whatever that thing is, it is not talking to the indicator on the page. It stays yellow and reports disconnected.

In a couple trys, I can get the port monitor included with the arduino software open. Resetting the rate to 57600 gives

S t a n d a r d F i r m d a t a . i n o ÷

I think the spaces are nulls, I can't cut and paste them.

Reloading the page, then loading the sample blink program produces the following in the javascript console:

Navigated to http://scratchx.org/?url=http://khanning.github.io/scratch-arduino-extension/arduino_extension.js
4 arduino_extension.js:508Attempting connection with COM3
arduino_extension.js:521 Uncaught TypeError: Cannot read property 'set_receive_handler' of null(anonymous function) @ arduino_extension.js:521
3 arduino_extension.js:508 Attempting connection with COM3

And, by the way, when all this happens, the chatter with the board starts again. RX, TX,and flashes too fast to count on the special port 13 LED.

I see the gear logo on the top line of the page, right next to the three horizontal bars for settings. But nothing shows up on chrome://plugins about this plugin, even though its symbol is on the page top.

So I am at a loss. I think that the helper function is somehow not talking to the plugin. I have uninstalled the plugin and reinstalled it.

I wanted to see if I could get this to work because my 8 year old grandson has said he in interested in robotics. We are going to build a MeArm and I really would like it if he could program it. I am not sure I can teach him C, in fact I have my doubts that I could teach anyone C, despite years of coding in it. So if someone could help I would appreciate it.

NanoPlayBoard can not connect with ScratchX (Mac + Firefox browser)

Hi @khanning,

Before all I would like to congratulate for your project, it is so awesome and I really like it :)

I would like to develop an scratchx extension for NanoPlayBoard, a educational shield for Arduino Nano, but there is an issue with the Arduino Nano with the CH340 USB to Serial chip, because these devices use ports that begin with /dev/tty.wchusbserial.

In this issue, you comment that on Mac, the browser plug-in is looking for ports in /dev that begin with tty.usbmodem, tty.serial or tty.usbserial. I think this is the reason I can not connect my NanoPlayBoard.

Do you know if there is available the source code of the Scratch Device Plugin?

I would like to review the source code and try to modify it in order to make it works with NanoPlayBoad, but I have not found the source code anywhere. Could you help me?

Thanks!

Add a "change LED brightness by" block?

This might be nice, as right now it's hard to fade LEDs (requires creating variables, if-statements to wrap around from 100 back to 0, etc). I'm not sure what we'd do when you hit 0 or 100, though. Maybe wrap around? Or bounce-back (start incrementing in the opposite direction)?

arduino dosent work

I try to make the arduino extension work but on firefox witch is recomended the scratchx site dosnt work properly. i upload the extension file for other browsers and it does nothing it gives me the same window to give the extension file again. I tried it on chrome but i see no yellow or green button on the board. Please help me i need it to work

What happened to Scratch Device Plugin?

When I try to the plug in, I recieve:
404 Whoops our server is scratching it's head...can't find the page you're looking for...

Is it not currently available or can I find somewhere else?

Drop-down missing in <button pressed?> block.

Right now, the block says "button 1" and the drop-down arrow doesn't work (nothing opens). Do you think you have time to fix this before our workshop tomorrow?

Also, the [rotate servo by ()] block defaults to showing "servo 1", although the drop-down correctly shows servo A, servo B, etc.

This is all testing with the master branch.

Getting the extension to work

I clicked install extension and allow program to make changes to computer, I installed the chrome plugin helper, I have installed firmatastandard on my arduino board and plugged it in, but the dot is yellow and it says disconnected. What can I try?

Tutorial on calibrating a temperature sensor?

One thought for something that might be a good extended tutorial is calibrating a temperature sensor. That is, taking two readings with both the sensor and a thermometer, and then using the map block to map the sensor values to actual temperatures. This may be more complicated than our simple examples, but it might be good if we create some slightly more complex tutorials.

Computer reboots when using scratchx arduino experimental interface

I followed the steps to enable communication between my Arduinoi and ScratchX using the experimental Arduino extension.

I then experienced 4 reboots of my PC once I had started using the interface. Seemed to be at random times into working with the interface but all within a minute or 2. I was just experimenting with blinking a LED - nothing fancy.

This seems directly realated to using the scratchx interface. It started directly after configuring it all up (enabling chrome add-on etc.) and only happens once I drag an Arduino related block or 2 to the interface.

Adruino Nano
Windows 8.1
Chrome (unknown version right now)

Race condition

Chrome 45 windows 8.1 probably affects others using a HC-06 bluetoooth to serial adapter

With my setup line: 507 "set_receive_handler" callback would be processed before line: 506

"device.open" would finish, so the device was not set when it was called and it would return without

setting the receive handler.

So I tried moving the "set_receive_handler" call to the ready callback for "device.open".

I was able to connect and set the LED pins. Although the readback was a little spotty.

I think the polling function might need some fine turning for the high latency.

console.log('Attempting connection with ' + device.id);
    device.open({ stopBits: 0, bitRate: 57600, ctsFlowControl: 0 }, function() {
      device.set_receive_handler(function(data) {
        var inputData = new Uint8Array(data);
        processInput(inputData);
      });
    });

Unable to connect to Arduino - windows

This is a near duplicate of Robbie Berg's report in Issue #19, but with the important difference that my OS is Windows 7 Home Premium SP1. I have chosen to open another issue so as not to 'pollute' or confuse the existing discusssion, but obviously if you want to close or merge this report because of their similarity you should do so.

I have tried using both Firefox and Chrome browsers, installing and enabling the appropriate plugins and helpers.

In all cases, the extension appears to load and creates the Arduino label under More Blocks, but the status indicator remains Yellow. The logging console repeatedly logs "Attempting connection with COM4". [This comes from the function tryNextDevice() ] I think it might be significant that at this point my system flat-lines with 100% cpu usage - my hunch is that the code is spinning hard on a lock or some other resource conflict.

Loading the _debug version of the extension (as advised in #19) gives the same result.

Running the standard online Scratch2 editor and loading a locally saved copy of Arduino Debug Test.sb2 (again as referenced in #19) results in the extension loading AND giving a Green status indicator. But it does not give a working solution: dragging SET PIN x ON blocks onto the stage and clicking them does not actually change the LED status.

The tail of the log is as follows -
Uint8Array [ 121, 2, 3, 47, 0, 109, 0, 110, 0, 116, 4086 more… ] d347dd92d983e6c6eeb44cd1b206aa6a:180:4
"Input Data:" d347dd92d983e6c6eeb44cd1b206aa6a:511:6
Uint8Array [ 240, 121, 2, 3, 47, 0, 109, 0, 110, 0, 95 more… ] d347dd92d983e6c6eeb44cd1b206aa6a:512:6
"Sysex Message:" d347dd92d983e6c6eeb44cd1b206aa6a:179:4
Uint8Array [ 121, 2, 3, 47, 0, 109, 0, 110, 0, 116, 4086 more… ] d347dd92d983e6c6eeb44cd1b206aa6a:180:4
"Input Data:" d347dd92d983e6c6eeb44cd1b206aa6a:511:6
Uint8Array [ 240, 121, 2, 3, 47, 0, 109, 0, 110, 0, 95 more… ] d347dd92d983e6c6eeb44cd1b206aa6a:512:6
"Sysex Message:" d347dd92d983e6c6eeb44cd1b206aa6a:179:4
Uint8Array [ 121, 2, 3, 47, 0, 109, 0, 110, 0, 116, 4086 more… ] d347dd92d983e6c6eeb44cd1b206aa6a:180:4
"Error opening serial device COM4: TypeError: r is null" project_base.js:8:5201
"Attempting connection with COM4" d347dd92d983e6c6eeb44cd1b206aa6a:508:4

To try to eliminate as many other factors as possible:
I have checked my serial port (CP210x) and arduino (a 'shrimp' clone) by using codebender to upload a basic 'blink' sketch, and then replacing it with the StandardFirmata sketch. I have checked the installation of the Firmata sketch by running a trivial python script from the pymata package which blinks the on-board LED. 'COM4' is the id of the serial port sucessfully used by these other tests.

Unlike your other correspondent I am not working geographically close to you: I am 'over the pond' in Leicester, UK, so I am not familiar with any of the other named collaborators in this project.

ScratchX Arduino not connecting (Mac+Chrome browser)

I have installed the plug-ins and the animated LED and Pico sprite work, but there is no successful connection to the Arduino that has Standard Firmata installed on it. In the Chrome browser console, it displays:

attempting connection with /dev/tty.usbmodemfa131 arduino_extension.js:506

where the link for the extension is:

http://scratchx.org/?url=http://khanning.github.io/scratch-arduino-extension/examples/Arduino%20Example%20-%20Blink%20an%20LED.sbx

The Extensions list shows:

Scratch Device Plugin Helper 2.1.2.0

which says that it also requires the Scratch Device Plugin, which I did install. However, Google also says that after Sept. 1, 2015 NPAPI plug-ins are not supported:

https://support.google.com/chrome/answer/6213033?hl=en

Has anyone gotten ScratchX Arduino browser working in Chrome on a Mac since Sept. 1, 2015?

Language translations for Scratch blocks

If anyone is interested in translating the Scratch blocks into another language please submit a pull request or just comment on this issue with your translation.

To submit a pull request:

  1. In the arduino_extension.js file, add a new key to the 'blocks' and 'menus' objects for the desired language. The key should be the languages two or three digit ISO 639 Language Code.

  2. Translate just the bolded text in the block and menu descriptors:

    var blocks = { 
      en: [
        ['h', 'when device is connected', 'whenConnected'],
        [' ', 'connect %m.hwOut to pin %n', 'connectHW', 'led A', 3], 
        [' ', 'connect %m.hwIn to analog %n', 'connectHW', 'rotation knob', 0], 
        ['-'],
        [' ', 'set %m.leds %m.outputs', 'digitalLED', 'led A', 'on'],
        [' ', 'set %m.leds brightness to %n%', 'setLED', 'led A', 100],
        [' ', 'change %m.leds brightness by %n%', 'changeLED', 'led A', 20],
        ['-'],
        [' ', 'rotate %m.servos to %n degrees', 'rotateServo', 'servo A', 180],
        [' ', 'rotate %m.servos by %n degrees', 'changeServo', 'servo A', 20],
        ['-'],
        ['h', 'when %m.buttons is %m.btnStates', 'whenButton', 'button A', 'pressed'],
        ['b', '%m.buttons pressed?', 'isButtonPressed', 'button A'],
        ['-'],
        ['h', 'when %m.hwIn %m.ops %n%', 'whenInput', 'rotation knob', '>', 50],
        ['r', 'read %m.hwIn', 'readInput', 'rotation knob'],
        ['-'],
        [' ', 'set pin %n %m.outputs', 'digitalWrite', 1, 'on'],
        [' ', 'set pin %n to %n%', 'analogWrite', 3, 100],
        ['-'],
        ['h', 'when pin %n is %m.outputs', 'whenDigitalRead', 1, 'on'],
        ['b', 'pin %n on?', 'digitalRead', 1], 
        ['-'],
        ['h', 'when analog %n %m.ops %n%', 'whenAnalogRead', 1, '>', 50],
        ['r', 'read analog %n', 'analogRead', 0], 
        ['-'],
        ['r', 'map %n from %n %n to %n %n', 'mapValues', 50, 0, 100, -240, 240]
      ],
    };
    
    var menus = {
        en: {
          buttons: ['button A', 'button B', 'button C', 'button D'],
          btnStates: ['pressed', 'released'],
          hwIn: ['rotation knob', 'light sensor', 'temperature sensor'],
          hwOut: ['led A', 'led B', 'led C', 'led D', 'button A', 'button B', 'button C', 'button D', 'servo A', 'servo B', 'servo C', 'servo D'],
          leds: ['led A', 'led B', 'led C', 'led D'],
          outputs: ['on', 'off'],
          ops: ['>', '=', '<'],
          servos: ['servo A', 'servo B', 'servo C', 'servo D']
        }
    }; 
    
  3. Submit a pull request against the master branch.

Thank you!

Hat block for button presses (and releases)

A good starting point could be when a button is pressed. In addition, we might want to have a drop-down where you could also select "released".

(There are other possibilities, like long-presses and double-presses, and, in contrast to those, regular single-presses. But I think we can leave these until later.)

Link to GitHub issues from documentation?

Should we link to the GitHub issues from the documentation page for the extension? Right now, I only see a link for submitting new language translations. And / or should be linking somewhere else for people who need help with the extension (and only link to the GitHub issues for suggested improvements)?

Periodic disconnects with Arduino Leonardo (ATmega32U4).

When using the Arduino Leonardo, I'm seeing occasional disconnects. Every ten seconds or so (but seemingly not at regular intervals), the status indicator for the Arduino extension turns yellow, then turns green again. When this happens, I see this in the error console:

[Log] Attempting connection with /dev/tty.usbmodem1411 (arduino_extension.js, line 506)
[Log] Querying /dev/tty.usbmodem1411 capabilities (arduino_extension.js, line 152)
[Log] Querying /dev/tty.usbmodem1411 analog mapping (arduino_extension.js, line 159)

Any ideas?

Arduino not connected message in ScratchX

I get as far as loading the Scratch Arduino extension into ScratchX (running Safari 8.0.6, OS X 10.10.3, Arduino Uno running standard Firmata), where I can see the new blocks, but not communicate with the Arduino. (Status light remains yellow, Arduino disconnected message). This problem is not unique to the Scratch Arduino extension but rather stems from a general inability to find the serial port from ScratchX. For example, a similar thing happens when I try to load the PicoBoard extension in ScratchX, even though PicoBoards work fine when I load the extension from Scratch 2.0.

When I try using Firefox or Chrome I don't even get this far - I can't even successfully get the Scratch Browser plug-in to load in with of those browsers. I haven't tried a Windows machine yet.

I'd be grateful for any suggestions you might have. This work is part of a project that I'm working on with LLK (with Mitchel, Natalie, and Tim). Thanks!

Robbie Berg

Use of "turn pin X on"

As discussed via email, I recommend not using the word "turn" as it is a "reserved" word in Scratch meaning to rotate.

I suggest using
set pin X on

instead

Order of Blocks

As discussed by email
A lot of the blocks are Grove specific.

I'd suggest moving them down the list and promoting generic Arduino pin writing/reading blocks to the top

Scratchx for Arduino: Yellow Light, "Disconnected"

I just sat down to start my first project using my arduino and scratchx. I am new to both, but enjoy tinkering so I thought I would give it a try.

Problem: Scratchx is not recognizing my arduino

Here are the steps that I have taken:
(1) Installed Arduino software
(2) Tested Arduino software by making the LED on port 13 blink
(3) Installed the scratch extension - Windows (other web browsers)
(4) Open Scratchx in Mozilla & allow scratch.org to run scratch device & allow and remember scratchx.org to run plugins adobe flash and scratch device. (the light is yellow and says "disconnected" when I hover over it with my mouse)
(5) Follow the Scratchx Arduino tutorial using a breadboard, 220 ohm resistor, and an LED
(6) Only the LED in scratch's stage blinks, not the LED on my breadboard
(7) Test my breadboard set up - Adjust the program in the Arduino software to use pin 9 and run the program - it works - the LED on my breadboard blinks

Additional information: When I am in scratchx and I unplug the arduino from the computer I get a dialog box message that says:

scratchx.org says:
Serial device error
Device: COM3
Error: The file handle supplied is not valid

What should I try in order to get scratchx to recognize the arduino? I tried changing USB ports on the computer.

Move getting started instructions to separate web pages?

What do you think about moving the installation instructions to a separate page? Obviously people need to follow the instructions in order to use the extension, but I worry that having them on the main page makes the whole thing seem confusing and overwhelming. Removing them from the main page could let people get a better sense of what the extension does and why they might want to use it before they dive into the details of actually getting it installed. What do you think?

Maybe one version that's for people who already have Arduino installed and a separate page for people that don't? We'd have to duplicate some content between the two, but it would make them easier to follow.

Arduino does not stay connected

Hello,

I am having trouble with this plugin; the Arduino does not stay connected for more than a few seconds. Here are the specs of what I am running:

Arduino Uno R3
Windows 8.1
Arduino 1.8.0
StandardFirmata last updated October 16th, 2016
Firefox 50.1.0
Adobe Flash 24.0.0.186
http://scratchx.org/?url=http://khanning.github.io/scratch-arduino-extension/examples/Arduino%20Example%20-%20Blink%20an%20LED.sbx

I have no problem interacting with the Arduino board via the Firmata test app (firmata_test.exe), for any length of time. When I run the Scratch Arduino Extension in ScratchX, I get the green indicator that the board is connected and I can see activity on the TX and RX LEDs, but after a few seconds the indicator light turns yellow and the RX light goes off but TX remains on. Here are the messages from the browser console:

window.controllers is deprecated. Do not use it for UA detection.
Attempting connection with COM3
Querying COM3 capabilities
Querying COM3 analog mapping
Attempting connection with COM3 [this repeats until I close the tab]

Occasionally, I will also get the following error, sometimes before or sometimes after the connection is dropped:

TypeError: device is null

The same thing happens every time, even after closing and restarting everything. I would be happy to provide more information if needed.

Thank you.

Sincerely,
Joshua

Should we remove the alerts for now?

It seems relatively common to end up in a situation in which they're constantly coming up (e.g. within a forever block), which feels much worse to me than not having them appear when you want them. What do you think?

Extension doesn't work with ConfigurableFirmata.

I tried the Arduino extension with ConfigurableFirmata (https://github.com/firmata/ConfigurableFirmata) which might become the future standard implementation of Firmata. The protocol should be the same, supposedly, but the code is written in a way to make it easier for people to pick and choose which features to include.

I'm seeing this error when I run the extension:

[Error] TypeError: undefined is not an object (evaluating 'pinModes[storedInputData[i-1]].push')
    processSysexMessage (arduino_extension.js, line 179)
    processInput (arduino_extension.js, line 224)
    (anonymous function) (arduino_extension.js, line 505)
    (anonymous function)
    (anonymous function)

Any idea what's going on? This isn't particularly urgent, but we may want to support ConfigurableFirmata eventually.

Esplora Support

Will there be support for Esplora functionality such as write RGB, read Slider, button A-D. Or are there default analog/digital pins I should be using for those?

Windows 10 firefox

Hi I tried to install the scratch device plugin for other browsers on windows 10 and use it on Firefox.

I followed the following steps:

  1. I downloaded the Scratch Device Plug in for other browers plug in.
  2. I installed the plug in. ( i get small quick window that last for about half a second). I assumed it installed when it disappears.
  3. When i checked my firefox add-ons I see the scratch device plug in ( i clicked on always active)
  4. I went to: http://scratchx.org/?url=http://khanning.github.io/scratch-arduino-extension/arduino_extension.js#home

I can't click anything, the website is not responsive.

Analog input limited to 0-100?

The analog input returns a floored value between 1-100 instead of 0-1024, this means cheaper sensors like TMP36 don't work very well as they aren't sensitive enough to show big changes. Could we change it to return raw sensor values instead?

Integrated resistors

Hi,
The Scratch extension seems to switch on the integrated Pulldown resistors on Arduino input pins. I am working on a project with sensor contacts like MakeyMakey http://www.makeymakey.com/. There I cannot use any integrated resistors. Is there a way to switch them of in the Scratch extension?

Adding new translations?

Looks like we have a few new translations (Japanese and Italian in pull requests) and Norwegian and Portuguese in issue #15. Do you have time to incorporate these? Anything I can do to help?

Fixed connection problem with scratchx and Arduino

Hello

In the last few days I have tried to use the extensions of scratchx and Arduino on different PCs.
The problem was always the same, it was connected for a few seconds and then disconnected.

I found the solution that seems to be stable.

At this point, the recommended procedure for Scratchx and Arduino works and is stable.

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.