Doing research for first PCB design with RP2040 microcontroller. I have found a minimal design that I will use as a reference. I have also found a datasheet for the RP2040 microcontroller.
This commit is contained in:
@ -4,12 +4,17 @@
|
||||
#define GREEN 33
|
||||
#define BLUE 32
|
||||
|
||||
// Relay pin
|
||||
#define RELAY 26
|
||||
|
||||
bool isOn = false;
|
||||
|
||||
void setup() {
|
||||
// Set the pins as outputs
|
||||
pinMode(RED, OUTPUT);
|
||||
pinMode(GREEN, OUTPUT);
|
||||
pinMode(BLUE, OUTPUT);
|
||||
pinMode(RELAY, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
@ -31,23 +36,23 @@ void setColor(int red, int green, int blue) {
|
||||
return;
|
||||
}
|
||||
|
||||
void stop() {
|
||||
// Function which turns off the pins
|
||||
analogWrite(RED, 0);
|
||||
analogWrite(GREEN, 0);
|
||||
analogWrite(BLUE, 0);
|
||||
|
||||
Serial.println("Turning off the LED strip");
|
||||
printValues();
|
||||
return;
|
||||
// Function that toggles the RELAY
|
||||
void toggle() {
|
||||
if (isOn) {
|
||||
digitalWrite(RELAY, LOW);
|
||||
isOn = false;
|
||||
} else {
|
||||
digitalWrite(RELAY, HIGH);
|
||||
isOn = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void loop() {
|
||||
// Alternate between off and white over 5 seconds
|
||||
stop();
|
||||
toggle();
|
||||
delay(5000);
|
||||
setColor(255, 255, 255);
|
||||
delay(5000);
|
||||
|
Reference in New Issue
Block a user