12345678910111213141516171819202122232425262728293031 |
- #include "FR_ValueBoard.h"
-
-
- FR_ValueBoard::FR_ValueBoard(byte pinS2,byte pinS1,byte pinS0,byte pinData)
- {
- _S2=pinS2; //MSB
- _S1=pinS1;
- _S0=pinS0; //LSB
- _data=pinData;
- init();
- }
-
- void FR_ValueBoard::init()
- {
- pinMode(_S2,OUTPUT);
- pinMode(_S1,OUTPUT);
- pinMode(_S0,OUTPUT);
- pinMode(_data,INPUT);
- }
-
- int FR_ValueBoard::readValue(byte num)
- {
- if(num>8)
- return -1;
- byte DMUXtrans[3]={_S0,_S1,_S2};
- for(int j=0;j<3;j++)
- digitalWrite(DMUXtrans[j],(transVRPin[num-1]>>j)%2);
- return (analogRead(_data));
- }
-
|