Hello,
I'm experimenting with the MC23016 pin expander and noticed something weird,
I made a sketch that turns a set of lets on 1 after the other, till they all burn.
Now what i notice is that, before any lets are on there is a faint glow coming from the leds?
any reason why this is?
Also when i connect a external power supply to the arduino (so it's not power by USB but via a battery) all goes well till all leds burn, and then go pulse at a rate of about once a second.
here is my sketch:
#include <IOexpander.h>
#include <Wire.h>;
#include <inttypes.h>;
IOexpander IOexp;
int controleled = 13;
void setup(){
//for debuggin purposes i start a serial.
Serial.begin(9600);
//initiaze contact with expander. and see if it's workin.
if(IOexp.init(0x20, MCP23016))
Serial.println("Communication with IOexpander works!");
else
Serial.println("No communication with the IOexpander!!");
//set controleled as output.
pinMode(controleled, OUTPUT);
//setting array 0 pins on expander to output.
IOexp.pinModePort(0, OUTPUT);
//and second array (array 1) to input possibly to experiment.
IOexp.pinModePort(1, INPUT);
//looking if als is good :)
digitalWrite(controleled, HIGH);
}
void loop(){
int state = HIGH;
int state1 = LOW;
//for the sake of testing im gonna swith every led
//on one at a time.
IOexp.digitalWritePort(0, state1);
delay(500);
IOexp.digitalWrite(0,0, state);
delay(500);
IOexp.digitalWrite(0,1, state);
delay(500);
IOexp.digitalWrite(0,2, state);
delay(500);
IOexp.digitalWrite(0,3, state);
delay(500);
IOexp.digitalWrite(0,4, state);
delay(500);
IOexp.digitalWrite(0,5, state);
delay(500);
IOexp.digitalWrite(0,6, state);
delay(500);
IOexp.digitalWrite(0,7, state);
delay(500);
Serial.println("it was a succes!");
}
I do not think that there is anything wrong with my sketch, but just to be sure.
I rather think that it is a Hardware problem ![]()
Anny Ideas that would be great ![]()