Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <SPI.h>
  2.  
  3. int rx = 0;
  4.  
  5. // The setup() function runs after reset.
  6. void setup() {
  7.   // Initialize serial for DEBUG.
  8.   Serial.begin(9600);
  9.  
  10.   SPI.begin();
  11. }
  12. // The loop() function runs continuously after setup().
  13. void loop() {
  14.    digitalWrite(SS, LOW);
  15.    delay(20);
  16.    // Send check
  17.    SPI.transfer("check");
  18.  
  19.    // Wait for slave.
  20.    delay(20);
  21.    // Get slave response.
  22.   rx = SPI.transfer(0);
  23.   Serial.println (rx);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement