Hi,
I am testing the 3 builtin LED in the board 5005-O with a simple library, but they aren´t responding the command digitalWrite.
Well first question is:
Are the right pins: RED-14, GREEN-15 and BLUE-16? I already read the Core documentation and the PIN number 14, 15 and 16 I toke from there.
Could you help me?
The files are:
Main.cpp
#include <Arduino.h>
#include <LEDsInit.h>
int RecPinR = 14, RecPinG = 15, RecPinB = 16;
void setup()
{
LEDsInterface LED(RecPinR, RecPinG, RecPinB);
LED.LEDsInit();
};
void loop()
{
};
LEDsInit.h
/*
* Lib name: LEDsInit.h
* purpose : create a clear vision in the code when all serial interface inialization routine is move to this lib
* author : Claudio Rosa
* contact : https://www.linkedin.com/in/claudio-rosa-aa71a418
* date : 30/01/2021
*/
#ifndef LED_ini
#define LED_ini
class LEDsInterface
{
private:
int pinR, pinG, pinB;
public:
LEDsInterface(int RecPinR, int RecPinG,int RecPinB);
int getPins();
void setPins(int RecPinR, int RecPinG,int RecPinB);
void LEDsInit();
};
#endif
LEDsInit.cpp
/*
* Lib name: LEDsInit.h
* purpose : create a clear vision in the code when all serial interface inialization routine is move to this lib
* author : Claudio Rosa
* contact : https://www.linkedin.com/in/claudio-rosa-aa71a418
* date : 30/01/2021
*/
#include <LEDsInit.h>
#include <Arduino.h>
LEDsInterface::LEDsInterface(int RecPinR, int RecPinG,int RecPinB)
{
setPins(RecPinR, RecPinG, RecPinB);
};
void LEDsInterface::setPins(int RecPinR, int RecPinG,int RecPinB)
{
pinR = RecPinR;
pinG = RecPinG;
pinB = RecPinB;
};
int LEDsInterface::getPins()
{
return pinR, pinG, pinB;
};
void LEDsInterface::LEDsInit()
{
getPins();
pinMode(pinR, OUTPUT);
pinMode(pinG, OUTPUT);
pinMode(pinB, OUTPUT);
int i = 1;
while (i <= 3)
{
digitalWrite(pinR, LOW);
Serial.println("LED RED PIN=" + String(pinR) + "=> OFF");
delay(1000);
digitalWrite(pinG, LOW);
Serial.println("LED GREEN PIN=" + String(pinG) + "=> OFF");
delay(1000);
digitalWrite(pinB, LOW);
Serial.println("LED BLUE PIN=" + String(pinB) + "=> OFF");
delay(1000);
digitalWrite(pinR, HIGH);
Serial.println("LED RED PIN=" + String(pinR) + "=> ON");
delay(1000);
digitalWrite(pinG, HIGH);
Serial.println("LED GREEN PIN=" + String(pinG) + "=> ON");
delay(1000);
digitalWrite(pinB, HIGH);
Serial.println("LED BLUE PIN=" + String(pinB) + "=> ON");
delay(1000);
++i;
};
Serial.println("======================================");
Serial.println("= LEDS RED, GREEN and BLUE initialized");
Serial.println("======================================");
};