SHARE
TWEET

Untitled

a guest Oct 20th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. long Codeuse::getCounter() const
  2. {
  3.     byte inbyte = 0;
  4.     long cntr = 0;
  5.  
  6.     uint8_t loadOtr = 0xE8;
  7.     digitalWrite(pin, LOW);
  8.     SPI.transfer(loadOtr);
  9.     digitalWrite(pin, HIGH);
  10.  
  11.     uint8_t order = 0x68; // order = READ:01 + OTR:101 + Don't care:000
  12.     uint8_t numberOfbyte = 4;
  13.  
  14.     digitalWrite(pin, LOW);
  15.     SPI.transfer(order);
  16.     for (int i = 0; i < numberOfbyte; i++)
  17.     {
  18.         inbyte = SPI.transfer(0x00);
  19.         cntr = cntr << 8;
  20.         cntr = cntr | inbyte;
  21.     }
  22.     digitalWrite(pin, HIGH);
  23.  
  24.     return cntr;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top