ajfisher / arduino-analog-multiplexer Goto Github PK
View Code? Open in Web Editor NEWLibrary for Arduino in order to use Analog Multiplexer / DeMultiplexers easily
License: BSD 3-Clause "New" or "Revised" License
Library for Arduino in order to use Analog Multiplexer / DeMultiplexers easily
License: BSD 3-Clause "New" or "Revised" License
Hello,
I'm using your Lib on ESP8266 which is working well. Thanks.
I also use this (http://shiftregister.simsso.de/) library to use a shift register for expanting output pins.
Since I need to free up more pins on the ESP I would like to somehow control the select pins not directly but by the shift register but I got no Idea how since I didn't write code for quite some years.
Therefore could you tell me if/how I could use your code to call the shift register instead setting the pins directly?
Thanks for your help!
I get an error during compiling event with blank code like:
#include <analogmuxdemux.h>
void setup() {
}
void loop() {
}
/home/dmtrs/sketchbook/libraries/analogmuxdemux/analogmuxdemux.cpp: In constructor 'AnalogDeMux::AnalogDeMux(uint8_t)':
/home/dmtrs/sketchbook/libraries/analogmuxdemux/analogmuxdemux.cpp:107:68: error: cannot call constructor 'AnalogDeMux::AnalogDeMux' directly [-fpermissive]
AnalogDeMux::AnalogDeMux(AMDM_MS0, AMDM_MS1, AMDM_MS2, writepin);
^
/home/dmtrs/sketchbook/libraries/analogmuxdemux/analogmuxdemux.cpp:107:68: note: for a function-style cast, remove the redundant '::AnalogDeMux'
Needs to have the ability to switch between mux and demux programmatically using the 4051 chip's ability to use input / output select
At the moment if you select a pin that is too high for the 4051's 3 bit resolution (>7) then it will just ignore the higher bits and you'll be left what whatever the 3 least significant bits are left over.
The fix will be to somehow fix the number of pins required (probably in the constructor) and from there it would then check for conditions higher than that value.
The question is what should it set it to or should it error and output to debug log or similar?
My question is regarding your library/ code for the 4051 IC...I have it all hooked up correctly and it is returning the pin numbers correctly through the serial monitor. But all of the Values are linked to my first readout (y0)...
I did adjust the number of sensors from 3 to 8 to fully use the chip, also changing the could it be something with that change? I have the code example below.
// how many input pins are you going to use on the Muxer, this example uses three
// set up the Muxer ready to be used. Watch the order of S0, S1 and S2.
AnalogMux amux(2,3,4, READPIN);
void setup() {
Serial.begin(9600);
Serial.println("Starting 4051 analog reader...");
delay(1000);
}
void loop() {
// go through each pin on the muxer in turn and just print out it's position
// and it's reading then delay a bit and do the next one.
for (int pinno=0; pinno < NO_PINS; pinno++){
amux.SelectPin(pinno); // choose the pin you want to send signal to off the DeMux
uint16_t reading = amux.AnalogRead(0);
Serial.print("Pin: ");
Serial.print(pinno);
Serial.print(" Value: ");
Serial.print(reading);
Serial.print(" ");
}
Serial.println("-----");
delay(5000);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.