I just received my F7 Microv2.c board and I love it. I have so far gotten multiple LEDs working with a simple program using buttons to affect how they light. That’s just to give an idea of how far I have gotten with the device.
I am trying to use the St7789 display that I received in the kit. I believe I have it wired correctly, but all the examples I find are for the v1 boards. I try to clear and fill with a single color, and all I get are lines and bars.
If you have a good tool for drawing circuits I will draw mine out for you if you want, but it’s like this:
St7789<–>Meadow
gnd<–>gnd
VCC<–>3V3
SCL<–>SCK
SDA<–>COPI
RES<–>D00
DC<–>D01 (marked rx/com4/tx)
Edit: fixed my wiring… not sure why I got it all wrong at first
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays.TftSpi;
using Meadow.Foundation.Leds;
using Meadow.Hardware;
using System;
using System.Threading;
namespace MeadowApplication1
{
// Change F7MicroV2 to F7Micro for V1.x boards
public class MeadowApp : App<F7MicroV2, MeadowApp>
{
RgbPwmLed onboardLed;
St7789 display;
public MeadowApp()
{
Initialize();
CycleColors(1000);
}
void Initialize()
{
Console.WriteLine("Initialize hardware...");
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);
var config = new SpiClockConfiguration(new Meadow.Units.Frequency(6000), SpiClockConfiguration.Mode.Mode3);
display = new St7789(
device: Device,
spiBus: Device.CreateSpiBus(
Device.Pins.SCK, Device.Pins.COPI, Device.Pins.CIPO, config),
chipSelectPin: Device.Pins.D02,
dcPin: Device.Pins.D01,
resetPin: Device.Pins.D00,
width: 240, height: 240);
}
void CycleColors(int duration)
{
Console.WriteLine("Cycle colors...");
while (true)
{
ShowColor(Color.Blue, duration);
ShowColor(Color.Cyan, duration);
ShowColor(Color.Green, duration);
ShowColor(Color.GreenYellow, duration);
ShowColor(Color.Yellow, duration);
ShowColor(Color.Orange, duration);
ShowColor(Color.OrangeRed, duration);
ShowColor(Color.Red, duration);
ShowColor(Color.MediumVioletRed, duration);
ShowColor(Color.Purple, duration);
ShowColor(Color.Magenta, duration);
ShowColor(Color.Pink, duration);
}
}
void ShowColor(Color color, int duration = 1000)
{
display.Clear();
display.Fill(color);
display.Show();
Console.WriteLine($"Color: {color}");
onboardLed.SetColor(color);
Thread.Sleep(duration);
onboardLed.Stop();
}
}
}
I modified the Hello Meadow example to start displaying colors on this display instead of just the onboard LED.
Any help would be appreciated. Thanks!
Domenic