-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
78 changed files
with
1,614 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# REPORTING ISSUES | ||
|
||
If you wish to report an issue with this library, please use | ||
[this link](https://github.com/MrYsLab/telemetrix-uno-r4/issues). | ||
|
||
For any of the servers, please use | ||
[this link](https://github.com/MrYsLab/Telemetrix4UnoR4/issuess). | ||
|
||
When filing an issue, please provide: | ||
|
||
1. Any console output. | ||
2. A description of the issue. | ||
3. Sample code demonstrating the problem. | ||
|
||
For bugs, comments, or questions, please use the links above. | ||
<br> | ||
<br> | ||
|
||
|
||
|
||
Copyright (C) 2023 Alan Yorinks. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Setting Pin Modes | ||
|
||
Pin modes must be set before interacting with a pin. All the methods listed | ||
below have a consistent API across all API classes. | ||
|
||
### Input Pin Modes | ||
|
||
#### Requiring A Callback To Be Specified | ||
* set_pin_mode_analog_input | ||
* set_pin_mode_dht | ||
* set_pin_mode_digital_input | ||
* set_pin_mode_digital_input_pullup | ||
* set_pin_mode_sonar | ||
|
||
#### Callback Specified In Read Commands | ||
* set_pin_mode_i2c | ||
* set_pin_mode_spi | ||
|
||
### Output Pin Modes | ||
* set_pin_mode_analog_output | ||
* set_pin_mode_digital_output | ||
* set_pin_mode_servo | ||
|
||
|
||
|
||
<br> | ||
<br> | ||
|
||
Copyright (C) 2023 Alan Yorinks. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## A Word About The Application Templates | ||
|
||
The following section contains a set of application templates for each of the four | ||
servers. | ||
The templates are based on the included examples. | ||
|
||
* [r4_minima_examples - asyncio](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_minima_examples/asyncio) | ||
* [r4_minima_examples - threaded](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_minima_examples/threaded) | ||
* [r4_wifi_examples_asyncio - BLE](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/asyncio/BLE) | ||
* [r4_wifi_examples_asyncio - WIFI](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/asyncio/WIFI) | ||
* [r4_wifi_examples_asyncio - usbSerial](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/asyncio/usbSerial) | ||
* [r4_wifi_examples_threaded - WIFI](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/threaded/WIFI) | ||
* [r4_wifi_examples_threaded - usbSerial](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/threaded/usbSerial) | ||
|
||
|
||
As you will see, your application needs to import the correct API | ||
and instantiate the API class. | ||
You then use the API method calls in writing your application. | ||
|
||
|
||
<br> | ||
<br> | ||
|
||
Copyright (C) 2023 Alan Yorinks. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Download And Install The Arduino IDE | ||
|
||
Arduino IDE version 2.1.X is used to upload a server to the Minima or WIFI. It is also | ||
used to modify server source code when configuration is necessary. | ||
|
||
To install a copy of the IDE, go to the [Arduino Software Download page](https://www.arduino.cc/en/software), and | ||
select the version for your | ||
operating system. Follow the installation instructions. | ||
|
||
![](images/arduino_ide_download.png) | ||
|
||
## A Note For Linux Users | ||
You may need to add your login to the dialout group to upload to the Arduino. | ||
|
||
To do so, follow [these instructions](https://support.arduino.cc/hc/en-us/articles/360016495679-Fix-port-access-on-Linux). | ||
|
||
<BR> | ||
Copyright (C) 2023 Alan Yorinks. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
## Registering A Callback | ||
|
||
A callback function must be registered when you set a pin to an input mode. | ||
|
||
The code below illustrates a typical callback function. | ||
|
||
```angular2html | ||
def the_callback(data): | ||
""" | ||
A callback function to report data changes. | ||
This will print the pin number, its reported value and | ||
the date and time when the change occurred | ||
:param data: [pin mode, pin, current reported value, pin_mode, timestamp] | ||
""" | ||
date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(data[CB_TIME])) | ||
print(f'Report Type: {data[CB_PIN_MODE]} Pin: {data[CB_PIN]} ' | ||
f'Value: {data[CB_VALUE]} Time Stamp: {date}') | ||
``` | ||
|
||
And here, the callback is registered when the set_pin_mode is called: | ||
|
||
``` | ||
board.set_pin_mode_digital_input_pullup(12, the_callback) | ||
``` | ||
|
||
If you forget to register a callback, | ||
a RunTime exception will be thrown. | ||
|
||
```angular2html | ||
Traceback (most recent call last): | ||
File "/home/afy/PycharmProjects/telemetrix-rpi-pico-w/ play/no_callback_registered.py", line 5, in <module> | ||
board.set_pin_mode_digital_input(5) | ||
File "/home/afy/PycharmProjects/telemetrix-rpi-pico-w/telemetrix_rpi_pico_w/telemetrix_rpi_pico_w.py", line 752, in set_pin_mode_digital_input | ||
raise RuntimeError('A callback must be specified') | ||
RuntimeError: A callback must be specified | ||
``` | ||
|
||
## Callback Function Parameter | ||
|
||
A callback function or method must accept a single parameter. The client | ||
automatically fills in this parameter as a list | ||
when receiving an input data change notification. | ||
For "the_callback" above, this parameter is named data. | ||
|
||
The list contents vary from input pin type to input pin type and | ||
are described in detail for each _set_pin_mode_XXX_ method in the | ||
[API documentation.](https://htmlpreview.github.io/?https://github.com/MrYsLab/telemetrix-rpi-pico/blob/master/html/telemetrix_rpi_pico/index.html) | ||
The first element in the list identifies the pin type, and the last element | ||
is a timestamp of the data change occurrence. Other elements identify the GPIO pin, | ||
the current data value, and additional relevant information. | ||
|
||
For example, the list may contain | ||
|
||
```angular2html | ||
[DIGITAL_REPORT, pin_number, pin_value, raw_time_stamp] | ||
DIGITAL_REPORT = 2 | ||
``` | ||
|
||
_**NOTE:**_ | ||
|
||
**Telemetrix does not support polling or direct read methods for | ||
inputs. Instead, the pin's associated callback is called as soon | ||
as a data change is detected, allowing immediate response to data | ||
changes and, generally, a more straightforward application design. | ||
** | ||
|
||
|
||
|
||
## Pin Types | ||
|
||
| **Pin Mode** | **Pin Mode Value** | | ||
|:-----------------------------------------------:|:--------------------:| | ||
| Digital Input (including pullup and pulldown) | 2 | | ||
| Analog Input (ADC) | 3 | | ||
| I2C | 10 | | ||
| SONAR Distance | 11 | | ||
| DHT | 12 | | ||
|
||
|
||
## Converting The Raw Timestamp | ||
|
||
To convert the raw timestamp field to a human-readable time, use **time.localtime()**. | ||
|
||
```angular2html | ||
date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(data[CB_TIME])) | ||
``` | ||
|
||
|
||
<br> | ||
<br> | ||
|
||
Copyright (C) 2023 Alan Yorinks. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Once the client and server software have been installed, | ||
it would be an excellent time to try the examples. | ||
|
||
Examples are provided for all four of the servers. | ||
|
||
## Example Naming Conventions | ||
|
||
The naming convention used for the examples prefixes each example with three letters. | ||
The first letter is for the board type: | ||
|
||
* m = Minima | ||
* w = Wifi | ||
|
||
The second letter is for the transport type: | ||
|
||
* b = BLE | ||
* s = serial | ||
* w = WIFI | ||
|
||
The third is for the concurrency type: | ||
|
||
* a = asyncio | ||
* t = threaded | ||
|
||
## Links To The Examples | ||
|
||
* [r4_minima_examples - asyncio](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_minima_examples/asyncio) | ||
* [r4_minima_examples - threaded](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_minima_examples/threaded) | ||
* [r4_wifi_examples_asyncio - BLE](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/asyncio/BLE) | ||
* [r4_wifi_examples_asyncio - WIFI](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/asyncio/WIFI) | ||
* [r4_wifi_examples_asyncio - usbSerial](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/asyncio/usbSerial) | ||
* [r4_wifi_examples_threaded - WIFI](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/threaded/WIFI) | ||
* [r4_wifi_examples_threaded - usbSerial](https://github.com/MrYsLab/telemetrix-uno-r4/tree/master/telemetrix_uno_r4/r4_wifi_examples/threaded/usbSerial) | ||
|
||
<BR> | ||
Copyright (C) 2023 Alan Yorinks. All Rights Reserved. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.