Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37608
| From | "R.Wieser" <address@not.available> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Light on Light off problem |
| Date | 2019-10-23 10:29 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <qop31t$hvf$1@gioia.aioe.org> (permalink) |
| References | <72db4297-267f-49d5-b858-c835a7f7eaa8@googlegroups.com> |
Jonas,
> Suggestion for howto do the check on array to see all lightbulbs turned
> off
I don't get it. Whats the problem with an "if ({array element} = {some
content} ) then" construction ? What is the /problem/ you (think you) have
?
> store the ones still turned on,
Why ? All you want to do is to switch the ones that are still on to off.
You can do that in the checking loop itself, no need to store anything.
.. And can be done even easier : just tell all of them (one by one ? Or
perhaps by a broadcast ?) to switch off. That is, if you have seperate
commands for on and off switching ofcourse.
> "Seem a bit cumbersome to make"
>
> Well it easy to read array backward to see, the ones from end still
> turned on. But many lightswitches could been set on earlier.
I don't get that I'm afraid. Somehow you seem to be saying that the lamps
could be in a state thats different from what you have in the list ?
> One could make an extra array names "OFF", with 128 booleans.
Or you could start with showing us what you have stored in the array you've
already got (one lamps record will probably do fine), so we know what you
are looking at, and perhaps do something more than guessing. <whistle>
A little bit about the lamps themselves would be good too : Do they just
toggle or do they have seperate on and off commands ? Can you ask for their
current state ?
> How would you solve it?
See above. I would KISS it (Keep It Stupidly Simple. Or Keep It Simple,
Stupid. Your choice :-p ) and not even check the current states, as they
would not do me any good (after execution all the lamps should be off).
Regards,
Rudy Wieser
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 00:19 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 00:58 -0700
Re: Light on Light off problem luserdroog <luser.droog@gmail.com> - 2019-10-23 01:04 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 01:25 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 01:29 -0700
Re: Light on Light off problem JJ <jj4public@vfemail.net> - 2019-10-23 15:46 +0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 01:57 -0700
Re: Light on Light off problem "R.Wieser" <address@not.available> - 2019-10-23 10:29 +0200
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 02:04 -0700
Re: Light on Light off problem "R.Wieser" <address@not.available> - 2019-10-23 11:30 +0200
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 02:39 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 02:44 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 03:01 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 02:16 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 02:31 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 03:30 -0700
Re: Light on Light off problem Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-10-23 08:25 -0700
Re: Light on Light off problem "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-23 12:08 -0700
csiph-web