Skip to content

Commit

Permalink
Version 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MrYsLab authored and MrYsLab committed Apr 5, 2018
1 parent 18af63c commit 4725fd3
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ __MAJOR FEATURES__
* It is a whole lot of fun!

* English, [Brazilian-Portuguese](https://mryslab.github.io/s2m/blocks/#the-brazilian-portuguese-blocks),
[Korean](https://mryslab.github.io/s2m/blocks/#the-korean-blocks), [Japanese](https://mryslab.github.io/s2m/blocks/#the-japanese-blocks),
[Japanese](https://mryslab.github.io/s2m/blocks/#the-japanese-blocks),
[Korean](https://mryslab.github.io/s2m/blocks/#the-korean-blocks), and
[Traditional (tw) Chinese](https://mryslab.github.io/s2m/blocks/#the-traditional-chinese-tw-blocks)
blocks are available for use.
Expand Down
25 changes: 25 additions & 0 deletions long_desc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

s2m is a Python program that acts as a bridge between the Scratch 2 off-line editor
and the micro:bit computer. It allows you to easily create Scratch programs that interact with the micro:bit.

MAJOR FEATURES:

* s2m is compatible with both Python 2 and Python 3.

* It runs on Windows, Mac, Raspberry Pi and Linux.

* It is easy to install.

* It is easy to use.

* It is a whole lot of fun!

Scratch blocks are provided for the following languages:

* English (default)
* Brazilian-Portuguese
* Japanese
* Korean
* Traditional Chinese (Taiwanese)


16 changes: 10 additions & 6 deletions s2m/micro_bit_scripts/s2mb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (c) 2017 Alan Yorinks All rights reserved.
Copyright (c) 2017-2018 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Expand All @@ -14,7 +14,7 @@
along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Last modified 24 March 2018
Last modified 5 April 2018
"""

from microbit import *
Expand Down Expand Up @@ -156,6 +156,7 @@ def loop(digital_outputs):
try:
pin = int(cmd_list[1])
value = int(cmd_list[2])
digital_outputs[pin] = True
except IndexError:
continue
except ValueError:
Expand Down Expand Up @@ -229,16 +230,19 @@ def loop(digital_outputs):
sensor_string += '0' + ','

# get analog input pin values
sensor_string += str(pin0.read_analog()) + ','
if not digital_outputs[0]:
sensor_string += str(pin0.read_analog()) + ','

sensor_string += str(pin1.read_analog()) + ','
if not digital_outputs[1]:
sensor_string += str(pin1.read_analog()) + ','

sensor_string += str(pin2.read_analog())
if not digital_outputs[2]:
sensor_string += str(pin2.read_analog())

print(sensor_string)

elif cmd == 'v':
print('s2mb.py Version 1.07 24 March 2018')
print('s2mb.py Version 1.08 5 April 2018')
else:
continue

Expand Down
16 changes: 10 additions & 6 deletions s2m/micro_bit_scripts/s2mb_min.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (c) 2017 Alan Yorinks All rights reserved.
Copyright (c) 2017-2018 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Version 3 as published by the Free Software Foundation; either
Expand All @@ -11,7 +11,7 @@
You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Last modified 24 March 2018
Last modified 5 April 2018
"""
from microbit import*
def loop(digital_outputs):
Expand Down Expand Up @@ -76,6 +76,7 @@ def loop(digital_outputs):
try:
pin=int(cmd_list[1])
value=int(cmd_list[2])
digital_outputs[pin]=True
except IndexError:
continue
except ValueError:
Expand Down Expand Up @@ -128,12 +129,15 @@ def loop(digital_outputs):
sensor_string+=str(pin2.read_digital())+','
else:
sensor_string+='0'+','
sensor_string+=str(pin0.read_analog())+','
sensor_string+=str(pin1.read_analog())+','
sensor_string+=str(pin2.read_analog())
if not digital_outputs[0]:
sensor_string+=str(pin0.read_analog())+','
if not digital_outputs[1]:
sensor_string+=str(pin1.read_analog())+','
if not digital_outputs[2]:
sensor_string+=str(pin2.read_analog())
print(sensor_string)
elif cmd=='v':
print('s2mb.py Version 1.07 24 March 2018')
print('s2mb.py Version 1.08 5 April 2018')
else:
continue
loop([False,False,False])
Expand Down
4 changes: 2 additions & 2 deletions s2m/s2m.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright (c) 2017 Alan Yorinks All rights reserved.
Copyright (c) 2017-2018 Alan Yorinks All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
Expand Down Expand Up @@ -131,7 +131,7 @@ def __init__(self, client=None, com_port=None,
"32": "ARROW_W",
"33": "ARROW_NW"}

print('\ns2m version 2.3 Copyright(C) 2018 Alan Yorinks All rights reserved.')
print('\ns2m version 2.5 Copyright(C) 2018 Alan Yorinks All rights reserved.')
print("\nPython Version %s" % sys.version)

# When control C is entered, Scratch will close if auto-launched
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from setuptools import setup

with open('README.md') as f:
with open('long_desc.md') as f:
long_description = f.read()

setup(
name='s2m',
version='2.4',
version='2.5',
packages=['s2m'],
install_requires=['pyserial>=2.7',
'psutil'],
Expand Down

0 comments on commit 4725fd3

Please sign in to comment.