I have 2 LEDs (pin6 & 9). The code instructs them to blink 2 times each.
after compiling, whiteLED blinks correct, greenLED blinks 1 time OK and thereafter very dim.
measuring the voltage thru the serial monitor returns numbers between 237 and 241 for both pins
I do not understand why the green pin gets dim, tried several pins, however no change.
Note; When sending this I was requested to format the message, however no clue what is expected ?
int wPin=6;
int gPin=8;
int dt=500;
int wVal;
int gVal;
int wBlink=2;
int gBlink=2;
int j;
void setup() {
// put your setup code here, to run once:
pinMode (wPin,OUTPUT);
pinMode (gPin,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
for(j=1;j<=wBlink;j=j+1){
digitalWrite(wPin,HIGH);
wVal=analogRead(wPin);
Serial.print ("wVal= ");
Serial.print(wVal);
Serial.print("-");
delay(dt);
digitalWrite(wPin,LOW);
delay(dt);
}
Serial.println("/");
for(j=1;j<=gBlink;j=j+1){
digitalWrite(gPin,HIGH);
gVal=analogRead(gPin);
Serial.print ("gVal= ");
Serial.print(gVal);
Serial.print("-");
delay(dt);
pinMode(gPin,LOW);
delay(dt);
}
Serial.println("/");