Blink_allLeds esample for STM32F429 Discovery added
This commit is contained in:
parent
ba63674472
commit
c206a6623d
|
@ -14,6 +14,7 @@ const uint8_t Led[] = {GREENLED, ORANGELED, REDLED, BLUELED, REDLEDOTGOVERCURREN
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
for (int n = 0; n < NUMLEDS; n++) pinMode(Led[n], OUTPUT);
|
for (int n = 0; n < NUMLEDS; n++) pinMode(Led[n], OUTPUT);
|
||||||
|
//pinMode(REDLEDOTGOVERCURRENT,PULL_DOWN); // needed to protect STMPS2141 FAULT output from shortcutting PC5 on power fault
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLed(uint8_t n, uint8_t state)
|
void setLed(uint8_t n, uint8_t state)
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
// blink all LEDs
|
||||||
|
// STM32F429 Discovery
|
||||||
|
|
||||||
|
#define GREENLED PG13
|
||||||
|
|
||||||
|
#define REDLED PG14
|
||||||
|
#define OTGFSOC_LED PC5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NUMLEDS 3
|
||||||
|
const uint8_t Led[] = {GREENLED, REDLED, OTGFSOC_LED};
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
for (int n = 0; n < NUMLEDS; n++) pinMode(Led[n], OUTPUT);
|
||||||
|
//pinMode(OTGFSOC_LED,PULL_DOWN); // needed to protect STMPS2141 FAULT output from shortcutting PC5 on power fault
|
||||||
|
}
|
||||||
|
|
||||||
|
void setLed(uint8_t n, uint8_t state)
|
||||||
|
{
|
||||||
|
if(n==2)digitalWrite(Led[n], !state);
|
||||||
|
else digitalWrite(Led[n], state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
for (int n = 0; n < NUMLEDS; n++)
|
||||||
|
{
|
||||||
|
setLed(n, HIGH);
|
||||||
|
delay(500);
|
||||||
|
setLed(n, LOW);
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue