pastebin - collaborative debugging tool
kpaste.net RSS

Difference between
modified post dbc817677 by Anonymous on Wed 5th Sep 2012 02:50
original post 3ad6c7c086 by Anonymous on Wed 5th Sep 2012 02:33
Download diff
Show old version | new version | both versions

    
1-
/*
2-
 * This is a non-traditional hello demo for Propeller-GCC.
3-
 * The demo repeats printing every 100ms with the iteration.
4-
 * It uses waitcnt instead of sleep so it will fit in a COG.
5-
 */
61
#include <stdio.h>
72
#include <propeller.h>
83
#include "pin.h"
94
105
int main()
116
{
127
    pinInput(2);
138
    pinOutput(16);
149
    pinOutput(23);
1510
    while(1) {
1611
        int Sensor = pinGetField(1,2);
1712
        waitcnt(CLKFREQ/10+CNT);
1813
      //  printf("\ntest: %d\n\n", Sensor);
1914
        if (Sensor == 0){
2015
            printf("No Movement! :D\n");
2116
            pinHigh(16);
2217
            waitcnt(CLKFREQ/10+CNT);
2318
            pinLow(16);
2419
        }
2520
        else if(Sensor == 1){
2621
            printf("OMG MOVEMENT!!!! D;\n");
2722
            pinHigh(23);
2823
            waitcnt(CLKFREQ/10+CNT);
2924
            pinLow(23);
3025
        }
3126
    }
3227
    return 0;
3328
}
3429

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at