wildernesslabs / meadow.foundation Goto Github PK
View Code? Open in Web Editor NEWUnified driver and library framework for Meadow applications.
Home Page: https://developer.wildernesslabs.co/Meadow/Meadow.Foundation
Unified driver and library framework for Meadow applications.
Home Page: https://developer.wildernesslabs.co/Meadow/Meadow.Foundation
In the PushButton class, the protected member _circuitType is not exposed so defaults to false. Should this not need to be exposed via a property to allow the user to choose if the button is pulled-up or pulled-down ?
Andy
Negative length lines won't draw. The following should draw a line from right to left:
canvas.DrawVerticalLine(20, 0, -10, WildernessLabsColors.GalleryWhite);
does not.
Would appreciate a driver for the RA8876 series of displays!
Example Display:
https://www.buydisplay.com/default/serial-spi-arduino-10-1-tft-lcd-display-shield-ra8876-for-due
This may help:
https://github.com/xlatb/ra8876/wiki/ER-TFTM101-1
Thanks!
I dont know if its possible, but when trying to pulse 3 PwmLeds, only the first one pulses, and the other 2 start blinking in alternate times.
Repro:
List<PwmLed> pwmLeds = new List<PwmLed>();
pwmLeds.Add(new PwmLed(Device.CreatePwmPort(Device.Pins.D02), TypicalForwardVoltage.Red));
pwmLeds.Add(new PwmLed(Device.CreatePwmPort(Device.Pins.D03), TypicalForwardVoltage.Green));
pwmLeds.Add(new PwmLed(Device.CreatePwmPort(Device.Pins.D04), TypicalForwardVoltage.Blue));
foreach (var led in pwmLeds)
led.StartPulse();
Given the following code (where dW ==
display width), i would expect to see the text centered in the screen, but is not:
canvas.DrawText(
(int)dW/2, 10, $"{climate.CurrentConditions.Temperature.Value:###°}",
WLabsColors.Blue, GraphicsLibrary.ScaleFactor.X3,
GraphicsLibrary.TextAlignment.Center);
In looking at the graphics source, i believe this line, should be maybe:
x = x - text.Length * ((CurrentFont.Width * scaleFactor) >> 1);
There are no unit tests in Meadow.Foundation. Having these tests will help ensure consistency and quality in individual development and across the open source ecosystem.
I don't know if did something wrong, but I try to make a simple code base on the starter meadowapp. I try to connect with WIFI and I get this error.
'App.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'App.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\walte\source\repos\MeadowApplication1\MeadowApplication1\bin\Debug\net472\App.exe'. Symbols loaded.
'App.exe' (CLR v4.0.30319: App.exe): Loaded 'C:\Users\walte\source\repos\MeadowApplication1\MeadowApplication1\bin\Debug\net472\Meadow.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[18380] App.exe: Program Trace' has exited with code 0 (0x0).
The program '[18380] App.exe' has exited with code 0 (0x0).
Initializing Esp32 coproc.
Esp32 coproc initialization complete.
Unhandled Exception: System.Exception: Cannot connect to network, applicaiton halted.
at MeadowApplication1.MeadowApp..ctor () <0xc131dc20 + 0x0006e> in :0
at MeadowApplication1.Program.Main (System.String[] args) <0xc1013de8 + 0x00034> in :0
Support the Bosch BME680 which extends the BME280 by including VOC gas sensing
The TftSpi Project and others Display projects that I spot checked point to the GraphicsLibrary 0.8.7, instead of the latest 0.8.8
This is an enhancement that I think would be useful.
Have the GraphicsLibrary class return the height and the width after applying the rotation.
This would save the calling code a lot of work keeping track of the height/width of the DisplayBase and then get the rotation from the DisplayBase.
If you set the stroke and draw a line at an angle, instead of it showing up as a rectangle, it shows up as a trapezoid.
Consider the following code:
void DrawPolarLines()
{
canvas.Clear();
canvas.Stroke = 1;
int colorIndex = 0;
for (int i = 0; i < 270; i += 12) {
canvas.DrawLine(dW/2, dH/2, (dW<=dH ? dW/2 - 10 : dH/2 - 10),
(float)(i * Math.PI / 180), Colors[colorIndex]);
canvas.Stroke++;
// increment our color index to go through all colors
if (colorIndex < Colors.Length - 1) {
colorIndex++;
} else { colorIndex = 0; }
canvas.Stroke++;
}
canvas.Show();
}
Note the lines drawn:
With the Rotary Encoder with Button hooked up as per the demo circuit (+ -> 3V3; Gnd-> Gnd; SW->D05, DT-> D06; CLK -> D07) and the below set-up code the value event does not fire properly and the button ended and started events are reversed. The value readings from this are random and do not seem to be dependent on the direction.
` private void InitializeRotaryButton()
{
rotaryEncoderWithButton = new RotaryEncoderWithButton(Device, Device.Pins.D07, Device.Pins.D06, Device.Pins.D05, 20);
rotaryEncoderWithButton.Rotated += (s, e) =>
{
if (e.Direction == Meadow.Peripherals.Sensors.Rotary.RotationDirection.Clockwise)
{ value++; }
else
{ value--; }
updateLeds();
Console.WriteLine($"Value = {value}");
};
rotaryEncoderWithButton.Clicked += (s, e) =>
{
value = 0;
rgbPwmLed.Stop();
};
rotaryEncoderWithButton.PressEnded += (s, e) =>
{
Console.WriteLine("Press ended");
};
rotaryEncoderWithButton.PressStarted += (s, e) =>
{
Console.WriteLine($"Value = {value}"); // ; A-Phase Port Reading: {rotaryEncoderWithButton.Results.APhase}; B-Phase Port Reading: {rotaryEncoderWithButton.Results.BPhase}");
Console.WriteLine("Press started");
};
}`
The fix proposed in Pull Request #34 fixes the button issue. However, when I was addressing the Rotary issue I encountered some strange interactions. First I read the Digital ports my self and tried debugging, everything seems fine with the circuit in logic with events triggering how you would expect when using 2-bit gray code (clockwise aPhase triggers first; counterclockwise bPhase triggers first)
` private void DebugRotaryButton()
{
aPhaseTest = Device.CreateDigitalInputPort(Device.Pins.D07, InterruptMode.EdgeBoth, ResistorMode.PullUp, 200);
bPhaseTest = Device.CreateDigitalInputPort(Device.Pins.D06, InterruptMode.EdgeBoth, ResistorMode.PullUp, 200);
aPhaseTest.Changed += APhaseTest_Changed;
bPhaseTest.Changed += BPhaseTest_Changed;
}
`
Sample output is attached for this debug code. Rotate clockwise 5 times and counterclockwise 5 times. I will follow-up with some code that found part of the issue...
Downloaded the source for Meadow.Foundation and getting could not restore packages error, using Visual Studio for Mac.
Unable to satisfy conflicting requests for 'Meadow.Foundation': Meadow.Foundation (>= 0.18.0) (via project/Meadow.Foundation.Displays.GraphicsLibrary 0.9.14), Meadow.Foundation (>= 0.18.0) (via project/Meadow.Foundation.Displays.Pcd8544 0.6.12) Framework: (.NETFramework,Version=v4.7.2)
Unable to satisfy conflicting requests for 'Meadow': Meadow (>= 0.16.0) (via package/Meadow.Foundation 0.18.0), Meadow (>= 0.16.0) (via package/Meadow.Foundation 0.18.0) Framework: (.NETFramework,Version=v4.7.2)
Unable to satisfy conflicting requests for 'WildernessLabs.Meadow.Assemblies': WildernessLabs.Meadow.Assemblies (>= 0.3.2) (via package/Meadow 0.16.0), WildernessLabs.Meadow.Assemblies (>= 0.3.2) (via package/Meadow 0.16.0) Framework: (.NETFramework,Version=v4.7.2)
An item with the same key has already been added. Key: (Meadow.Foundation.Displays.GraphicsLibrary, 0.9.14)
Connected a TMP36 temperature sensor (ground, 3.3v and Analogue 0) as per this Arduino tutorial (except using 3.3v instead of 5v).
The implementation from Meadow.Foundation appears to be:
float millivolts = await AnalogPort.Read(1, _updateInterval);
float num = millivolts - _yIntercept;
Temperature = num * _millivoltsPerDegreeCentigrade;
But doing this (by hand or by using AnalogTemperature
) gives me very wrong results (e.g. -4,970 °C at room temperature).
By contrast, the following code gives me results around the 20°C mark:
float yIntercept = 500;
float millivoltsPerDegreeC = 10;
float millivolts = await analogPort.Read(1) * 1000; // results seem to be in V rather than mV
float temp = (millivolts - yIntercept) / millivoltsPerDegreeC; // Need to divide by mV/°C rather than multiplying
Console.WriteLine("{0:N2} millivolts, {1:N2}°C", millivolts, temp);
This also matches the maths in the linked Arduino tutorial better than AnalogTemperature
does.
Am I missing something?
Not sure if this is the right repo for issues with the WildernessLabs.Meadow.Assemblies package.
I noticed that the size of the package has ballooned from 3.06mb in v0.32 to 16.73mb in v0.4
When I upgrade my dependency on Meadow.Foundation to v 0.19 the dependencies now reflect all those assemblies. When I try and debug the application via Visual Studio it now tries to deploy all those assemblies
And hangs on System.Xml - I suspect because the Meadow board has run out of space, but the deployment just hangs.
Not sure if these are intended side effects?
I'm also seeing this behaviour when I try and deploy / run / debug any apps:
https://community.wildernesslabs.co/t/unable-to-load-dll-nuttx/1348
My code is event driven from rotary encoder and button. Then I'm using a timer event (System.Threading.Timer) to check encoder values and update LCD. In this timer event handler, I coded onboard led up for a heartbeat. Once the application is instantiated in the main function, I just Thread.Sleep(Timeout.Infinite); After some time heartbeat stops and rotary encoder rotation value stop being updated on LCD. Also after previous post, I was sure to hit reset before deploying.
The *.txt files are renamed *.cs
Hi,
i'm new to the meadow board and i'm trying to read the temperature of my DS18B20 sensor. I found in the repo an class but this was commented out. Are there any plans to support this type of sensor and the 1-wire protocol?
Thank you in advance,
Michael
If I display a line of text on the character display and then display a shorter line, any text displayed after the shorter line will not be removed.
Accurate of Meadow.Foundation.Displays.Lcd.CharacterDisplay v0.7.6:
CharacterDisplay display;
public MeadowApp()
{
Initialize();
DisplayCharacters();
}
void Initialize()
{
display = new CharacterDisplay(Device, Device.Pins.D05, Device.Pins.D07,
Device.Pins.D08, Device.Pins.D09, Device.Pins.D10, Device.Pins.D11,
16, 2);
}
private void DisplayCharacters()
{
display.WriteLine("0000000000", 0);
display.WriteLine("#####", 0);
// Line 0 will now display `#####00000`
}
`public HBridgeMotor(IPwmPort a1Pin, IPwmPort a2Pin, IDigitalOutputPort enablePin, float pwmFrequency = 1600)
{
_pwmFrequency = pwmFrequency;
_motorLeftPwm = a1Pin;
_motorLeftPwm.Frequency = 1600;
_motorLeftPwm.Start();
_motorRighPwm = a2Pin;
_motorRighPwm.Frequency = 1600;
_motorRighPwm.Start();
_enablePort = enablePin;
}`
Maybe 1600 is the only good value - then it shouldn't be specified ?
If you output the PushButton.State it will always output True for low and False for high.
However, if you look at the PushButton.PressStarted and PushButton.PressEnded events, PressStarted fires going from Low to High and PressEnded first from High to Low.
If you wire the button as a Pull Up or Pull Down something will always be wrong.
Sample code to demonstrate
using System.Threading;
using Meadow;
using Meadow.Devices;
using Meadow.Foundation.Sensors.Buttons;
using System;
namespace PushButtonSample
{
public class Program
{
static IApp _app;
public static void Main()
{
_app = new PushButtonApp();
}
}
public class PushButtonApp : App<F7Micro, PushButtonApp>
{
public PushButtonApp()
{
var pushButton = new PushButton(Device, Device.Pins.D08,40);
pushButton.PressStarted += PushButtonPressStarted;
pushButton.PressEnded += PushButtonPressEnded;
while (true)
{
Console.WriteLine($"State: {pushButton.State}");
Thread.Sleep(2000);
}
}
private void PushButtonPressStarted(object sender, EventArgs e)
{
Console.WriteLine("Press Started...");
}
private void PushButtonPressEnded(object sender, EventArgs e)
{
Console.WriteLine("Press Ended...");
}
}
}
Using the sample above. My readings are coming back at
Temp changed by a degree; new: 21938.23, old: 21712.65
Temp Changed, temp: 22010.74??C
Temp changed by a degree; new: 22010.74, old: 21938.23
Temp Changed, temp: 22163.82??C
Temp changed by a degree; new: 22163.82, old: 22010.74
Temp Changed, temp: 22091.31??C
In addition, if I remove all pins to the sensor I receive the following:
Temp changed by a degree; new: 14614.75, old: 14711.42
Temp Changed, temp: 14912.84??C
Temp changed by a degree; new: 14912.84, old: 14614.75
Temp Changed, temp: 15114.26??C
Temp changed by a degree; new: 15114.26, old: 14912.84
Temp Changed, temp: 15589.6??C
Thoughts?
trying to reproduce this guide. But events are not processed
http://developer.wildernesslabs.co/docs/api/Meadow.Foundation/Meadow.Foundation.Sensors.Buttons.PushButton.html
Sample code to demonstrate
using System;
using System.Threading;
using Meadow;
using Meadow.Devices;
using Meadow.Foundation.Sensors.Buttons;
namespace MeadowApplication1
{
public class MeadowApp : App<F7Micro, MeadowApp>
{
protected PushButton pushButton;
public MeadowApp()
{
Console.WriteLine("Initializing...");
pushButton = new PushButton(Device, Device.Pins.D02);
//while (true)
//{
// Console.WriteLine($"state: {pushButton.State}");
// Thread.Sleep(500);
//}
pushButton.PressStarted += (s, e) =>
{
Console.WriteLine("Press started");
};
pushButton.PressEnded += (s, e) =>
{
Console.WriteLine("Press ended");
};
pushButton.Clicked += (s, e) =>
{
Console.WriteLine("Button Clicked");
};
pushButton.LongPressClicked += (s, e) =>
{
Console.WriteLine("Long pressed!");
};
Console.WriteLine("PushButton ready...");
}
}
}
the commented block with the loop is working fine.
The same thing happens with other examples where EventHandler are used.
Would be nice to have a driver in ICs
for the NAU7802.
SparkFun has a breakout of it here.
Once we have a driver for the chip (or another chip driver like the HX711), then we can do a LoadCell
Sensor that uses it.
The following Sensors have address range checks in their constructors:
While the address check is helpful in the simple cases; it is possible to put these sensors on the i2c bus at different addresses.
Linear Device (part of Analog) has a chip to change addresses when there are conflicts on the bus.
see: LTC4316
It was mentioned on the forum that there was working going on to support this IC, however, its been a few weeks, and I have not heard anything. Is the work active? I would be happy to help move that along if I any help is needed. Is there a branch I can reference for this?
When turning on port D12, por D13 also turns on.
using Meadow;
using Meadow.Devices;
using Meadow.Foundation.Leds;
using System;
using System.Collections.Generic;
using System.Threading;
namespace PwmLed_Sample
{
public class PwmLedApp : App<F7Micro, PwmLedApp>
{
List<PwmLed> pwmLeds;
public PwmLedApp()
{
Console.WriteLine("Initializing...");
pwmLeds = new List<PwmLed>();
pwmLeds.Add(new PwmLed(Device.CreatePwmPort(Device.Pins.D12), TypicalForwardVoltage.Green));
pwmLeds.Add(new PwmLed(Device.CreatePwmPort(Device.Pins.D13), TypicalForwardVoltage.Blue));
TestPwmLeds();
}
protected void TestPwmLeds()
{
Console.WriteLine("TestPwmLeds...");
while (true)
{
Console.WriteLine("Turning on and off each led for 1 second");
foreach (var pwmLed in pwmLeds)
{
pwmLed.IsOn = true;
Thread.Sleep(500);
pwmLed.IsOn = false;
}
}
}
}
}
Running the code below results in the LED staying off from the output 'Turn back on' all the way through the end of the loop.
using System;
using System.Threading;
using Meadow;
using Meadow.Foundation.Leds;
using Meadow.Devices;
namespace LedSample
{
public class Program
{
static IApp _app;
public static void Main()
{
_app = new LedApp();
}
}
public class LedApp : App<F7Micro, LedApp>
{
public LedApp()
{
// create a new Led on pin 8
var led = new Led(Device.CreateDigitalOutputPort(Device.Pins.D08));
while (true)
{
Console.WriteLine("Start On");
led.IsOn = true; // Led ON
Thread.Sleep(3000); // 3 seconds
Console.WriteLine("Start Blink");
led.StartBlink(2000, 2000);
Thread.Sleep(1000); // 5 seconds
Console.WriteLine("Stop Blink");
led.Stop();
Console.WriteLine("Turn back on");
led.IsOn = true;
Thread.Sleep(5000);
Console.WriteLine("End Loop");
}
}
}
}
This is because the LED is set to on, while it is currently in the On step of blink and then it gets set to off in the blink task when it finishes the blink.
There are a lot of different solutions here, but I think my assumption using the code is that once I call led.Stop(), the blink command will not change state again and it will stop in whatever state it currently is.
This could be accomplished by checking the running state before turning the LED off and if it is no longer running to break the while loop.
Would be great to have a driver in ICs
for the HX711 load cell sensor (analog input with amplifier).
spark fun has a breakout board of it here.
Once we have a driver for the chip (or another chip driver like the NAU7802), then we can do a LoadCell
Sensor that uses it.
The PiezoSpeaker.PlayTone method throws an exception if the frequency is set less than or equal to 0, but if you pass in a frequency under 1 the board stops responding.
Running the code below works, but if you uncomment the .9f code section the board will stop and never make it to last tone. It isn't clear what happens, it keeps playing the .9f frequency tone, but never executes any more code.
public class MeadowApp : App<F7Micro, MeadowApp>
{
Meadow.Foundation.Audio.PiezoSpeaker piezo;
public MeadowApp()
{
ConfigurePorts();
TestPiezo();
}
public void ConfigurePorts()
{
Console.WriteLine("Creating Inputs...");
piezo = new Meadow.Foundation.Audio.PiezoSpeaker(Device.CreatePwmPort(Device.Pins.D10));
}
public void TestPiezo()
{
Console.WriteLine("Plate Tone 100");
piezo.PlayTone(100);
Thread.Sleep(500);
Console.WriteLine("Plate Tone 1");
piezo.PlayTone(1f);
Thread.Sleep(500);
//Console.WriteLine("Plate Tone .9");
//piezo.PlayTone(.9f);
//Thread.Sleep(500);
Console.WriteLine("Plate Tone 100");
piezo.PlayTone(100);
Thread.Sleep(500);
}
}
They need to be updated to modern pattern used elsewhere and described here. No threshold stuff, the IFilterableObservable
handles that now.
I would expect these to clear and fill the screen with whatever colors:
// these don't seem to do anything
//display.ClearScreen(8);
//display.ClearScreen(156);
//display.ClearScreen(1000);
//display.ClearScreen(40980);
does not.
Also, if do intend to support this API, we may want to take a color struct.
Hook up a spark fun SI7021
breakout board to the Meadow:
Breakout Pin | Meadow Pin |
---|---|
CL |
D08 |
DA |
D07 |
+ |
3V3 |
- |
GND |
Add the Si70xx
Meadow.Foundation package.
And run the following code:
using System;
using System.Threading;
using System.Threading.Tasks;
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Atmospheric;
using Meadow.Peripherals.Sensors.Atmospheric;
namespace MeadowApp
{
public class MeadowApp : App<F7Micro, MeadowApp>
{
Si70xx si7021;
RgbPwmLed onboardLed;
public MeadowApp()
{
Initialize();
// start updating continuously
si7021.StartUpdating();
}
void Initialize()
{
Console.WriteLine("Initialize hardware...");
// configure our SI7021 on the I2C Bus
var i2cBus = Device.CreateI2cBus();
si7021 = new Si70xx(i2cBus);
// get an initial reading
ReadConditions().Wait();
//// Note that the filter is an optional parameter. If you're
//// interested in all notifications, don't pass a filter/predicate.
//si7021.Subscribe(new FilterableObserver<AtmosphericConditionChangeResult, AtmosphericConditions>(
// e => {
// Console.WriteLine($"Temp: {e.New.Temperature.ToString("###.#º")}");
// }));
onboardLed = new RgbPwmLed(device: Device,
redPwmPin: Device.Pins.OnboardLedRed,
greenPwmPin: Device.Pins.OnboardLedGreen,
bluePwmPin: Device.Pins.OnboardLedBlue,
3.3f, 3.3f, 3.3f,
Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode);
}
protected async Task ReadConditions()
{
var conditions = await si7021.Read();
Console.WriteLine("Initial Readings:");
Console.WriteLine($" Temperature: {conditions.Temperature}ºC");
Console.WriteLine($" Relative Humidity: {conditions.Humidity}%");
}
}
}
it will fail with:
Initialize hardware...
Unhandled Exception: Meadow.Hardware.NativeException: Communication error. Verify device is powered and that SCL is Connected.
However, if you comment out line 23:
si7021.StartUpdating();
It'll read and work:
Initialize hardware...
Initial Readings:
Temperature: 29.4269??C
Relative Humidity: 24.69687%
Wiring up a single MCP input port with a switch to pull it low, should generate an interrupt on the configured Meadow interrupt pin via MCP23008.INT, but it does not in this configuration.
I would expect that every time MCP.GP7 gets pulled low by pressing the button, an interrupt on Meadow should fire.
As a secondary issue, even if an interrupt was generated, with this code the MCP.INT pin is not reset to GND when the button is released, but only when the pin is manually read again in the application loop - confirmed via Voltmeter. In other words, if I press the button, I get 3V3 on the meter immediately from MCP.INT, but when I release the button I don't get GND until the app loop calls
_mcp000.ReadPort(_mcp000_GP7.Pin);
Repro code is here - https://gist.github.com/pseabury/86fc28a3be74644fdf951c2c3b90402a
[EDIT] - Updated Fritzing to show the pullup resistors that are actually part of the prototype circuit.
the MCP driver has a couple issues:
Versions I'm using:
Beta 10,
MeadowFoundation 0.14.1
Meadow.Foundation.Displays.Lcd.CharacterDisplay 0.7.9
Simplest code that demonstrates the issue:
https://gist.github.com/CartBlanche/0186f282679ff637cc4fbea2a9104df1
Steps to reproduce:
Use the code found above. Deploy to the Meadow with the 20x4 LCD attached and confirgured.
After 17minutes the display stops updating.
Comment out the line
var downButton = new PushButton(Device, Device.Pins.D12);
And the code will continue for hours.
Problem - new PushButton defaults the resistor to disabled, even if it was set on the pin previously
so the resistor mode must be specified when PushButton is declared
Not sure if declaring an internal resistor when you already have an external one is a good idea or not
button b does not need the resistor, so i left it off.
Fixed code:
public OLED128x32Wing(II2cBus i2cBus, IDigitalInputPort portA, IDigitalInputPort portB, IDigitalInputPort portC)
{
this.i2cBus = i2cBus;
Display = new Ssd1306(this.i2cBus, 0x3C, Ssd1306.DisplayType.OLED128x32);
ButtonA = new PushButton(portA, ResistorMode.PullUp);
ButtonB = new PushButton(portB); // has physical resistor
ButtonC = new PushButton(portC, ResistorMode.PullUp);
}
The CharacterDisplay constructor that takes IDigitalOutputPorts as arguments does not call Initialize.
If you set a stroke width and then call DrawHorizontalLine
, the stroke width has no effect.
may also be the same with vertical lines, i haven't tested.
As a user of the library
I would expect the width and height parameters to be in pixels
as currently implemented - it only works for 1 bit per pixel bit maps,
so there are 8 pixels per byte horizontally
the user must know to divide the width by 8 and provide an array that is padded to the next byte multiple.
if ((width * height) != bitmap.Length)
{
throw new ArgumentException("Width and height do not match the bitmap size.");
}
There is also drawbitmap at the display level
https://github.com/WildernessLabs/Meadow.Foundation/blob/develop/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/Displays.TftSpi/DisplayTftSpiBase.cs
and maybe others
I couldn't find the source, but it seems after creating the SPICLockConfiguration the SpeedKhz property reports HZ rather than KHZ
var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode3);
Console.WriteLine($"SPI Speed {config.SpeedKHz}Khz");
result will be
SPI Speed 6000000Khz
rather than the 6000 input to the speedKhz parameter
public SpiClockConfiguration(long speedKHz, Mode mode);
public long SpeedKHz { get; set; }
//will probably skip for now
/* xMin = (uint)Math.Min(xMin, x);
xMax = (uint)Math.Max(xMax, x);
yMin = (uint)Math.Min(yMin, y);
yMax = (uint)Math.Max(yMax, y); */
this is in SetPixel
If you call Led.StartBlink() on a Led that is currently set to on it turns it off briefly before turning it back on at the beginning of the blink cycle.
I found this unexpected and the only way to figure out why it was flickering was to look at the implementation of StartBlink().
I think turning off the LED before the start of the blink sequence should be removed. It forces anyone who wants to go from the ON state to the Blink state to have a flicker and there is no way around it without writing your own implementation (and I can't imagine this is the desired before for anyone).
I wired up some breadboard NeoPixels and attempted some sample code. Does anyone know what I'm doing wrong or if NeoPixels are even supported? I can't get even one to blink.
using System;
using System.Threading;
using Meadow;
using Meadow.Devices;
using Meadow.Foundation.Leds;
namespace MeadowApplication1
{
public class MeadowApp : App<F7Micro, MeadowApp>
{
PwmLed neoPixel;
public MeadowApp()
{
ConfigurePorts();
BlinkLeds();
}
public void ConfigurePorts()
{
Console.WriteLine("Creating Outputs...");
neoPixel = new PwmLed(Device.CreatePwmPort(Device.Pins.D02,800), TypicalForwardVoltage.Red);
}
public void BlinkLeds()
{
Console.WriteLine("Starting main loop...");
while (true)
{
int wait = 200;
neoPixel.IsOn = true;
Thread.Sleep(wait);
neoPixel.IsOn = false;
}
}
}
}
Can Meadow support System.Device.Gpio?
In
namespace Meadow.Foundation.Sensors.Temperature the constructor for an AnalogTemperatureSensor allows for a Custom device using Calibration information.
The calculation for the yIntercept has an error, which causes almost any custom calibration to provide incorrect readings. The correct calculation should be:
_yIntercept = calibration.MillivoltsAtSampleReading - (calibration.SampleReading * calibration.MillivoltsPerDegreeCentigrade);
Pull request coming soon with this fix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.