I use the SparkFun ATX Power Shield to control the 6 PWM LED channels.
SparkFun Power Driver Shield Kit
Code snippet for controlling the ATX shield
/*
ATX shield with ATX control
claude felizardo 2018-08-06
https://www.sparkfun.com/products/10618
Uses modified ATX shield to use pin 2 to control PS_ON control pin on ATX connector.
*/
#ifndef _atx_shield_h_
#define _atx_shield_h_
#define ATX_SHIELD_VERSION "$Id$"
class ATX_Shield
{
int atx_ctl_pin = 0; // output for controlling ATX power supply
int atx_enabled = 0; // current state
public:
ATX_Shield(int output_pin)
{
atx_ctl_pin = output_pin;
}
void output_power()
{
Serial.print("atx_enabled = "); Serial.println(atx_enabled, DEC);
digitalWrite(atx_ctl_pin, atx_enabled == 0 ? HIGH : LOW);
} // output_power
// this should be called once
void setup()
{
pinMode(atx_ctl_pin, OUTPUT);
atx_enabled = 0;
output_power();
}
int isEnabled()
{
return atx_enabled;
}
void powerOn()
{
if (!atx_enabled) {
atx_enabled = 1;
output_power();
}
}
void powerOff()
{
if (atx_enabled) {
atx_enabled = 0;
output_power();
}
}
}; // class ATX_Shield
#endif // _atx_shield_h_
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.