From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dimmer control for LED lights with HTTP Requests

Hello,

 

I'm al little bit know with LabVIEW, but I have a problem that I can't get fixed.

For a project we control the led lights in a house with http requests (we use the http get request): this exists of a http address, the number of the light, the PWM (the brightness of the led) and the current.

Controlling the lights with the switches is easy and is working fine. Now what we want to do is create a dimmer that can be controlled with the switches in the rooms.

The following should happen: if the users clicks one time (so lets say for less than a second) than the light should just switch on. If he/she pushes the light switch and keeps pushing it than the light should dim.

So the value of the PWM (and this is a string value) should change from 0 to (lets say) 100 when pushing it once, and it should decrease form 100 tot 0 (step by step) when the user keeps pushing the button. The thing I'm having difficulties with is making a difference between just clicking once and keeping the button pushed for a few seconds in the labview software.

 

Any tips or ideas? Any Help is Welcome!

 

Thanks

 

CORE CVBA

 

 

0 Kudos
Message 1 of 4
(2,738 Views)

@CORECVBA wrote:

The thing I'm having difficulties with is making a difference between just clicking once and keeping the button pushed for a few seconds in the labview software.


It sounds like everything else is working and your problem is to detect the button action details.

 

Are you talking about a real physical switch or is this a switch on the LbVIEW front panel?

 

All you need to do is detect a off->on transition, When it occurs, place the current tick count into a shift register, then subtract it from the tick count in subsequent iterations (as long as the button is TRUE). Change your output as a function of the elapsed time until the button is released.

0 Kudos
Message 2 of 4
(2,729 Views)

Hi,

 

I'm talking about a real physical switch that we read in with a DAQ. We have no problem with the separate actions: just on/off, or dimming. But to make a differents between these two is the problem. I will try your solution.

 

Thanks for helping and I will let you know is it works!

 

CORE CVBA

0 Kudos
Message 3 of 4
(2,725 Views)

Here's a very primitive partial example.

 

Instead of reading the FP button, read your digital input.

 

(You need more code, e.g. if the output is not zero and the button is pressed, you might want to turn off, for example.)

0 Kudos
Message 4 of 4
(2,721 Views)