On 21/02/18 07:42, Andy Burns wrote:
> The Natural Philosopher wrote:
>
>> print(last==readpin()?((last=readpin()==OPENED)?"Opened":"Closed"):"");
>>
>> I knew one line was possible!
>
> Apart from the case when the pin changes state between your two reads ..
Damn. :-)
Been there, done that ...."Your code has a bug - every twenty minutes or
so it simply locks up"...
Timer interrupt between two statements in the entire OS would do just that..
Thank god for ICE's
Friend worked on the original ARM OS. Itr would lock up ebvery ciuple of
hours. They fund a race coindition., A wait state made it lockup up
every couple of weeks. So they added two wait states, and that made it
only once every ten years 'At which point they will just put it down to
cosmic rays and reboot it anyway' he said 'if anyone was using the
computer switched on that long'
Doesn't the pi have GPIO interrupts?
--
All political activity makes complete sense once the proposition that
all government is basically a self-legalising protection racket, is
fully understood.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|