From e5cfee6a5730c9052d624eb0a6317d03c8c60f5b Mon Sep 17 00:00:00 2001 From: dk8g20 <dk8g20@soton.ac.uk> Date: Tue, 10 May 2022 23:54:09 +0100 Subject: [PATCH] added skeleton code --- 4_Bit_Binary_Counter SKELETON.c | 35 +++++++++++++++++++++++++++++++++ LED_Animation SKELETON.c | 25 +++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 4_Bit_Binary_Counter SKELETON.c create mode 100644 LED_Animation SKELETON.c diff --git a/4_Bit_Binary_Counter SKELETON.c b/4_Bit_Binary_Counter SKELETON.c new file mode 100644 index 0000000..8931a83 --- /dev/null +++ b/4_Bit_Binary_Counter SKELETON.c @@ -0,0 +1,35 @@ +#include "pico/stdlib.h" + + +const uint decrementButton = 21; +const uint incrementButton = 22; +const uint resetButton = 20; + +const uint bitLedOne= 5; +const uint bitLedTwo = 4; +const uint bitLedThree = 3; +const uint bitLedFour = 2; + + + + +int main() { + + //Initialise your IO + + int counter = 0; + + + + while (true) { + if((counter % 2) > 0) {gpio_put(bitLedOne,1);} else {gpio_put(bitLedOne,0);} + //Add for the other LED's + + if(gpio_get(incrementButton) == 0){} + //Make the buttons do something + + + + + } +} diff --git a/LED_Animation SKELETON.c b/LED_Animation SKELETON.c new file mode 100644 index 0000000..2e88d09 --- /dev/null +++ b/LED_Animation SKELETON.c @@ -0,0 +1,25 @@ +#include "pico/stdlib.h" + +//Function definition +void animation(int length); + +int main() { + + //Define how fast you want your animation to play in MS + const int animationStep = 50; + + + //Initialise all LEDS - Use a for loop + + + //Loop animation + while (true) { + animation1(animationStep); + } +} + + + +void animation1(int length) { + //Add your custom animation +} \ No newline at end of file -- GitLab