From e811d778ea51ac1e25588a9cc957fca4f532ea5a Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Fri, 27 Oct 2023 07:10:26 -0500 Subject: init --- main.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 0000000..44bbb2d --- /dev/null +++ b/main.c @@ -0,0 +1,90 @@ +#include +#include +#include +#include + +#include "pins.h" +#include "menu.h" +#include "software_pwm.h" +#include "analog_read.h" + +/** light projector controller. How it'll work: + * Potentiometer with a voltage dividor to send 0-5v into analog input. + * Button [mode] to change modes. + * Button [select] to select values within mode. + * + * [modes] (press mode button to switch, select button to select children options to ajust with potentiometer): + * RGB shift + * rgb hue speed + * + * Just white + * + * Control RGBW + * R + * G + * B + * W + * + * Chagne motor speed + * motor speed + * + * OFF + * + * + **/ + + + + +void test_adc() { + DDRA = 0xff; + for(;;) { + + int shift_amount = (8 * ((float)analog_read_8bit() / UINT8_MAX)); + + if(shift_amount < 0) { + PORTA = 0; + continue; + } + else if(shift_amount >= 8) { + PORTA = 0xff; + continue; + } + + PORTA = (1 << shift_amount); + } +} + +void test_softpwm() { + /** + softpwm_set(0, 0); + softpwm_set(1, 31); + softpwm_set(2, 31 * 2); + softpwm_set(3, 31 * 3); + softpwm_set(4, 31 * 4); + softpwm_set(5, 31 * 5); + softpwm_set(6, 31 * 6); + softpwm_set(7, 255); + **/ + for(;;); +} + +int main() { + //init_adc(); + //test_adc(); + init_softpwm(); + test_softpwm(); + + int mode = 0; + //int submode = 0; + switch(mode) { + case RAINBOW: + break; + case WHITE: + break; + case RGBW_MANUAL: + break; + case MOTOR_SPEED: + break; + } +} -- cgit v1.2.3