Categories
Arduino Projects

Tree OTA updates

Something I should’ve done long ago – enabling OTA (Over The Air) firmware updates so I don’t have to disassemble the project box and move the tree every time I want to change its code.

To add a touch of UX, the pixels represent the upload progress. 😎

NeoPixel tree being updated via OTA firmware update.
Categories
AI SwiftUI

Can ChatGPT draw a Christmas tree in SwiftUI?

Here’s the prompt I gave ChatGPT:

Draw a Christmas tree using SwiftUI

Here’s the code I got:

struct ChristmasTree: View {
    var body: some View {
        ZStack {
            // draw the tree trunk
            Rectangle()
                .fill(Color.brown)
                .frame(width: 20, height: 100)

            // draw the tree branches
            ForEach(0..<5) { i in
                HStack(spacing: 5) {
                    ForEach(0..<5-i) { j in
                        Triangle()
                            .fill(Color.green)
                            .frame(width: 10, height: 10)
                    }
                }
                .offset(x: 0, y: -10 * CGFloat(i))
            }

            // draw the star on top of the tree
            Circle()
                .fill(Color.yellow)
                .frame(width: 10, height: 10)
                .offset(x: 0, y: -50)
        }
    }
}

The only major issue syntax-wise is that Triangle() isn’t defined – where did it get that?

A quick visit to Hacking with Swift had this nice snippet, which I dropped in.

struct Triangle: Shape {
    func path(in rect: CGRect) -> Path {
        var path = Path()

        path.move(to: CGPoint(x: rect.midX, y: rect.minY))
        path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY))
        path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY))
        path.addLine(to: CGPoint(x: rect.midX, y: rect.minY))

        return path
    }
}

Now we can compile and…. tada!

A Christmas tree in SwiftUI drawn by ChatGPT

Not great, but darn impressive! 🎄🤯

Categories
Thoughts

A K&R classic

It has been zero days since opening this classic.

Categories
Arduino Fun iOS SwiftUI

NeoPixel tree progress

This weekend the NeoPixel tree got many much-needed updates!

Though I have more ideas to implement, the basics of what I wanted to do are complete, like sending commands remotely.

What we can currently do:

  • Set the brightness
  • Change the color
  • Turn the pixels off
  • Run some built-in sequences, like a nice rainbow
  • Set repeating color patterns
  • Set individual pixels

I also threw together a really quick iOS app to set the color with SwiftUI’s built-in ColorPicker view. Thanks to the Rover project (another one that’s been neglected), I had some UDP client code I could borrow to speed up development.

Changing the color of the tree with a SwiftUI ColorPicker view.
Categories
Fun Projects

The tree is smarter!

I’m finally taking the time to make the NeoPixel Christmas tree smarter this year.

My current plan is to:

  1. Connect it wirelessly to the network (it has an ESP8266, after all)
  2. Run a UDP server on it
  3. Respond to various commands
  4. Write a client that sends UDP packets to it

It’s fun to design UX for limited hardware. In this case, the tree starts with an orange pattern that rotates until a WiFi connection is successful. If it fails the tree will go red, otherwise the tree briefly goes green to let the end user know all is well before starting its first sequence.

Nifty! 🎄

Categories
Apple Fun iOS Retro Computing

iPadOS on a CRT

I have lots to post about related to my recent vintage / retro computing adventures, but in the meantime here’s iPadOS on a CRT.

It’s actually kind of nice! The biggest downside, however, is that the CRT only ran at 1280×1024@60Hz. The resolution is fine, but the refresh rate is quite low for a CRT – my eyes wouldn’t be able to handle it very long. I’ve always been sensitive to rates lower than 85Hz on CRTs.

The hardware to make it work:

  1. A CRT.
  2. An iPad.
  3. An Apple Digital AV adapter which has HDMI output, such as this USB-C one.
  4. An active HDMI -> VGA adapter such as this one (it has to have external power).
  5. A USB hub is nice for wired peripherals, but optional. I have a wired Microsoft Optical mouse with a Keychron C1 (reds) connected in this video.
Categories
Retro Computing Thoughts

Voodoo Economics

I have two GPUs on my desk right now. On the left is my Voodoo3 3000 that I’ve had for ~20 years. On the right is my GTX 1060 6GB from 2017.

Due to the retro computing market, the Voodoo3 sells for more. 😳

Left: Voodoo3 3000 Right: GTX 1060 6GB

Categories
Thoughts

An old, bad purchase

If bad investments have got you down, let me share with you the time I paid ~$200 for a 40GB SSD with a write speed of 40MB/s and a read of 185MB/s. 😬

Oh, and I bought two.

Categories
Apple Scripts

A dog timer Shortcut

Shortcuts User Guide - Apple Support

I’ve played with the Shortcuts app a few times and although their power is impressive, I haven’t found a need for any in my day-to-day workflow. This Shortcut may finally change that.

Here’s the problem

Our dog literally can’t handle the heat. She’s a Miniature Schnauzer born with a microtrachea so she struggles to regulate her body temperature. If she gets overheated it’s bad news.

I typically let her out multiple times a day while working from home. All I have to do is open up our back door, let her out into her fenced doggie area, and let her back in when it’s time.

That last item is trickier than it sounds – if I don’t set a timer I risk getting into the zone at work and losing track of the world. That could be disastrous, so up until now I’ve set a timer and altered the duration depending on the temperature outside. I wondered if I could improve that with a Shortcut.

Categories
Apple Thoughts

The Mac Studio

I’ve had a Mac Studio for a month now, so I have thoughts to share.

tl;dr – It’s great and is what I’ve wanted from Apple for a long time.

The product line gap

There’s been a gap in Apple’s Mac product line for years, though most consumers wouldn’t have noticed, and that’s the reason it existed.

Here’s a user who fits the profile:

  • Wants a desktop
  • Wants complete control over their displays
  • Wants modularity
  • Wants a bunch of ports
  • Wants high(er) performance
  • Needs macOS

The user is me.