# Sparkslabs Update #6 : New Pyxie Release 0.1.23 - major arduino profile improvements, print-as-function not statement

# New Pyxie Release 0.1.23 - major arduino profile improvements, print-as-function not statement

## Released: 11th October 2016

Hi,

This release is a fairly major release - which has prompted a bump of
release number to 0.1.23, rather than 0.0.23

(I'm keeping the patch level the same so there's a general release count.)


## Major Changes

* The arduino profile is now sufficient for building little robots that are
  made of microcontrollers, servos, sensors and can report data via the serial
  port.

* Ability to use function calls in assignment statements - such as calls in
  to arduino libraries.

* The arduino profile is now documented - both in docs/ and also on the website.
    * http://www.sparkslabs.com/pyxie/specific-profile-arduino.html

* More examples:

    * Analog example - showing use of reading/writing analog values, and use
      of serial port, map, constrain, random, millis etc

    * puppy - this is for controls the Dagu playful puppy (a small quadruped
      robot with 10 servos and IR sensor "eye")

* print is now a function, not a statement. This was always coming, but
  this has been forced by practicalities. Things like Serial.print - necessary
  for arduino support - are not valid python if you have print as a statement.
  It's useful also that this also brings us closer to python 3's syntax.


### Arduino Support

Specific set of functionality checked/added in this release:

* Serial support - .begin(), .print(), .println()
* constrain
* map
* random, randomSeed
* analogWrite
* analogRead
* millis
* Support for constants/ids : A0-A7, HIGH, LOW, INPUT, OUTPUT

This is in addition to other previous functionality like:  Servos, Digital IO, time delays, etc



## Changelog

### What's New?

* Lots of internal changes to switch print from being a statement
  to a function call
    - Update all tests to use print as function, not as statement
    - Lexer - remove keyword
    - Disable "print" as statement type in the grammar
    - Disable "print" as a pynode in the AST model
    - Transform bare function calls to "print" (not method accesses)
      into print statements internally. This will need improving
      later, but for now is enough. It will need improving once we
      implement custom function support.

* Enable use of function calls as rvalues in assignments such as "analogRead"

* Added README.md for the analog example

* Update examples/README.md overview of the various examples.

* Initial user (single page) documentation of how to use the arduino profile


### What's been fixed?

* Handle emitting identifiers as rvalues in assignments correctly


### Internal changes

* Add recursive lookup through context stacks. This allows us effectively to
  manage scope, to be able to treate profiles as an enclosing scope, and a step
  towards being able to generate better error messages.

* Initial tests with profile nodes (for context). Tag is profile_identifier.
  Purpose is primarily to support analysis.

* Simplify cruftiness/verbosity of logging from parser

* Clarify source of logging messages

* Update site/src/panels/current-grammar.md to match current grammar...
  - remove print_statement
  - minor cleanups
  - Expression syntax supports expression molecules - object method access


### Other

* Document how the various autogenerated docs get generated.

* Some extra scripts in test-data - designed to support quick turn around
  testing of specific language features.

* Created a default (empty) global context stack - may provide a better hook
  for things like print-as-function later on.

* Help with debugging
  * Add tags to contexts
  * Tag global context as program context
  * Tag (test) arduino profile context as "arduino"

* Support for analogRead, analogWrite, (arduino) map, and Serial object
  - Example added exercising these

* Updated docs


## Feedback?

As usual, feedback is welcome.  What would you like to see?  Would you like
more detail, less detail?  Suggestions for project direction also very
welcome.


### Since last release

I had this feedback from the last release:

*> Do you have the `map()`, `random()`, or the `constrain()` feature*

I didn't, and only one of those was on my radar/to do list at the time. After
adding support for map, analogRead/etc adding in `random` and `constrain` was
relatively simple, so I added those as well.

(By contrast the request asking about support for "is" had a "not for a
while" response, since that requires the implementation of objects and object
identity  before that makes sense!)


## Finally

As mentioned before, development of pyxie is strictly on my own time with
my own resources, and therefore development is not as fast as I'd like in
an ideal world.

Would you consider supporting this project via kickstarter/IndieGoGo to
speed up development?  If you would, how much would you consider reasonable
to pledge? (This isn't a call to do so, but really an open question - I do
see a reasonable amount of traffic to my site from unique users clearly
looking for a python based mechanism for working with arduinos natively.)

Or alternatively would a web based compiler (or translator) be useful? (Something I
have mooted on my backlog)


## Availability

This release is available on github, pypi and my ubuntu ppa on launchpad.

* https://github.com/sparkslabs/pyxie
* https://pypi.python.org/pypi/pyxie/
* https://launchpad.net/~sparkslabs/+archive/ubuntu/packages

Dev plans:

* http://www.sparkslabs.com/pyxie/dev-status.html

As usual, and and all feedback welcome!


Michael. (@sparks_rd - https://twitter.com/sparks_rd)


