Advertisement
Guest User

Untitled

a guest
Apr 21st, 2010
1,932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. /*This uses a function to grab a value from a 16 pin Analog Multiplexer
  2. http://www.sparkfun.com/commerce/product_info.php?products_id=9056
  3. to retrieve a value from one of the registers.
  4. To use: analogExtRead(analogpin, multiplexerpin);
  5. This can be expanded to use diffrent digital pins as well.
  6. */
  7.  
  8. int digipin[] = {2, 3, 4, 5};
  9.  
  10. int analogExtRead(int analogpin, int multiplexerpin)
  11. {
  12. for(int i = 0; i < 3; i++)
  13. {
  14. digitalWrite(digipin[i], bitRead(multiplexerpin, i));
  15. }
  16. return analogRead(analogpin);
  17. }
  18.  
  19. void loop() {}
  20. void setup() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement