Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // For the Robotics.org.za ESP32-C3 Mini-1 development board // By Pieter from Innovation Instruments //
- #include <stdio.h>
- #define Red_LED 3 // rgb led pins, active low
- #define Green_LED 4
- #define Blue_LED 5
- #define LED 21 // onboard blue led
- unsigned int Loop_Count = 0;
- //
- // Setup
- //
- void setup() // put your setup code here, to run once:
- {
- pinMode(LED,OUTPUT);
- pinMode(Red_LED,OUTPUT);
- pinMode(Green_LED,OUTPUT);
- pinMode(Blue_LED,OUTPUT);
- digitalWrite(Red_LED,HIGH);
- digitalWrite(Green_LED,HIGH);
- digitalWrite(Blue_LED,HIGH);
- }
- //
- // main loop
- //
- void loop() // put your main code here, to run repeatedly:
- {
- digitalWrite(LED,HIGH);
- delay(200);
- digitalWrite(LED,LOW);
- delay(200);
- Loop_Count++;
- if (Loop_Count == 3)
- {
- digitalWrite(Red_LED,LOW); // on
- digitalWrite(Green_LED,HIGH);
- digitalWrite(Blue_LED,HIGH);
- }
- else if (Loop_Count == 6)
- {
- digitalWrite(Red_LED,HIGH);
- digitalWrite(Green_LED,LOW); // on
- digitalWrite(Blue_LED,HIGH);
- }
- else if (Loop_Count == 9)
- {
- digitalWrite(Red_LED,HIGH);
- digitalWrite(Green_LED,HIGH);
- digitalWrite(Blue_LED,LOW); // on
- Loop_Count = 0;
- }
- else // all off
- {
- digitalWrite(Red_LED,HIGH);
- digitalWrite(Green_LED,HIGH);
- digitalWrite(Blue_LED,HIGH);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement