Coding Question: Making a ShiftIn


hey folks.

how go coding a"shiftin" function? have "clock in" , "data in", , want print results serial port.

thanks in advance!  ;d

well, didn't around heres 1 wrote project of mine.

int shiftin() {
 int cwt;
 cwt=0;
 bitmask=128;
 while (bitmask >= 1) {
   digitalwrite(shtclk, high);
   cwt = cwt + bitmask * digitalread(shtdata);
   digitalwrite(shtclk, low);
   bitmask=bitmask/2;
 }
 return(cwt);
}

that msb first, other end changes data on rising edge of clock.


Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Coding Question: Making a ShiftIn


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums