使用Visual Basic控制照明调光器 [英] Using Visual Basic to control a lighting dimmer

查看:59
本文介绍了使用Visual Basic控制照明调光器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这一切都很陌生,请原谅我缺乏技术说明。


项目背景:

基本上我有过过去3年创建家居照明控制系统的愿景。今年我一直在努力让原型模型正常工作。


我需要弄清楚如何使用visual basic在几秒钟内淡化到想要的数字。从那里我可以使用USB接口卡将数字转换为模拟电压(0 - 10v)然后控制我的照明调光器。


简单来说,如果我参考水平光输出百分比,如果我想在5秒内从0%变为100%,它将在5秒内逐渐消失至完全打开。同样,如果我想在3秒内从70%变为30%,它会这样做。我确实有一个使用计时器和VScroll栏给我的例子,但是在某些地方它会让人感到困惑。


对于长篇描述很抱歉但是我真的很想要让这件事有效!


如果有人能以任何方式帮助我,我将非常感激。


Adam

解决方案


我确实有一个使用计时器和VScroll栏给我的例子,但是在某些地方它会让人感到困惑。



你能在这里发布你的代码供我们的专家参考^ ^


Rey Sean


您使用的是哪个版本的VB?根据版本的不同,定时器,事件和事情的工作方式也大不相同。


总而言之,这听起来很酷,并不太难。

从逻辑上考虑......如果你需要在5秒内从0%增加到100%。每秒钟你增加20%。


所以如果你把你的计时器设置为1000毫秒.....相当于1秒

设置你的进度条最大值为100

只需在每个循环的进度条上添加20

例如:

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

Hi, I''m quite new to all this so please forgive my lack of technical description.

Project background:
Basically I have had the vision of creating a home lighting control system for the last 3 years. This year I have been trying really hard to get a prototype model working.

I need to work out how to use visual basic to ''fade'' to a desired figure in a number of seconds. From there I can convert the figure into an analogue voltage (0 - 10v) using a USB interface card and then control my lighting dimmer.

In simple terms, if I refer to the level of light output in percent, if I want to go from 0% to 100% in 5 seconds it would fade off to fully on in 5 secs. Likewise if I want to go from 70% to 30% in 3 secs it would do so. I did have an example given to me using a timer and a VScroll bar, but somewhere along the lines it gets confused.

Sorry about the long description but I''m really eager to get this thing working!

If anyone can help me in any way I will be very grateful.

Adam

解决方案

I did have an example given to me using a timer and a VScroll bar, but somewhere along the lines it gets confused.

Can you post your codes for the reference of our experts here ^ ^

Rey Sean


What version of VB are you using? Timers and events and things work quite differently depending on the version.

All in all though, it sounds like quite a cool idea, and not too difficult.


Think about it logically......if you need to increase from 0% to 100% in 5 seconds. for each Second you increase by 20%.

So if you set your timer to 1000milliseconds.....Equivalent of 1 second
Set your progress bar to a max value of 100
Just add 20 to the progress bar on each loop
For example:

Expand|Select|Wrap|Line Numbers


这篇关于使用Visual Basic控制照明调光器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