Commit Graph
63 Commits
Author SHA1 Message Date
Laurens Valk e2188747c8 snippets/pup: add Motor init examples 2020-07-21 14:49:12 +02:00
Laurens Valk e4729df9f5 snippets/pup: add DCMotor examples 2020-07-21 14:49:12 +02:00
Adam a0c96c5a6a snippets/ev3: add PS4 snippet 2020-07-19 22:55:10 +02:00
Laurens Valk c6a3d7a66e snippets/pup/sensor_force: add examples 2020-07-13 15:39:00 +02:00
Laurens Valk 073357709b snippets/pup/sensor_color: add reflection example 2020-07-13 14:23:39 +02:00
Laurens Valk ee05a6686e snippets/pup/sensor_color: add ambient sample
ambient color sensor is unique to this sensor
2020-07-13 14:13:21 +02:00
Laurens Valk caa4012b2a snippets/pup/sensor_color: add 6 samples
These are nearly the same as for the ColorDistanceSensor.
2020-07-13 14:04:59 +02:00
Laurens Valk 36a4bdd2a9 snippets/pup/sensor_color_distance: add 6 samples 2020-07-11 17:03:07 +02:00
Laurens Valk dc82cd5d07 snippets/pup/light: add basic light and math demo 2020-07-11 12:58:15 +02:00
Laurens Valk 3b9663d93b snippets/pup/sensor_tilt: add read example 2020-07-11 12:42:52 +02:00
Laurens Valk f19d80b728 snippets/pup/sensor_infrared: add read example 2020-07-11 12:39:03 +02:00
Laurens Valk 796f4e63d9 snippets/pup/sensor_ultrasonic: add math example
This demonstrates functionality of the lights and builtin math.
2020-07-10 13:05:50 +02:00
Laurens Valk c4c60f20bf snippets/pup/sensor_ultrasonic: add basic example
Demonstrate distance measuring and light control in a simple loop.
2020-07-10 12:37:13 +02:00
Laurens Valk 54523ee695 ev3/snippets/rcx_touch: example of AnalogSensor 2020-05-21 11:24:34 +02:00
Laurens Valk df06dc59cc ev3/snippets: bluetooth: update rover example 2020-05-19 15:19:18 +02:00
Laurens Valk d5ee42156d ev3/snippets/bluetooth_pc: StreamRequestHandler
This restores the previously deleted custom StreamRequestHandler.

In the prevous commits, more and more pieces from the standard socket library were used instead of the custom-made ones made for EV3. This was giving compatibility issues on some platforms (Windows/Mac), and differences with EV3 made it harder to debug.

It was previously dropped to make the MailboxHandler work. This commit reverts that change and modifies the MailboxHandler instead to make it work with the BluetoothSocket objects, which do not have rfile.read. Instead we use recv directly and rely on zero length to detect disconnected state.

It would be useful to eventually use only components from the socket server module and no incomplete custom ones, but this provides at least a working cross platform starting point to fall back to.
2020-05-16 20:13:40 +02:00
Laurens Valk 8907939639 ev3/snippets/bluetooth_pc: PC is client
Technically it does not matter much who is the server or the client.

However, if Windows PCs are involved, we found it to be easier if
Windows is the client and EV3 is the server.
That way, it is the Windows PC initiating the connection. It doesn't
seem to like it when other devices take the initiative.

So, we update the example accordingly to make it
accessible for most users without loss of generality.

You can still make the PC the server by just running the
server example on your PC.
2020-05-16 17:01:36 +02:00
Laurens Valk 731cdd662f ev3/snippets/bluetooth_read_spike: initial example
Add a class that makes it easy to read values streamed by the hub.
2020-05-12 22:31:49 +02:00
Laurens Valk 581a0997c9 ev3/snippets/bluetooth_pc: flake8
Make sure the documentation can pass flake8.
2020-05-10 12:43:56 +02:00
Laurens Valk 8d20a1b84f ev3/snippets/bluetooth_pc: drop some unix specific
socket.AF_BLUETOOTH is not available on some platforms but bluetooth.BluetoothSocket is.
2020-05-10 12:39:52 +02:00
Laurens Valk 567a8128a2 ev3/snippets/bluetooth_pc: add comments and readme 2020-05-07 11:56:36 +02:00
Laurens Valk 759f108306 ev3/snippets/bluetooth_client: comment for PC
Expand comment to say that the remote may be an EV3 or PC.
It works the same.
2020-05-07 11:56:36 +02:00
Laurens Valk bfe80edff6 ev3/snippets/bluetooth_pc: run client as python3
Even though our main example will have the PC as the server, make it possible to use it as client as well.

Now, it works just like the EV3s. The only difference is that
you must enter the full address instead of the name if the EV3 is the server you are connecting to.
2020-05-07 11:56:36 +02:00
Laurens Valk db10b75808 ev3/snippets/bluetooth_pc: run server as python3
This removes the MicroPython struct and socket specifics and replaces them with Python3 counterparts.

