Code for MCP4822 - Arduino Due

#include <SPI.h>

const int slaveAPin = 4;

static byte val = 0;

byte lowByte = 0;

byte highByte = 0;

SPISettings settingsA(2000000, MSBFIRST, SPI_MODE0);

static byte serial_pot[NUM_OF_POTS] = { 0 };

byte osc_sawS( byte freq){
  static byte output = 0;
  return output += freq;
}

void setup() {
 Serial.begin(9600);
  delay(100);
  pinMode (slaveAPin, OUTPUT);
  SPI.begin();
}
void loop(){ 
  val = osc_sawS( 10  ) ;
  lowByte = val;
  highByte = 16 | 0 << 7 | 2 << 5 | 1 << 4;
  SPI.beginTransaction(settingsA);
  digitalWrite (slaveAPin, LOW);
  SPI.transfer(highByte);
  SPI.transfer(lowByte);
  digitalWrite (slaveAPin, HIGH);
  SPI.endTransaction();
  
}

ummm ... we can use SPI on Due already, so I must ask ... what is the purpose of this post?

Does it bother you?

not much :slight_smile:
just curious

Does it bother you a bit?