-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for UART control mode for a02yyuw distance sensor #976
base: develop
Are you sure you want to change the base?
Changes from 2 commits
c2c3830
61af8ce
eef9209
a07eda0
6ed899f
88f3183
ebe5356
0097b9a
f98bdc3
94cf438
a9ded85
84d336a
605dc65
c72a264
9c365bc
ed5dd86
fa3db48
64ba5fa
1274def
0044e06
87b18d1
61fd107
5cf3a11
cd4cf70
37661d4
6dd01e1
b7ecf22
8984d38
8b726f7
fb85e88
1f351b2
4f50932
82eec3b
63fa1cf
8d5c057
bb34957
8588521
8fdcd34
e4d8405
05eaf65
2485223
574cc39
9ebb74f
71a916a
3030188
b674bc2
1159560
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,31 @@ | |
|
||
**A02yyuw serial ultrasonic distance sensor** | ||
|
||
The **A02yyuw** library is included in the **Meadow.Foundation.Sensors.Distance.A02yyuw** nuget package and is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform. | ||
### Pinout for Sensor: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These readme files are auto-generated but I'll grab this text and add it to our docs - thx! |
||
1. (red) VCC power input 3- 5 V | ||
2. (black) ground | ||
3. (yellow) Rx pin function depends on output mode | ||
4. (white) Tx pin function depends on output mode | ||
|
||
This driver is part of the [Meadow.Foundation](https://developer.wildernesslabs.co/Meadow/Meadow.Foundation/) peripherals library, an open-source repository of drivers and libraries that streamline and simplify adding hardware to your C# .NET Meadow IoT applications. | ||
The A02 series supports 5 different modes of operation (PWM output, UART Controlled output,UART Auto output, Switched output). | ||
The Rx and Tx pin function corresponds to the output mode selected before ordering, and can not be changed. The **A02yyuw** library supports the | ||
UART Controlled output and UART Auto output of the A02, which can be selected in software. | ||
|
||
For more information on developing for Meadow, visit [developer.wildernesslabs.co](http://developer.wildernesslabs.co/). | ||
In UART Auto mode, when the Rx pin is held low, the module outputs real-time values on the Tx pin with a response time of 100ms. | ||
When pin(RX)is held high, the module outputs processed values, and the data is more stable. The response time is 100~500ms. The **A02yyuw** library | ||
keeps Rx high in UART Auto output, so processed values are obtained. | ||
|
||
To view all Wilderness Labs open-source projects, including samples, visit [github.com/wildernesslabs](https://github.com/wildernesslabs/). | ||
In UART Controlled mode, the module wil perform a distance detection and send data on the Tx pin after the Rx pin receives a falling edge pulse. | ||
The period between Rx pulses must be greater than 70ms. The **A02yyuw** library sends a pulse by writing a byte of data to the serial port. | ||
|
||
The **A02yyuw** library is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform and is part of [Meadow.Foundation](https://developer.wildernesslabs.co/Meadow/Meadow.Foundation/). | ||
|
||
The **Meadow.Foundation** peripherals library is an open-source repository of drivers and libraries that streamline and simplify adding hardware to your C# .NET Meadow IoT application. | ||
|
||
## Installation | ||
For more information on developing for Meadow, visit [developer.wildernesslabs.co](http://developer.wildernesslabs.co/). | ||
|
||
You can install the library from within Visual studio using the the NuGet Package Manager or from the command line using the .NET CLI: | ||
To view all Wilderness Labs open-source projects, including samples, visit [github.com/wildernesslabs](https://github.com/wildernesslabs/). | ||
|
||
`dotnet add package Meadow.Foundation.Sensors.Distance.A02yyuw` | ||
## Usage | ||
|
||
```csharp | ||
|
@@ -73,20 +85,3 @@ private void A02yyuw_DistanceUpdated(object sender, IChangeResult<Length> e) | |
## Need Help? | ||
|
||
If you have questions or need assistance, please join the Wilderness Labs [community on Slack](http://slackinvite.wildernesslabs.co/). | ||
## About Meadow | ||
|
||
Meadow is a complete, IoT platform with defense-grade security that runs full .NET applications on embeddable microcontrollers and Linux single-board computers including Raspberry Pi and NVIDIA Jetson. | ||
|
||
### Build | ||
|
||
Use the full .NET platform and tooling such as Visual Studio and plug-and-play hardware drivers to painlessly build IoT solutions. | ||
|
||
### Connect | ||
|
||
Utilize native support for WiFi, Ethernet, and Cellular connectivity to send sensor data to the Cloud and remotely control your peripherals. | ||
|
||
### Deploy | ||
|
||
Instantly deploy and manage your fleet in the cloud for OtA, health-monitoring, logs, command + control, and enterprise backend integrations. | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,4 +1,6 @@ | ||||
using Meadow; | ||||
//#define DEVICE_FEATHER | ||||
#define DEVICE_PROJECT_LAB | ||||
using Meadow; | ||||
using Meadow.Devices; | ||||
using Meadow.Foundation.Sensors.Distance; | ||||
using Meadow.Units; | ||||
|
@@ -8,7 +10,12 @@ | |||
namespace A02yyuw_Sample | ||||
{ | ||||
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards | ||||
#if DEVICE_FEATHER // Feather: Change F7FeatherV2 to F7FeatherV1 for V1.x boards | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting idea, we should think about something like this and apply it to all samples in the repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a cleaner pattern for this that doesn't require compiler directives. See this as an example: Line 10 in fb357c4
|
||||
public class MeadowApp : App<F7FeatherV2> | ||||
#endif | ||||
#if DEVICE_PROJECT_LAB //ProjectLab: uses an F7CoreComputeV2 board | ||||
public class MeadowApp : App<F7CoreComputeV2> | ||||
#endif | ||||
{ | ||||
//<!=SNIP=> | ||||
|
||||
|
@@ -18,7 +25,7 @@ public override Task Initialize() | |||
{ | ||||
Resolver.Log.Info("Initialize..."); | ||||
|
||||
a02yyuw = new A02yyuw(Device, Device.PlatformOS.GetSerialPortName("COM4")); | ||||
a02yyuw = new A02yyuw(Device, Device.PlatformOS.GetSerialPortName("COM4"), A02yyuw.MODE_UART_CONTROL); | ||||
|
||||
var consumer = A02yyuw.CreateObserver( | ||||
handler: result => | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both const values are set to the same value of 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the second constant = 2.