Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Fun with AI and swordfish basic

I have some tube lights with 300 leds for 50 watts but some only need one color red or blue the rest
do a wave of blue red green there 80 of tubes i used the esp 32 and wled for those
now back to making led tubes


 
Last edited:
here's a version of the SendByte() sub that would produce a lot better timing (based on that original AI code)

Code:
Sub SendByte(ByVal DataByte As Byte)
    dim i as byte
    
    For I = 0 To 7 ' Loop 8 times for 8 bits
        ' send bits msb to lsb
        If DataByte.bits(7) = 1 Then ' Send a '1' bit
            ' Send 1-bit (T1H: ~0.8us HIGH, T1L: ~0.45us LOW)
            ' T1H: 4 instruction cycles (0.8us)
            ' T1L: 2-3 instruction cycles (0.4-0.6us)
            WS2812BDataPin = 1
            NOP ' 200ns
            NOP ' 400ns
            NOP ' 600ns
            NOP ' 800ns (approx T1H)

            WS2812BDataPin = 0
            NOP ' 200ns
            NOP ' 400ns (approx T1L)
        Else ' Send a '0' bit
            ' Send 0-bit (T0H: ~0.4us HIGH, T0L: ~0.85us LOW)
            ' T0H: 2 instruction cycles (0.4us)
            ' T0L: 4-5 instruction cycles (0.8-1.0us)

            WS2812BDataPin = 1
            NOP ' 200ns
            NOP ' 400ns (approx T0H)

            WS2812BDataPin = 0
            NOP ' 200ns
            NOP ' 400ns
            NOP ' 600ns
            NOP ' 800ns (approx T0L)
            NOP ' 1000ns (Optional, for slightly longer T0L if needed)
        End If
        DataByte = DataByte << 1
    Next
End Sub

Timing is always going to be an issue with these, so something that uses hardware would be a lot better.
 
Nigel I’ve looked at clc I think I even got it to work once I was using MP Lab X online they had a tutorial. Can’t find it anymore. I’m just messing around with that AI.
 
I been using esp but some of my led tubes only need to come on with one color so I figure I’ll try pic chips for that
 
I been using these for years there ws2815b is what I’m using I have 9600 leds what I was saying is I wanted to use just a pic chips for some of the tubes there only one color but I’m using the same LEDs this lets me use the esp 32 for light shows
And just something simple for the solid colors
I just did the AI code for fun.

I have a working system for the tubes
I have a working code for XC 8
And I us wled for esp really awesome free sw28xx
LED control app for ESP
You can make led walls with it cool stuff
 

Latest threads

Back
Top