generated from LailaTheElf/rp2040_c
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			715 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			715 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <stdio.h>
 | |
| #include "pico/stdlib.h"
 | |
| 
 | |
| // pin rgb led on Seeed XIAO RP2040
 | |
| #define PIN_RGB_R 17
 | |
| #define PIN_RGB_G 16
 | |
| #define PIN_RGB_B 25
 | |
| 
 | |
| int main() {
 | |
|   setup_default_uart();
 | |
|   printf("Hello, world!\n");
 | |
| 
 | |
|   gpio_init(PIN_RGB_R);
 | |
|   gpio_set_dir(PIN_RGB_R, GPIO_OUT);
 | |
|   gpio_init(PIN_RGB_G);
 | |
|   gpio_set_dir(PIN_RGB_G, GPIO_OUT);
 | |
|   gpio_init(PIN_RGB_B);
 | |
|   gpio_set_dir(PIN_RGB_B, GPIO_OUT);
 | |
|   while (true)
 | |
|   {
 | |
|     gpio_put(PIN_RGB_G, 1);
 | |
|     sleep_ms(250);
 | |
|     gpio_put(PIN_RGB_R, 0);
 | |
|     sleep_ms(250);
 | |
|     gpio_put(PIN_RGB_B, 1);
 | |
|     sleep_ms(250);
 | |
|     gpio_put(PIN_RGB_G, 0);
 | |
|     sleep_ms(250);
 | |
|     gpio_put(PIN_RGB_R, 1);
 | |
|     sleep_ms(250);
 | |
|     gpio_put(PIN_RGB_B, 0);
 | |
|     sleep_ms(250);
 | |
|   }
 | |
|   return 0;
 | |
| }
 | |
| 
 |