#include "AllHeader.h" #include "OLED.h" #include "DS1302.h" int main() { SystemInit(); uint8_t initTime[8] = {0x20, 0x24, 0x05, 0x20, 0x23, 0x20, 0x00, 0x01}; DS1302TimeStruct getTime; DS1302Class.Init(); // Initialize DS1302Class.SetTime(initTime); // Set initial time u32 time_us = 0; u16 iseed; SystemInit(); NVIC_SetPriorityGrouping(NVIC_PriorityGroup_2); delay_init(); Adc_Init(); iseed = Get_Adc_Average(ADC_Channel_14, 3); // Get random seed srand(iseed); ws2812_Init(); OLED_Init(); OLED_ShowString(1, 11, "CLOCK HEBUT"); while (1) { // Fetch current time from DS1302 DS1302Class.GetTime(&getTime); // Clear the previous time displayed on the OLED OLED_Clear(); // Display the current time on the OLED OLED_ShowNum(2, 1, getTime.year, 4); // Year OLED_ShowNum(2, 6, getTime.month, 2); // Month OLED_ShowNum(2, 9, getTime.day, 2); // Day OLED_ShowNum(3, 1, getTime.hour, 2); // Hour OLED_ShowNum(3, 4, getTime.minute, 2); // Minute OLED_ShowNum(3, 7, getTime.second, 2); // Second // LED effects ws2812_AllOpen(255, 255, 0); // Turn on all LEDs delay_ms(500); ws2812_AllShutOff(); ws2812_All_LED_one_Color_breath(20, C_Red); // Breathing LED delay_ms(500); ws2812_AllShutOff(); horse_race_lamp(200); // Running light with random colors delay_ms(500); ws2812_AllShutOff(); Running_water_lamp(255, 255, 0, 200); // Waterfall light RGB delay_ms(500); ws2812_AllShutOff(); // Delay to avoid flickering and update time every second delay_ms(1000); } return 0; } 我要实现oled和灯光分别进行,互不干扰
理解问题#include "AllHeader.h" #include "OLED.h" #include "DS1302.h" int main() { SystemInit(); uint8_t initTime[8] = {0x20, 0x24, 0x05, 0x20, 0x23, 0x20, 0x00, 0x01}; DS1302TimeStruct getTime; DS1302Class.Init(); // Initialize DS1302Class.SetTime(initTime); // Set initial time u32 time_us = 0; u16 iseed; SystemInit(); NVIC_SetPriorityGrouping(NVIC_PriorityGroup_2); delay_init(); Adc_Init(); iseed = Get_Adc_Average(ADC_Channel_14, 3); // Get random seed srand(iseed); ws2812_Init(); OLED_Init(); OLED_ShowString(1, 11, "CLOCK HEBUT"); while (1) { // Fetch current time from DS1302 DS1302Class.GetTime(&getTime); // Clear the previous time displayed on the OLED OLED_Clear(); // Display the current time on the OLED OLED_ShowNum(2, 1, getTime.year, 4); // Year OLED_ShowNum(2, 6, getTime.month, 2); // Month OLED_ShowNum(2, 9, getTime.day, 2); // Day OLED_ShowNum(3, 1, getTime.hour, 2); // Hour OLED_ShowNum(3, 4, getTime.minute, 2); // Minute OLED_ShowNum(3, 7, getTime.second, 2); // Second // LED effects ws2812_AllOpen(255, 255, 0); // Turn on all LEDs delay_ms(500); ws2812_AllShutOff(); ws2812_All_LED_one_Color_breath(20, C_Red); // Breathing LED delay_ms(500); ws2812_AllShutOff(); horse_race_lamp(200); // Running light with random colors delay_ms(500); ws2812_AllShutOff(); Running_water_lamp(255, 255, 0, 200); // Waterfall light RGB delay_ms(500); ws2812_AllShutOff(); // Delay to avoid flickering and update time every second delay_ms(1000); } return 0; } 我要实现oled和灯光分别进行,互不干扰
已完成理解「#include "AllHeader.h" #include "OLED.h" #include "DS1302.h" int main() { SystemInit(); uint8_t initTime[8] = {0x20, 0x24, 0x05, 0x20, 0x23, 0x20, 0x00, 0x01}; DS1302TimeStruct getTime; DS1302Class.Init(); // Initialize DS1302Class.SetTime(initTime); // Set initial time u32 time_us = 0; u16 iseed; SystemInit(); NVIC_SetPriorityGrouping(NVIC_PriorityGroup_2); delay_init(); Adc_Init(); iseed = Get_Adc_Average(ADC_Channel_14, 3); // Get random seed srand(iseed); ws2812_Init(); OLED_Init(); OLED_ShowString(1, 11, "CLOCK HEBUT"); while (1) { // Fetch current time from DS1302 DS1302Class.GetTime(&getTime); // Clear the previous time displayed on the OLED OLED_Clear(); // Display the current time on the OLED OLED_ShowNum(2, 1, getTime.year, 4); // Year OLED_ShowNum(2, 6, getTime.month, 2); // Month OLED_ShowNum(2, 9, getTime.day, 2); // Day OLED_ShowNum(3, 1, getTime.hour, 2); // Hour OLED_ShowNum(3, 4, getTime.minute, 2); // Minute OLED_ShowNum(3, 7, getTime.second, 2); // Second // LED effects ws2812_AllOpen(255, 255, 0); // Turn on all LEDs delay_ms(500); ws2812_AllShutOff(); ws2812_All_LED_one_Color_breath(20, C_Red); // Breathing LED delay_ms(500); ws2812_AllShutOff(); horse_race_lamp(200); // Running light with random colors delay_ms(500); ws2812_AllShutOff(); Running_water_lamp(255, 255, 0, 200); // Waterfall light RGB delay_ms(500); ws2812_AllShutOff(); // Delay to avoid flickering and update time every second delay_ms(1000); } return 0; } 我要实现oled和灯光分别进行,互不干扰」
展开阅读网页