#include "SPI.h" #define CS_PIN 10 #define SPI_CLOCK 1000000 void setup() { Serial.begin(115200); //define LED_BUILTIN as an outpu Serial.println("2024-03-07 Aleksander Kaweczynski"); Serial.println("PD SPI TEST"); Serial.println("SCK - D13"); Serial.println("MISO - D12"); Serial.println("MOSI - D11"); Serial.println("CS - D10 (low during transfer)"); pinMode(CS_PIN, OUTPUT); digitalWrite(CS_PIN, HIGH); // pinMode(12, OUTPUT); SPI.begin(); } void loop() { SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0)); SPI.transfer(0xAA); SPI.transfer(0x55); delayMicroseconds(1); digitalWrite(CS_PIN, LOW); delayMicroseconds(1); digitalWrite(CS_PIN, HIGH); SPI.endTransaction(); Serial.println("DATA: 0xAA 0x55"); delay(1000); SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0)); SPI.transfer(0x00); SPI.transfer(0x00); delayMicroseconds(1); digitalWrite(CS_PIN, LOW); delayMicroseconds(1); digitalWrite(CS_PIN, HIGH); SPI.endTransaction(); Serial.println("DATA: 0x00 0x00"); delay(1000); }