Windows 7 web support

Hi all, I’m having fun with this deice except it doesn’t seem to work on my pc’s browser.
I run Chrome ( Version 79.0.3945.117 (Official Build) (64-bit ) local address is set to 192.168.1.134
I can see it and configure it with all the other pc"s on the network. Although they are all running windows 10 or on a tablet / smart phone.
If any body has any input please let me know what the resolution might possibly be.
side note:: on the behavior using the ip address it never times out just sits there and seems to load but never does.

Please help.

Hi Scott,
I haven’t heard of anything like that. Not sure what could cause it. Maybe some firewall setting or security thing in Windows? I do support chrome as a browser, and it’s odd because it works on your other devices.

Stuff to try:
Incognito mode
Download another browser.
Checking security settings
Get a dev tool, maybe curl and see if it can access the page.

Continuing the discussion from Windows 7 web support:

Thanks,
It is very odd in deed, I have in no way got it to work on this particular laptop it is a much older unit
" Windows 7 / I-5 processer "
Non updated due to Windows control issues and programs that I use that have to run natively. All that aside it does everything else just fine just can’t get this device on this one machine, where else it runs perfectly on all others in the environment.
The web interface is it java, flash or oricle bassed maybe I can look into it’s driver support.
Thanks for any assistance.
Scott Frazier

Ben,
I got it,
Strange enough it was a DNS error. Had to do a cmd line dnsflush to get it fixed.
Up and working on my PC now. :slight_smile:

How ever I’m beating my head against the wall with what I’m trying to do on a particular code.

Any pointers?

using 2 of the gpio pins, one controlling the intensity and other a direction.
gpio pin** = H / L
I’m trying to paint a strip in four passes from one end too the other going from Dk Blue, Lt Blue, Turquoise and to White then halt until
gpio pin** goes low, then it reverses direction in the reverse order of the first series of colors back to Black / or off)
the 2nd gpio pin ( =var) assigns the overall brightness of the strip from 20%-80% via a potentiometer
but the gpio pin has no effect until it has ended the paint / depaint script.
((( I figured I could use a pixelCount array with some guide line code to do it but keep getting stymied )))
help if you have time or just a pointer or two.
relay cool little device. appreciate all your hard work on this little gadget. :slight_smile:
this doesn’t seem hard, but it’s bustin my chop’s.

Hi @scottf,
I don’t really follow, can you post your code? I’d be happy to take a look at it.

Ben
I ditched it all and started over,
I’m a very novice code person. and trying what I think to be easy but just not for me. :confused:

Here’s the scope of the idea.
gp4 input pin when == HIGH runs a series of 2812b’s from pixel 0 - pixelCount “288” ( color #1 ( dark blue )
to full pixelCount all @ 80%, then starting again at pixel 0 paints the strip over the preceding color with a new color, ( color # 2 ( turquoise )
and finally on the last pass it paints it to white, where it remains. until the time ( gp4 goes LOW)
then does the same pattern in full reverse all pixels from white, wiping to turquoise then to dark blue-and fade out to black =“off”

to add to this, gp5 ( brightness ) when LOW strip is at 80% brightness but when gp5 is HIGH drops to 20% total brightness
or this could be a form of a variable assignment.
if any of this makes sense

I’m still trying to wrap my head around all the variables.
Thanks for any sort of guidance you may be able to offer,
I’m trying to learn this but I’m old school Basic taught :slight_smile:
Scott Frazier

Hey Scott! We were all new once!

I think this is what you’re trying to do, yeah?

Here’s the code - hope it’s a good starting point.

// We scroll a "window" of pixelCount LEDs through a space of 4 total colors
totalSpace = pixelCount * 4

// The left hand side of that window starts 75% of the way through the space
windowLeft = totalSpace - pixelCount
speed = 0.1
brightness = 0.8
direction = 1

// These UI sliders simulate GP4 & 5.  Requires running Pixelblaze >= v2.18
// The window moves in the left direction (-1) when GP4 is high.
export function sliderGp4Direction(v) { direction = (v > 0.5) ? -1 : 1 }

// brightness is 0.2 (20%) when GP5 is low; 80% when it's high
export function sliderGp5Brightness(v) { brightness = 0.2 + 0.6 * (v > 0.5) }

export function beforeRender(delta) {
  // When reading GPIO pins on real hardware, you might want to put your
  // digitalRead() or readAdc() here in order to set direction and brightness.

  // Move the left side of the window in space left or right.
  windowLeft += speed * delta * direction
  
  // But the left side of the window can't be less than 0 or more than  
  // a strip's length away from the rightmost side of totalSpace
  windowLeft = clamp(windowLeft, 0, totalSpace - pixelCount)
}

export function render(index) {
  // This pixel is actually pixel no. `position` out of `totalSpace`
  position = windowLeft + index
  
  if (position <     pixelCount) { hsv(0.5, 0, brightness) } else // white
  if (position < 2 * pixelCount) { hsv(0.5, 1, brightness) } else // turquoise
  if (position < 3 * pixelCount) { hsv(0.7, 1, brightness) } else // blue
                                 { hsv(0.7, 1, 0) }               // black
}
2 Likes

Hi @scottf,
No worries at all, I just couldn’t grok what you wanted to do the first time.

Thank you @jeff for helping out, and a video to boot, cool!

Jeff,
I have been beating my self up on this.
Help If you can or maybe tell me where I’m straying here.

I have tweaked it some but still cant get HARDWARE to work.


totalSpace = pixelCount * 5
windowLeft = totalSpace - pixelCount
speed = 0.13
buttonPin = 5
buttonPin = 4
// buttonPin "PULLUP" won't be used in real hardware, will be brought high via power switch
pinMode(buttonPin, INPUT_PULLUP)

export function sliderpower(p) {direction = (p > 0.5) ? -1 : 1}
export function sliderlights(i) { brightness = 0.02 + 0.7 * (i < 0.5)}


export function beforeRender(delta) {
  // this dims the brightness only when HIGH
   var lights = digitalRead(5)
   if (lights <= 0 ) 
  lights = (lights) 
  // this paint's the strip when HIGH and De-Paint's it when LOW
  var power = digitalRead(4)
   if (power <= 0)
   power = (power)
  
  
  
windowLeft += speed * delta * direction
windowLeft = clamp(windowLeft, 0, totalSpace - pixelCount)
}

export function render(index) {

position = windowLeft + index
  if  (position <     pixelCount) { hsv(.52, 0.2, brightness) } else // white 
 
  if (position < 2 * pixelCount) { hsv(0.525, 1, 1) } else // turquoise
  
  if (position < 3 * pixelCount) { hsv(0.599, 1, 1)} else // light blue

  if (position < 4 * pixelCount) { hsv(0.668, 1, 1) } else // blue

                                 { hsv(0, 1, 0) }          // black

}

I seem not to be able to call the function even though I have had it working else ware.

Help, I do appreciate you’er input.

HI Scott! Thanks for posting your code. I’m assuming that when you said, “still can’t get the HARDWARE” to work, you’re saying the problem is that you can’t get the digitalRead(pin) code to control the direction and brightness like the sliders were in my code, right? I was a little confused where you said “I seem not to be able to call the function” because I’m not sure which function you aren’t able to call (one of the hsv()?)

Assuming your issue is more with getting the pins to control the pattern:

  1. export function sliderpower§ -I’m assuming the § was a copy-paste glitch. To test your code, I replaced it with (p). You can bring in large blocks of PixelBlaze code into the forum cleaner with this trick: three backticks and the language name. So start a code block with ```javascript and end the block with ```
  2. Probably not your problem, but I did notice that you double-define the variable buttonPin:
    buttonPin = 5
    buttonPin = 4
    
    and you might want to increase the clarity of what pin you’re reading by doing something lower like digitalRead(brightnessButtonPin)
  3. I think the main issues however might be:
    1. The local “scope” of your variables power and lights
    2. Being sure to use the results of those digitalRead() in the pattern math lower, specifically, in how you replace the variables I had named brightness and direction.

Let’s start with local scope.

In the always-helpful Pixelblaze docs, it says:

You can also declare local variables inside functions using the var keyword.

See how you are inside function beforeRender() when you do var lights = digitalRead(5)? Because you start that line with var, it means that the lights variable will only be accessible inside beforeRender() - but the code comment right above it seems like you intended the lights variable to control brightness - that means you’ll want to get at it in a different function, render() – specifically the value in all those hsv(h,s,value) calls. Therefore, you’ll want to remove the var from the start of those lines if you want to access your lights and power variables outside of beforeRender().

Second, let’s talk about how you intend to use those two variables in the pattern math. I’m assuming from the code comments that your power variable is essentially trying to do what I chose to call direction - so be sure to find-and-replace direction with power, or perhaps more simply, I might suggest:

if (digitalRead(powerPin) == 0) {
  direction = -1
} else {
  direction = 1
}

which is the same as the terser:

direction = digitalRead(powerPin) ? -1 : 1

You’ll need to do similar checking with what you decide to do to replace my brightness variable, which is currently set when the UI slider is moved, with your lights variable.

Hope some of this helps!

1 Like

Thank You Jeff,
got it to mostly work, still have a few bugs to work out.
You’er input most appreciated.
“” So I understand the VAR is usually called on the Before Render but is usually unnecessary within the function Render parts of the script, Correct? “”
I do appreciate all the help I’m getting with the folks on this Forum @wizard , Jeff, You are a great help to an old Dog, learning some of the new tricks. :slight_smile:

You got it - var in front of a variable makes it local when a variable is defined like that in ANY function, not just in the special beforeRender() or render(). “Local” means that that variable is not accessible outside of the function it was defined in.

As opposed to local variables, you’ll want to use global variables for anything that you want to set inside of beforeRender() and then use inside of render().

Knowing where a variable name has shared access vs being protected from being used elsewhere is called ‘scope’. Pixelblaze has local and global scope, and local means inside of the function it was defined in.

Jeff,
Thanks for all your help, got it mostly tweaked , now to get it installed. :slight_smile:
will upload pictures once that’s done.

Here’s phase 2 of the same project ( this works ) but there might be a simpler or better way to accomplish it without the paging effect. the idea is just fade from full saturation to pure white via a gpio - input pin, and keeping the ability to adjust the intensity and color.
(((((
“Here’s the code as I have it now”

totalSpace = pixelCount * 10 // single pixel render
stripaint = totalSpace - pixelCount
color = pixelCount
intense = pixelCount
speed = 0.004
powerPin = 4

pinMode(powerPin, INPUT_PULLUP)

export function power§ {direction = (p > 0.5) ? -1 : 1}

export function beforeRender(delta) {

stripaint += speed * delta * direction
stripaint = clamp(stripaint, 0, totalSpace - pixelCount)
}
// selects the color to be rendered
export function sliderColor(h){ color = h}
color < 1
// controls overall brightness of the pixels
export function sliderIntensity(h){ intense = h}
intense < 1

export function render(index) {

// pixel saturation via power status input
if (digitalRead(powerPin) == 1) { direction = -1
} else { direction = 1
}
// pixel saturation level call points
position = stripaint + index

if (position < pixelCount) { hsv(color, .1, intense) } else

if (position < 2 * pixelCount) { hsv(color, .2, intense) } else

if (position < 3 * pixelCount) { hsv(color, .3, intense)} else

if (position < 4 * pixelCount) { hsv(color, .4, intense) } else

if (position < 5 * pixelCount) { hsv(color, .5, intense) } else

if (position < 6 * pixelCount) { hsv(color, .6, intense) } else

if (position < 7 * pixelCount) { hsv(color, .7, intense) } else

if (position < 8 * pixelCount) { hsv(color, .8, intense) } else

if (position < 9 * pixelCount) { hsv(color, .9, intense) } else

                             { hsv(color, 1, intense) }          

}

Its a variable of the other one " this one will only be rendering a single pixel.
“” Side note I’m trying to figure out a way to get the PWM drive to ride on the power leg “”
this end goal it to use existing wiring for the application. I’ll keep you posted on that endeavor.

1 Like