Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

c-base-Plasmaleitung / Space-Shlong

View gist:9c8bdeff7f2fc999398e
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
/**
* Plasma-Leitungs-Code für die c-base
*/
 
// most launchpads have a red LED
#define LED1 P1_7
#define LED2 P1_6
#define LED3 P2_5
#define LED4 P2_4
#define LED5 P2_3
 
#define LA1 P1_5
#define LA2 P2_0
#define LA3 P2_1
#define LA4 P2_2
#define DELAY 90
 
int i = 0;
 
//see pins_energia.h for more LED definitions
//#define LED GREEN_LED
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
pinMode(LA1, OUTPUT);
pinMode(LA2, OUTPUT);
pinMode(LA3, OUTPUT);
pinMode(LA4, OUTPUT);
pinMode(P1_0, OUTPUT);
}
 
// the loop routine runs over and over again forever:
void loop() {
int foo = 1<<(i % 4);
digitalWrite(P1_0, foo & 1 ? HIGH : LOW);
digitalWrite(LA1, foo & 1 ? HIGH : LOW);
digitalWrite(LA2, foo & 2 ? HIGH : LOW);
digitalWrite(LA3, foo & 4 ? HIGH : LOW);
digitalWrite(LA4, foo & 8 ? HIGH : LOW);
 
foo = 1<<(i % 5);
digitalWrite(LED1, foo & 1 ? HIGH : LOW);
digitalWrite(LED2, foo & 2 ? HIGH : LOW);
digitalWrite(LED3, foo & 4 ? HIGH : LOW);
digitalWrite(LED4, foo & 8 ? HIGH : LOW);
digitalWrite(LED5, foo & 16 ? HIGH : LOW);
delay(DELAY);
i++;
// handle integer overflow
if (i >= 20) {
i = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.