pastebin - collaborative debugging tool
kpaste.net RSS


propeller c sensor
Posted by Anonymous on Wed 5th Sep 2012 02:50
raw | new post
modification of post by Anonymous (view diff)

  1. #include <stdio.h>
  2. #include <propeller.h>
  3. #include "pin.h"
  4.  
  5. int main()
  6. {
  7.     pinInput(2);
  8.     pinOutput(16);
  9.     pinOutput(23);
  10.     while(1) {
  11.         int Sensor = pinGetField(1,2);
  12.         waitcnt(CLKFREQ/10+CNT);
  13.       //  printf("\ntest: %d\n\n", Sensor);
  14.         if (Sensor == 0){
  15.             printf("No Movement! :D\n");
  16.             pinHigh(16);
  17.             waitcnt(CLKFREQ/10+CNT);
  18.             pinLow(16);
  19.         }
  20.         else if(Sensor == 1){
  21.             printf("OMG MOVEMENT!!!! D;\n");
  22.             pinHigh(23);
  23.             waitcnt(CLKFREQ/10+CNT);
  24.             pinLow(23);
  25.         }
  26.     }
  27.     return 0;
  28. }

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