OpenSprinkler Forums Comments, Suggestions, Requests Controlling valves in other languages Reply To: Controlling valves in other languages



Ray, you are awesome, that was it! After wrestling with a lowercase ‘p’ in the string value on pin 14 for 30 minutes (face palm) I finally got it to work. I’m a little disappointed I didn’t figure this out as I was aware of the OE pin functionality, I just assumed enabled by default, that and it’s always late at night when I try to work on this. Appreciate your help!

To document my solution, the following code leveraging the bonescript library in nodejs will open and close the valves on the OSBo. binaryZones is an Integer that has had bits set using JS bit manipulation library.

function enableZones(binaryZones) {    //example if binaryZones == 9: binaryZones.toString(2) == 1001   This would enable zones 1 and 4
    bone.digitalWrite(outputEnabled,  bone.LOW);
    bone.digitalWrite(latch,  bone.LOW);
    for(var x = MAX_ZONES; x > 0; x--) {
        bone.digitalWrite(clock, bone.LOW);
        bone.digitalWrite(data, bone.LOW);
        if (binaryZones & (1 << x - 1))
            bone.digitalWrite(data, bone.HIGH);
        bone.digitalWrite(clock, bone.HIGH);

    bone.digitalWrite(latch,  bone.HIGH);