Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Byggern.c
- *
- * Created: 29.08.2019 15.20.29
- * Author : hanso
- */
- #include <avr/io.h>
- #include <stdint.h>
- #include <stdio.h>
- #include "header/initialize.h"
- #include <util/delay.h>
- int main(void)
- {
- system_initialize();
- while (1)
- {
- uint8_t left_slider = adc_read(LEFT_SLIDER_CHANNEL);
- uint8_t left_slider_percentage = percentage_from_8bit(left_slider);
- uint8_t left_button = (PINB & (1 << LEFT_BUTTON_PIN));
- uint8_t right_slider = adc_read(RIGHT_SLIDER_CHANNEL);
- uint8_t right_slider_percentage = percentage_from_8bit(right_slider);
- uint8_t right_button = (PINB & (1 << RIGHT_BUTTON_PIN));
- uint8_t joycon_vertical = adc_read(JOYCON_VERTICAL_CHANNEL);
- uint8_t joycon_vertical_percentage = percentage_from_8bit(joycon_vertical);
- char joycon_vertical_direction = joystick_direction(joycon_vertical,'y');
- uint8_t joycon_horizontal = adc_read(JOYCON_HORIZONTAL_CHANNEL);
- uint8_t joycon_horizontal_percentage = percentage_from_8bit(joycon_horizontal);
- char joycon_horizontal_direction = joystick_direction(joycon_horizontal,'x');
- printf("Left Slider: %d \t Right Slider: %d \t Joycon Vertical: %c \t Joycon Horizontal: %c\n\r", left_button, right_button, joycon_vertical_direction,joycon_horizontal_direction);
- _delay_ms(500);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement