Code Monkey home page Code Monkey logo

s2a_fm's Introduction

s2a_fm

Join the chat at https://gitter.im/MrYsLab/s2a_fm

Sublime's custom image

A New Version For Python 3.5, called s2aio, Is Available Here.

Arduino users! Would you like to configure and control your Arduino micro-controller without having to write a single line of Arduino sketch code and at the same time have access to a graphical user interface?

Scratch and Snap! programmers! Would you like to control and communicate with an Arduino board using Scratch? Imagine, using Scratch to control physical devices such as LEDs, motors, and relays while monitoring devices, such as temperature sensors, potentiometers, and light sensors. What would you create?

Want to do motor control using Snap! and Wifi? Check out our article on Physical Computing. http://www.instructables.com/id/The-SnapMobile-Start-Your-Physical-Computing-Engin/

All the code is included here!

s2a_fm is a Scratch/Snap! hardware extension written in Python allowing Scratch or Snap! and an Arduino micro-controller to communicate seamlessly.

Program Block translations are included for Chinese, Dutch, English (default), French, German, Greek, Italian, Korean, Portuguese, Spanish, and Taiwanese.

Make sure you get the latest version of the Scratch Off-Line editor if you are using Scratch (version 404 or greater).

Check Out Our Blog

http://mryslab.blogspot.com/

Installation Instructions

The s2a_fm Reference Manual, s2a_fm_reference.pdf, located in the documentation directory of this distribution, provides full installation instructions.

Alternative Japanese Block Translation May 30, 2017

Translations provided through the generosity of Hiroaki Kawashima

Japanese Block Translation Oct 17 2016

Translations provided through the generosity of Antoine Choppin

Greek Block Translation Feb 3, 2015

Translations provided through the generosity of Alexandros Moskofidis

Italian Block Translation Dec 12, 2014

Translations provided through the generosity of Gianfranco Zuliani

New Language Translation October 9, 2014

Taiwanese translation provided through the courtesy of Hsu Jen-Chieh.

Version 1.5 Apr 12, 2014

New Features for 1.5

Korean translation provided through the generosity of Dr. Eungil Kim

Portuguese and German translations of Block Text provided through the generosity of Aldo von Wangenheim, from www.computacaonaescola.ufsc.br

A Chinese translation of the reference manual was graciously provided by Yufangjun 发自我的小米手机

Version 1.4 Mar 23, 2014

New Feature for 1.4

Chinese translation of Block Text provided through the generosity of Professor YuFangjun

French translation of Block Text provided through the generosity of Professor Sebastien Canet .

Version 1.3 Feb 23, 2014

New Features for 1.3

  1. Support for the upcoming Snap!Mobile Physical Computing Project in "Instructables"

  2. Spanish Translation of Block Text and a Spanish Tutorial provided courtesy of Professor José Manuel Ruiz

Version 1.2 Jan 1, 2014

New Features for 1.2:

  1. Support for Snap! 4.0 provided.

  2. Support for up to 4 simultaneous HC-SR04 type "Ping" Sensors. (This requires using PyMata version 1.54 or greater and the FirmataPlus Arduino sketch supplied with PyMata 1.54).

  3. Dutch translation for the Scratch/Snap! Block Text included (Thanks to Sjoerd Dirk Meijer).

  4. Provision to translate Scratch/Snap! Block Text to any language.

Version 1.1 December 19, 2013

New Features for 1.1:

  1. When enabling a digital pin, the pin capabilty is verified for the requested mode.

  2. A new Scratch debugger command block has been added to help debug Scratch scripts.

Known Snap! 4.0 Extension Issues

None.

Known Scratch 2.0 Extension Issues

All previous major issues have been resolved as of version 404 of the Off-Line editor.

None.

Scratch s2a_fm Extension Blocks

ScreenShot

Snap! s2a_fm Extension Blocks

ScreenShot

Wiring Diagrams for Examples

ScreenShot

ScreenShot

s2a_fm's People

Contributors

gitter-badger avatar japonophile avatar memakura avatar mryslab avatar

Stargazers

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

Watchers

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

s2a_fm's Issues

Port not open

When I attempt to run the install as per the reference manual (python s2a_fm.py /dev/ttyACM0) the RX LED on my Arduino Mega blinks rapidly but then I get the following exception: serial.serialutil.SerialException: Attempting to use a port that is not open.
As far as I can tell I did not skip an installation step. Attached is the terminal output for the complete messages.
s2a_fm error

Need to fix TYPO in HTTP response header

Hi,

During test, I found one TYPO in HTTP response header.
Please refer below my local patch.

In scratch_http_server.py
$ git diff scratch_http_server.py
diff --git a/scratch_http_server.py b/scratch_http_server.py
index e8337da..ec763b7 100644
--- a/scratch_http_server.py
+++ b/scratch_http_server.py
@@ -104,7 +104,7 @@ class GetHandler(BaseHTTPRequestHandler):
# http_response = str(response + calf)
http_response = "HTTP/1.1 200 OK" + calf
http_response += "Content-Type: text/html; charset=ISO-8859-1" + calf
- http_response += "Content-Length" + str(len(response)) + calf
+ http_response += "Content-Length: " + str(len(response)) + calf
http_response += "Access-Control-Allow-Origin: *" + calf
http_response += calf
#add the response to the nonsense above

Regards,

100% CPU usage

Hello,
I am getting 100% CPU usage when I start the script. It Starts aber the Board was detected and does not end, even though the script is more or less idling and waiting for scratch to start.
Using it on Arch Linux, but should not make a huge difference!
Greetings,
Mirko

Italian translation

I already have an italian translation for your Scratch extension for Arduino. According to your instructions I provided a new file s2a_fm_It.s2e and have modified xlate.cfg.

How can I provide these files to you?

s2a_fm.bat enhancement

Firstly, many thanks for s2a_fm. I'm about to start using it as a first step in robotics for some 10 years olds. A few issues cropped up in my preparation which I thought I'd share and you can incorporate if you wish.

The Arduino's have USB serial numbers which mean that they enumerate on unique COM ports on windows. To aid startup I needed a batch file which finds the right COM port and passes it in to s2a_fm. Batch files really aren't my thing, but here's what I've done:

for /f "tokens=4 delims=: " %%A in ('mode ^| findstr "COM[0-9]*:"') do c:\python27\python.exe s2a_fm.py %%A

This strips the colon from the first COM port found and passes it in to s2a_fm. It works for me because I've no built in COM ports. If you know of a better way, including it in the extra goodies would be great.

Issue moved from s2aio

This is the original issue from @sobreira reported in s2aio issue #8:

Hi MrYsLab.
I'd really like to thank you for great work, in fact we try to widespread the knownledge about your creation for lots of schools in Brazil.
We still use the Python 2.7 and I try to connect the HC-SR04.
I followed all steps above mentioned however Scratch or Snap can´t read any information from the sensor.

To make a test, I have installed the new Python and I did what you asked on your comment from25 Jul.
By this worked fine well, however, back to PyMata, Python 2.7 and s2a_fm, the Sonar not work.

For all the other other things, the system performs as expected.

I really appreciate your help on this.

Thanks!

Edson
hackeduca.com

Mac OS X crash

On Mac OS X, I can't get this working.

Any suggestions?

python s2a_fm.py /dev/tty.usbmodemfd121

s2a_fm version 1.3 Copyright(C) 2013-14 Alan Yorinks All Rights Reserved

Opening Arduino Serial port /dev/tty.usbmodemfd121
Please wait while Arduino is being detected. This can take up to 30 seconds ...
Board Auto Discovery Failed!, Shutting Down
Exception in thread Thread-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/Library/Python/2.7/site-packages/PyMata/pymata_serial.py", line 99, in run
if self.arduino.inWaiting():
File "/Library/Python/2.7/site-packages/serial/serialposix.py", line 449, in inWaiting
s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)

IOError: [Errno 9] Bad file descriptor

Floating point values

Hi again,

Scratch2 starts using floating point at the drop of a hat, so if a user scales down an analog input (10 bit int) to an 8 bit value for PWM output the result is a floating point value. Scratch2 does have a 'round' function which can be used, but I think it would be good if s2a_fm also handled this. I had a quick look and the PWM case could be handled by changing line 454 of scratch_command_handlers.py from

            self.firmata.analog_write(pin, int(command[self.CMD_VALUE]))

to

            self.firmata.analog_write(pin, int(float(command[self.CMD_VALUE])))

There may be a more Python way of doing this, what do you think?

Thanks
Dave

osX, can't detect board.

s2a_fm version 1.5   Copyright(C) 2013-14 Alan Yorinks    All Rights Reserved 

Python Version 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

PyMata version 2.10  Copyright(C) 2013-15 Alan Yorinks    All rights reserved.

Opening Arduino Serial port /dev/tty.usbmodem1411 

Please wait while Arduino is being detected. This can take up to 30 seconds ...
Board Auto Discovery Failed!, Shutting Down
Traceback (most recent call last):
  File "./s2a_fm.py", line 145, in <module>
    s2a_fm()
  File "./s2a_fm.py", line 80, in s2a_fm
    firmata.analog_mapping_query()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyMata/pymata.py", line 216, in analog_mapping_query
    self._command_handler.send_sysex(self._command_handler.ANALOG_MAPPING_QUERY, None)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyMata/pymata_command_handler.py", line 619, in send_sysex
    self.pymata.transport.write(data)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyMata/pymata_serial.py", line 107, in write
    self.arduino.write(data)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/serial/serialposix.py", line 490, in write
    if not self._isOpen: raise portNotOpenError
serial.serialutil.SerialException: Attempting to use a port that is not open

Seems I cannot communicate with the board. Using the same tty I can upload code to Arduino via Arduino app.

Some Scratch commands stop working after using custom blocks

file loaded: s2a_fm_base

A script containing custom blocks (enable digital pin and digital writes) headed by a green flag only works when clicking the whole block but not the green flag. Same happens with other green flag blocks. Also it is not possible to open or create a new file without closing first the application.

Versions:

  • OSX 10.9.1
  • Arduino UNO with Standard Firmata uploaded.
  • Scratch 2 v385
  • Python 2.7.6

Releases

Hi, You should use the Release feature on Github to package your releases.

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.