Hi folks I have made following example.
With arduino Uno with a multiplexor that is working flawless
I am using following code
const int muxSIG = A0;
const int muxS0 = 8;
const int muxS1 = 9;
const int muxS2 = 10;
const int muxS3 = 11;
int SetMuxChannel(byte channel)
{
digitalWrite(muxS0, bitRead(channel, 0));
digitalWrite(muxS1, bitRead(channel, 1));
digitalWrite(muxS2, bitRead(channel, 2));
digitalWrite(muxS3, bitRead(channel, 3));
}
void setup()
{
pinMode(muxSIG, OUTPUT);
pinMode(muxS0, OUTPUT);
pinMode(muxS1, OUTPUT);
pinMode(muxS2, OUTPUT);
pinMode(muxS3, OUTPUT);
Serial.begin(9600);
delay(1000);
}
void loop()
{
for (byte i = 0; i < 16; i++)
{
Serial.println(i);
SetMuxChannel(i);
digitalWrite(muxSIG, HIGH);
delay(200);
digitalWrite(muxSIG, LOW);
delay(200);
}
}
The code loops every analog signal on the multiplexor and afterwards each light will blink.
¨
I want to have the same solution but instead with
wemos d1 r32
link to card below:
also I got following multiplexor
below is how I connected everything on the wemos d1 r32 card.
Here is the code
const int muxSIG = A0;
const int muxS0 = 8;
const int muxS1 = 9;
const int muxS2 = 10;
const int muxS3 = 11;
int SetMuxChannel(byte channel)
{
digitalWrite(muxS0, bitRead(channel, 0));
digitalWrite(muxS1, bitRead(channel, 1));
digitalWrite(muxS2, bitRead(channel, 2));
digitalWrite(muxS3, bitRead(channel, 3));
}
void setup()
{
pinMode(muxSIG, OUTPUT);
pinMode(muxS0, OUTPUT);
pinMode(muxS1, OUTPUT);
pinMode(muxS2, OUTPUT);
pinMode(muxS3, OUTPUT);
Serial.begin(9600);
delay(1000);
}
void loop()
{
for (byte i = 0; i < 16; i++)
{
Serial.println(i);
SetMuxChannel(i);
digitalWrite(muxSIG, HIGH);
delay(200);
digitalWrite(muxSIG, LOW);
delay(200);
}
}
I am not sure of which pins I should rewrite the code I was looking on the pin layout for Wemos d1 R32 but still little confused of what is the right way of do this
Following images below might be helpful
according to below image my connection are wrong but I am not sure
Please help me out how to do this
Thank you in advance