Advertisement
AtomSoft

Flipper

Jan 15th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. /*
  2.  AtomSoftTech
  3.  http://atomsoft.wordpress.com
  4.  Jason Lopez
  5.  Flipper :MADE FOR: XMOS StartKIT
  6. */
  7.  
  8. #include <xs1.h>
  9. #include <timer.h>
  10.  
  11. #define MODES 4
  12.  
  13. int leds[MODES] = {
  14.  
  15.     0xE1C00,
  16.     0x61700,
  17.     0xC1B00,
  18.     0xC1580
  19.  
  20. };
  21.  
  22. /* This the port where the leds reside */
  23. port p32 = XS1_PORT_32A;
  24.  
  25. int main(void) {
  26.     int delay = 150;      // initial delay 50 ms
  27.     int led_counter = 0; // A counter to count through the leds array
  28.     while(1) {
  29.         delay_milliseconds(delay);        // Wait
  30.         //delay += 1;                       // Gradually increase the delay
  31.         p32 <: leds[led_counter];         // Drive the next led pattern
  32.         led_counter++;                    // Pick the next pattern
  33.         if (led_counter == MODES) {       // If we are at the last pattern
  34.             led_counter = 0;              // then wrap around.
  35.         }
  36.     }
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement