diff --git a/AlternatingLights/AlternatingLights.ino b/AlternatingLights/AlternatingLights.ino new file mode 100644 index 0000000..37f193c --- /dev/null +++ b/AlternatingLights/AlternatingLights.ino @@ -0,0 +1,24 @@ +/* + *@author James McKenzie + *@lang C89 Based + *@contact lunarised@outlook.com + */ +void setup() { + pinMode(10, OUTPUT); + pinMode(11, OUTPUT); + pinMode(12, OUTPUT); + pinMode(13, OUTPUT); +} + +void loop() { +digitalWrite(10, LOW); +digitalWrite(11, HIGH); +digitalWrite(12, LOW); +digitalWrite(13, HIGH); +delay(100); +digitalWrite(10, HIGH); +digitalWrite(11, LOW); +digitalWrite(12, HIGH); +digitalWrite(13, LOW); +delay(100); +} diff --git a/BlinkingLight/blinkingLight.ino b/BlinkingLight/blinkingLight.ino new file mode 100644 index 0000000..c71e12c --- /dev/null +++ b/BlinkingLight/blinkingLight.ino @@ -0,0 +1,15 @@ +/* + *@author James McKenzie + *@lang C89 Based + *@contact lunarised@outlook.com + */ +void setup() { + pinMode(13, OUTPUT); +} + +void loop() { +digitalWrite(13, HIGH); +delay(100); +digitalWrite(13, LOW); +delay(100); +} diff --git a/IncrementOnlyAbacus/IncrementOnlyAbacus.ino b/IncrementOnlyAbacus/IncrementOnlyAbacus.ino new file mode 100644 index 0000000..168b1b8 --- /dev/null +++ b/IncrementOnlyAbacus/IncrementOnlyAbacus.ino @@ -0,0 +1,63 @@ +/* + *@author James McKenzie + *@lang C89 Based + *@contact lunarised@outlook.com + */ +int i; +void setup() { + pinMode(10, OUTPUT); + pinMode(11, OUTPUT); + pinMode(12, OUTPUT); + pinMode(13, OUTPUT); + i = 0; +} + +void loop() { +checkOverflow(i); +bitCheck(i); +i++; +delay(100); +} + +/* + * Takes an int and sets leds on and off accordingly + * @param i The current value to be displayed + */ +void bitCheck(int i){ + if (i & 1){ + digitalWrite(13, HIGH); + } + else{ + digitalWrite(13, LOW); + } + if (i & 2){ + digitalWrite(12, HIGH); + } + else{ + digitalWrite(12, LOW); + } + if (i & 4){ + digitalWrite(11, HIGH); + } + else{ + digitalWrite(11, LOW); + } + if (i & 8){ + digitalWrite(10, HIGH); + } + else{ + digitalWrite(10, LOW); + } +} +/* + * Checks to make sure the number displayed doesnt overflow + * @param i The number to check overflow + */ +void checkOverflow(int i){ + if (i == 16){ + i = 0; + } + if (i == -1){ + i = 15; + } +} diff --git a/ftypeTest/ftypeTest.ino b/ftypeTest/ftypeTest.ino deleted file mode 100644 index 95c2b6e..0000000 --- a/ftypeTest/ftypeTest.ino +++ /dev/null @@ -1,9 +0,0 @@ -void setup() { - // put your setup code here, to run once: - -} - -void loop() { - // put your main code here, to run repeatedly: - -}