Announcement

REXYGEN forum has been moved. This one is closed.
Head over to the new REXYGEN Community Forum at https://forum.rexygen.com.

Looking forward to meeting you there!
 

#1 2016-04-10 18:02:02

uxhamby
Member
Registered: 2016-03-25
Posts: 10

even / odd ?

Hi,

Suggestions as to how I can take say the minutes output of the time function block and test it to see if it is even or odd?

Thanks,

Brian H.

Offline

#2 2016-04-10 21:09:29

scoobsalamander
Member
From: Belgium - Hulshout
Registered: 2015-10-27
Posts: 217

Re: even / odd ?

By using the 'IMOD – Remainder after integer division' funion block. Divide by two and if the result is zero then it is even.
(if you need a pulse every 5 minutes then divide theminutes by 5 and check for zero....)

Checking the first bit is also a possibility, if the first bit (value "1") is high then the number is odd. (Bitwise 'AND' with value 0x01, if result is zero then it is odd. Use BITOP block)

Last edited by scoobsalamander (2016-04-10 21:11:19)

Offline

#3 2016-04-10 22:58:48

uxhamby
Member
Registered: 2016-03-25
Posts: 10

Re: even / odd ?

Cool! Thanks.

Brian H.

Offline

Board footer

Powered by FluxBB