Also a few changes are made to deal with strings, which on MicroPython are just bytes.

Now, the server works on Python3 and client EV3s can connect to it.
2020-05-07 11:56:36 +02:00
Laurens Valk 9b3908090d ev3/snippets/bluetooth_pc: run MicroPython Unix
This is a copy of the EV3 server example with minimal changes
to make it run on a PC, using the unmodified MicroPython Unix port.

This is done by skipping the name resolver. The downside is that you
must specify the EV3 server address instead of its name.  However,
since in this example the PC will be the server, this is not really a
problem. The EV3 clients will just connect to the PC by its name.
2020-05-07 11:56:36 +02:00
Laurens Valk 5d943a609d ev3/snippets/bluetooth_pc: copy pybricks bluetooth
This copies the Pybricks MicroPython bluetooth implementation. As-is, it only runs in Pybricks MicroPython.

The next commits will adapt it to work with MicroPython and then Python3. We only need the Python3 end result, but this staged approach makes it easy to keep track of what will be changed.
2020-05-07 11:56:36 +02:00
Laurens Valk 21eac3abda ev3/snippets/bluetooth_pc: hello world launch
This creates an empty hello world style Python3 example
2020-05-07 11:56:36 +02:00
Laurens Valk 8f0e674b58 workspaces: generate 2020-04-28 15:18:40 +02:00
Laurens Valk 50c96cadb3 ev3: update workspaces 2020-04-16 15:07:42 +02:00
Laurens Valk 52ee3b772b snippets/ev3: split datalog into separate projects
Use the standard style instead of having them as launch configurations.
2020-04-16 15:07:22 +02:00
Laurens Valk 79e1064ae9 snippets/ev3/datalog: fix extension kwarg
Make the example match the doc.
2020-04-10 13:07:47 +02:00
Laurens Valk 0ef1a9f956 snippets/ev3: update workspaces
run ./update_workspaces.py
2020-04-01 13:31:26 +02:00
David Lechner 28e3bc8f0c Fix typo too/to 2020-03-26 16:22:19 -05:00
David Lechner d59bf03daf snippets/ev3: Split screen into separate projects
These will be included as examples in the API docs
2020-03-26 13:44:22 +01:00
Laurens Valk 6a57abbff6 snippets/ev3/bluetooth: update mailbox name
In examples, it is helpful to give unrelated things different names.
2020-03-25 12:59:16 +01:00
Laurens Valk af926c5f19 snippets/ev3/buttons_quickstart: initial project
This is a demo of:
- multi-file project
- using images
- creating a "menu"

This program can be started away from the competition table.
Then a mission can be quickly activated by pressing one of the buttons.
2020-03-20 13:58:09 +01:00
Laurens Valk 3bb19daadf snippets/ev3: add getting started snippet
Include it from here instead of having the code directly in the docs.
2020-03-05 15:14:02 +01:00
Laurens Valk 106c8cf600 snippets/ev3: remove print from imports
We use the default print in the latest release, so importing is not required.
2020-03-04 10:24:53 +01:00
Laurens Valk 64c29d49ce update_workspaces: generalize generator
Make it useful for upcoming EV3 folders as well.
2020-03-03 11:48:26 +01:00
Laurens Valk 4fca9387f3 snippets/ev3: auto generate workspace 2020-03-03 11:32:34 +01:00
Laurens Valk 297aa88459 snippets/ev3/ev3devsensor: initial examples 2020-02-25 10:15:59 +01:00
Laurens Valk 561315a105 snippets/ev3/datalog: update arguments 2020-02-14 11:46:33 +01:00
Laurens Valk 05ce47e739 snippets/ev3/datalog: add main and extra example 2020-02-14 11:37:13 +01:00
David Lechner 7bc9ef5acf snippets/ev3/bluetooth_client/client: use name instead of address
We no longer have to use the Bluetooth address.
2020-02-12 15:50:21 -06:00
Laurens Valk a18ba6499c snippets/ev3/vernier: temperature example 2020-02-12 12:47:55 +01:00
David Lechner 5ffedc9d51 ev3dev/bluetooth: update examples for api changes 2020-02-11 12:50:52 -06:00
David Lechner fcc8af3381 snippets/ev3/screen: update for API changes 2020-02-11 11:21:04 -06:00
David Lechner 55912786eb Add bluetooth example projects 2020-02-03 16:32:30 -06:00
Laurens Valk 8d9bb6e11a snippets/ev3/i2c_extra: update i2c
Reflect that we read one byte by default.

Also allow a second way to send one byte, by specifying a register with no data.
2020-02-03 10:34:42 +01:00
David Lechner f7f1ce5768 resources renamed to media.ev3dev 2020-01-14 10:35:09 -06:00