Created
December 29, 2019 20:15
-
-
Save racerxdl/77f080080891a60d52608c2960ca4101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#define SCK D5 | |
#define MISO D6 | |
#define CS D8 | |
#define MOSI D7 | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("OK"); | |
pinMode(SCK, OUTPUT); | |
pinMode(CS, OUTPUT); | |
pinMode(MOSI, OUTPUT); | |
pinMode(MISO, INPUT); | |
digitalWrite(CS, HIGH); | |
SPI.pins(SCK, MISO, MOSI, CS); | |
SPI.begin(); | |
} | |
void loop() { | |
digitalWrite(CS, LOW); | |
uint8_t data = SPI.transfer(0xFF); // Always transfer full 1 bits | |
digitalWrite(CS, HIGH); | |
Serial.println(data, BIN); | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment