GithubHelp home page GithubHelp logo

s2aio's Introduction

Program, control and monitor an Arduino board using the Scratch or Snap! visual programming languages without having to learn C++.

Included with s2aio are programming blocks for the following languages:

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

  • English (EN)
  • Chinese (zh-CN)
  • Chinese (zh-TW)
  • Dutch (NL)
  • French (FR)
  • German (DE)
  • Greek (GR)
  • Korean (KO)
  • Italian (IT)
  • Portuguese (PT)
  • Polish (PL)
  • Spanish (ES)

Features

  • Written in Python using the new Python 3.5 asyncio library.
  • Cross platform - works with Windows, Mac and Linux (including Debian Raspberry Pi).
  • Easy to install.
  • Easy to use.

Want to learn more? Check out the Wiki pages.

This project was developed using Pycharm PyCharm

s2aio's People

Contributors

gitter-badger avatar hackeduca avatar mirko314 avatar mryslab avatar wrata 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s2aio's Issues

irda in s2aio

has anyone tried to set up irda (lirc) communication in s2aio? it's about pilot control ....

s2aio shuts down too quickly on a slow computer

Firstly, thank you for s2aio. It works wonderfully! But I did encounter an issue when using it on slow computers:

I got hold off some old laptops to use for educational purposes (CoderDojo). I found that s2aio correctly finds my Arduino, then it launches Scratch, and then it "immediately" shuts down again, before Scratch becomes usable.

I traced the problem to your Python "main.py" script in the poll_watchdog function. You wait 2 seconds there before shutting down s2aio when Scratch no longer sends keep-alive messages. Then what happens for me is that current_time is a large number, but self.poll_time_stamp is still 0, because Scratch was still starting for me. Consequently, s2aio shuts down, thinking that Scratch was shut down.

I found that it took my Scratch roughly 10s-15s before sending its first keep-alive message.

Would it be an idea to simply make the initial waiting time 30-60 seconds? I don't think there are any disadvantages to that (other than if the user closes Scratch within 30-60 seconds).
If you don't want to do that, a decent alternative might be to post a solution to this problem on the wiki: "Increase the number in line 787 of main.py considerably:"
await asyncio.sleep(2)
(And, in case of posting it to a wiki, perhaps tell people where to find that file.)

Path on Windows 10 does not accept spaces

When installing on Windows 10 the client cannot be found and the error states the path is "c:\program".

Installing to C:\ results in a path error of "c:\scratch" as the scratch 2 install path is "c:\Scratch 2".

Renaming this to C:\scratch2\scratch2.exe and setting the path in the configuration file results in the client starting up although it shuts down very fast.

-c no_client allows s2aio to stay up but the blocks are not installed under scratch 2.

Please advise.

Offline Version for pip instalation

===============================
Hi Alan, First of all, congratulation for your work.
Lots of schools in Brazil are using your solution for integration between Arduino and Scratch.
Some years ago I created an instalation packgage using pymata and s2a_fm(arduino IDE, scratch, phyton 2.7 and adobe air - also a little bit of batch command to perform all steps automatically without user intervention) - credits always maintained for your work.
The main purpose was to cover the lack of internet, in some schools and the low computer/python knowledge.

In the end, the user will install the package and once it's installed, selected the port, suggested by a program that call all available COM ports (used Windows Powershell for this purpose )

===============================
Now I am try to replicate the same idea for S2aio and pymata-aio with Python 3.5, however the pip installation requires internet conection.

Is there a way to get an offiline version of all package installed by "pip install s2aio" , keep it in a directory and perform an installation from there, instead of the "Python Package Index"?

If is not possible for sure I have to continue promoting the previous version.

Thanks!

Edson Sobreira

S2aio shutsdown a few minutes after starting

I have recently installed S2aio and Scratch 2 offline editor following the directions in your write-up and it installs and runs for a few minutes but then the S2aio shuts down, even though I have scratch open and am using it with the extra blocks. I have tried the -s option with upto 120 but that did not resolve the issue. Scratch does start and I can use it with the Arduino perfectly, but the S2aio just shuts down after a few minutes.

Noy very familar with python coding so I can't give you much more for troubleshooting. I am using it on a Mac.

Thanks
Andy

Traceback error

Dear MrYsLab,

I'm using Linux (ubuntu), python3.5, and I was not able to use s2aio.
I already tried using -c no_client, -h, but I always get the same result.
When I try to start it, it shows me the following message:

Traceback (most recent call last):
File "/usr/local/bin/s2aio", line 9, in
load_entry_point('s2aio==1.8', 'console_scripts', 's2aio')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 351, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2363, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2088, in load
entry = import(self.module_name, globals(),globals(), ['name'])
File "/usr/local/lib/python3.4/dist-packages/s2aio/main.py", line 158
async def kick_off(self, my_loop):
^
SyntaxError: invalid syntax

After reading the closed issues I also tried downgrading pyserial to 2.7, but it did not make any difference.
Could you help me?

Sonar example not working

Hey MrYsLab..
I'd really like to thank you for your work, it really helped a lot in my project, I've been trying to use an ultrasonic sensor HC-SR04 but I just couldn't manage to get any readings from it. I tried using the example attached in the zip file I downloaded from your library, still not working. I'm not sure what am I doing wrong, as I managed to play with dc motors, IR sensors, etc. The conncetion is an accordance to the instructions in the refrence file, I'm kinda puzzled right now, any advice would be appreciated.
Regards.

Task was destroyed bit it is pending

Hi I am looking forward to try this new extension. I followed the instructions on your Wiki but i get the following error when following the Starting S2AIO for scratch:

C:\Users\ooled>s2aio

pymata_aio Version 2.11 Copyright (c) 2015 Alan Yorinks All rights reserved.

Using COM Port:com4

Initializing Arduino - Please wait... Auto-discovery complete. Found 20 Digital Pins and 6 Analog Pins

Task was destroyed but it is pending!
task: <Task pending coro=<PymataCore._command_dispatcher() running at c:\users\ooled\appdata\local\programs\python\python35\lib\sitepackages\pymata_aio\pymata_core.py:1232> wait_for=>

I verified that i am running python 3.5.1.

Can you please help me solve this issue?

Arduino Yun

Hi!
I have an Arduino Yun. With s4aio I can not connect to it.
there is a way?
I see this project: https://github.com/MrYsLab/s2aiomulti which, as I understand it, also manages more devices through IP and password (the routing map).
It is possible to use Yun with s2aio or i must use s2aiomulti ?

thanks a lot <3

Unstable startup "NoneType" object is not iteratable

Hi MrYsLab,

Thanks for the nice and light weight application, it has been very useful for using in the teaching environment.

Sometimes I get upon first connect the following error message:

TypeError: 'NoneType' object is not iterable

It was worse when I was attempting to start both the script and client, but has improved after using the "-c no client" at startup. Is is some sort of race condition in startup ?

Thanks,

Martin

full log: 1. unsuccessful 2. successful (both with -c no client)

C:\Users\dest>s2aio -c no_client

pymata_aio Version 2.15 Copyright (c) 2015-2016 Alan Yorinks All rights reserved.

Using COM Port:com5

Initializing Arduino - Please wait... list index out of range
Shutting down ...
--- Logging error ---
--- Logging error ---
Exception ignored in: <bound method Task.del of <Task finished coro=<PymataCore.command_dispatcher() done, defined at c:\users\mthomaz\appdata\l
cal\programs\python\python35-32\lib\site-packages\pymata_aio\pymata_core.py:1250> exception=SystemExit(0,)>>
Traceback (most recent call last):
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\asyncio\tasks.py", line 93, in del
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\asyncio\futures.py", line 215, in del
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\asyncio\base_events.py", line 1177, in call_exception_handler
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\logging__init
_.py", line 1308, in error
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\logging__init__.py", line 1415, in log
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\logging__init
_.py", line 1425, in handle
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\logging__init__.py", line 1495, in callHandlers
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\logging__init__.py", line 855, in handle
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\logging__init__.py", line 986, in emit
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\logging__init__.py", line 908, in handleError
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\traceback.py", line 100, in print_exception
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\traceback.py", line 474, in init
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\traceback.py", line 358, in extract
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\traceback.py", line 282, in line
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\linecache.py", line 16, in getline
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\linecache.py", line 47, in getlines
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\linecache.py", line 136, in updatecache
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\tokenize.py", line 458, in open
File "c:\users\mthomaz\appdata\local\programs\python\python35-32\lib\encodings__init__.py", line 98, in search_function
File "", line 969, in _find_and_load
File "", line 954, in _find_and_load_unlocked
File "", line 887, in _find_spec
TypeError: 'NoneType' object is not iterable

C:\Users\dest>s2aio -c no_client

pymata_aio Version 2.15 Copyright (c) 2015-2016 Alan Yorinks All rights reserved.

Using COM Port:com5

Initializing Arduino - Please wait...
Arduino Firmware ID: 2.5 FirmataPlus32u4.ino
Auto-discovery complete. Found 30 Digital Pins and 12 Analog Pins

Problem finding configuration.cfg file on Mac Computers

The problem manifests itself in an exception that looks something like this:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/s2aio", line 9, in <module>
    load_entry_point('s2aio==1.1', 'console_scripts', 's2aio')()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/s2aio/__main__.py", line 806, in main
    s2aio = S2AIO(client=client_type, language=language_type, com_port=comport)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/s2aio/__main__.py", line 66, in __init__
    self.ln_languages = config.get('translation_lists', 'ln_languages').split(',')
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/configparser.py", line 779, in get
    d = self._unify_values(section, vars)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/configparser.py", line 1139, in _unify_values
    raise NoSectionError(section)
configparser.NoSectionError: No section: 'translation_lists'

This will be resolved ASAP

Error "system cannot find the file..."

Hello MrYsLab
I' m using s2aio extension and it's fantastic. Thanks for the good work.

I' m installing on my computer but my user name is "Fernando Coelho". So when i try to launch s2aio command i get an error:
The system cannot find the file c:\users\fernando.

Can i correct this or should i have to create a neu user without blank space on the definition name?
Thanks in advance
error

unexpecting shutting down

mam problem z uruchomieniem s2aio. Podczas uruchomienia pojawiają się komunikaty:

root@raspberrypi:/home/pi# s2aio -c scratch -l 1 -p /dev/ttyACM0 -s 100

pymata_aio Version 2.19 Copyright (c) 2015-2017 Alan Yorinks All rights reserved.

Initializing Arduino - Please wait...
Arduino Firmware ID: 2.5 FirmataPlus.ino
Auto-discovery complete. Found 20 Digital Pins and 6 Analog Pins

and after a few seconds, there appears a shouting down ...
At this time scratch 2 is running, (it's unhelpful - 100) the platform is rpi3, python 3.6 .... what could be the reason?

Failed to create process

Congratulations for your work,
I'm working with s2a_fm and I would try s2aio. I followed the steps on your wiki, for Windows S.O. in two different computers without problems (W7 and W10), but when I try to start with the command "s2aio", I always get: " failed to create process."
I'm a noob with Python and is possible that I missed some basic step, but I'm not solving this issue.
Thanks a lot for any help.

Sonar example not working - New

Hello.

I am aiming to use a Raspberry Pi with an Arduino and sonar devices. At first, I wanted to use "snap4arduino". For testing purposes, I used my notebook successfully. Sadly, I found out, that it won 't work with a Raspberry Pi.

Gladly, I found your project "s2aio". So, I did the preparation. Some functions work; for example, I can manage a blinking of pin 13. But it is not possible to get distance values from the sonar device. In "Snap!", I just get an empty speech bubble.

Thank you for your work. I would be happy, if anyone could give me some advices. I would appreciate it, to keep the hints as simple as possible, for I am not quite experienced in using Python.


Some specifications (others follow, if requested):

For testing purposes, I use a Debian notebook with:
3.16.0-4-amd64

s2aio -c snap with s2aio_Snap_base.xml

Arduino Firmware ID: 2.5 FirmataPlus32u4.ino according to:
https://github.com/MrYsLab/pymata-aio/wiki/Uploading-FirmataPlus-to-Arduino

/usr/local/lib/python3.5

Arduino Mega 2560

sonar device HC-SR04 connected like this:
https://github.com/MrYsLab/s2aio/wiki/Using-a-Sonar-Device

I checked out these issues:
#8
MrYsLab/s2a_fm#15

SyntaxError: invalid syntax | Python 3.7 | macOS 10.13.5

The following error occurs no matter the "s2aio" command I input to Terminal. I saw a similar issue previously closed... Any ideas?

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/s2aio", line 7, in
from s2aio.main import main
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/s2aio/main.py", line 28, in
from aiohttp import web
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/init.py", line 10, in
from .protocol import * # noqa
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/protocol.py", line 17, in
from .helpers import reify
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/helpers.py", line 26
ensure_future = asyncio.async
^
SyntaxError: invalid syntax

s2aio don't open Scratch

Hi folks,

I was navegating on google to learn something for teaching kids to use Arduino with sound tones. And I found your work. Congrats, its very nice.

So let's for the problem. I tried to install s2aio on Windows 8.1, with Python 3.6 and I had install everything including s2aio and forget the Scratch 2.0 :(

So when I looked to the wiki, you say to install everthing before s2aio, so yes. I did wrong.
And now when I type on prompt s2aio it doesn't open Scratch, You have any idea for what I need to do?

Best regards

An exception occurred on the asyncio event loop

Hello Alan,

I have been using s2a_fm for a while now and the kids love it. I wanted to try s2aio on my mac today however I get an error message.
I have done all the steps indicated, but get the following msg:

pymata_aio Version 2.7 Copyright (c) 2015 Alan Yorinks All rights reserved.
Using COM Port:/dev/tty.usbmodem411
Initializing Arduino - Please wait... Auto-discovery complete. Found 20 Digital Pins and 6 Analog Pins

An exception occurred on the asyncio event loop while receiving data. Invalid message.

Can you help me?

Using mac os el capitan
Python 3.5

Blocks are not added to Snap!

Hi,
I followed the instructions to run s2aio with Snap! (scratch seems to be more and more difficult to run on Linux unfortunately). When I start s2aio, Snap! opens but without the blocks.

Here is the output:

pymata_aio Version 2.34 Copyright (c) 2015-2018 Alan Yorinks All rights reserved.

Using COM Port:/dev/ttyACM0

Initializing Arduino - Please wait... 
Arduino Firmware ID: 2.5 FirmataPlus.ino
Auto-discovery complete. Found 20 Digital Pins and 6 Analog Pins

The board is an Elegoo Uno R3. I tried also with an old Arduino Uno R3 smd.

S2aio - Task was destroyed

Hi, thanks for great development we have shared.
I am making a test in order to migrate from Python 2.7 to 3.5.2 and still using your development, however following all proposed tests, I have received the following message:


image

I appreciate any help you can give me in this case.

Thanks!

disconnet after save

Hi,
on Linux - Ubuntu 16.04 LTS after save scratch disconnet from arduino and s2aio on ather block became red.

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.