C_and_CPP / lhz135 / 20191222

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> #define MASK(LEN) ((1<<(LEN)) - 1) #define LROTATE_4(BITS) (((((BITS) << 1) | ((BITS) >> 3))) & MASK(4)) int main(void) { const unsigned Bits = 0b0011; const int Start = 8; const int NumStep = 4; const int NumRound = 4; for (int Round = NumRound, Signal = Bits; Round > 0; --Round, Signal = LROTATE_4(Signal)) { int FirstArg = Start; int SecondArg = Signal; int Step = NumStep; for (; Step > 0; --Step, ++FirstArg, SecondArg >>= 1) { printf("digitalWrite(%d, %d)\n", FirstArg, SecondArg & 1); } printf("delay(t)\n\n"); } return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines