/* * This is a non-traditional hello demo for Propeller-GCC. * The demo repeats printing every 100ms with the iteration. * It uses waitcnt instead of sleep so it will fit in a COG. */ #include #include #include "pin.h" int main() { pinInput(2); pinOutput(16); pinOutput(23); while(1) { int Sensor = pinGetField(1,2); waitcnt(CLKFREQ/10+CNT); // printf("\ntest: %d\n\n", Sensor); if (Sensor == 0){ printf("No Movement! :D\n"); pinHigh(16); waitcnt(CLKFREQ/10+CNT); pinLow(16); } else if(Sensor == 1){ printf("OMG MOVEMENT!!!! D;\n"); pinHigh(23); waitcnt(CLKFREQ/10+CNT); pinLow(23); } } return 0; }