Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user

I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

#include <SPI.h>

int value1 = 0x8026;
 
int value2 = 0x0801;

 
int value3 = 0x8027;
 
int value4 = 0x0000;

void setup (void)
 
{
 
  Serial.begin (9600);
 
  Serial.println ("Starting");

 
  digitalWrite(SS, HIGH);  // ensure SS stays high for now
 

  // Put SCK, MOSI, SS pins into output mode
 
  // also put SCK, MOSI into LOW state, and SS into HIGH state.
 
  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();
 

  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV4);

}  // end of setup

void loop (void)
{
  // enable Slave Select
 
  digitalWrite(SS, LOW); 
   
  SPI.transfer (1);   // initiate transmission

 
    SPI.transfer (value1);
    SPI.transfer (value2);
    SPI.transfer (value3);
    SPI.transfer (value4);

  // disable Slave Select
 
  digitalWrite(SS, HIGH);
 

Delaydelay (1000); 
}

I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

#include <SPI.h>

int value1 = 0x8026;
 
int value2 = 0x0801;

 
int value3 = 0x8027;
 
int value4 = 0x0000;

void setup (void)
 
{
 
  Serial.begin (9600);
 
  Serial.println ("Starting");

 
  digitalWrite(SS, HIGH);  // ensure SS stays high for now
 

  // Put SCK, MOSI, SS pins into output mode
 
  // also put SCK, MOSI into LOW state, and SS into HIGH state.
 
  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();
 

  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV4);

}  // end of setup

void loop (void)
{
  // enable Slave Select
 
  digitalWrite(SS, LOW); 
   
  SPI.transfer (1);   // initiate transmission

 
    SPI.transfer (value1);
    SPI.transfer (value2);
    SPI.transfer (value3);
    SPI.transfer (value4);

  // disable Slave Select
 
  digitalWrite(SS, HIGH);
 

Delay (1000); 
}

I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

#include <SPI.h>

int value1 = 0x8026;
int value2 = 0x0801;
int value3 = 0x8027;
int value4 = 0x0000;

void setup (void)
{
  Serial.begin (9600);
  Serial.println ("Starting");
  digitalWrite(SS, HIGH);  // ensure SS stays high for now

  // Put SCK, MOSI, SS pins into output mode
  // also put SCK, MOSI into LOW state, and SS into HIGH state.
  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();

  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV4);

}  // end of setup

void loop (void)
{
  // enable Slave Select
  digitalWrite(SS, LOW); 
   
  SPI.transfer (1);   // initiate transmission
  SPI.transfer (value1);
  SPI.transfer (value2);
  SPI.transfer (value3);
  SPI.transfer (value4);

  // disable Slave Select
  digitalWrite(SS, HIGH);

delay (1000); 
}
added 179 characters in body
Source Link
Majenko
  • 105.9k
  • 5
  • 82
  • 139

I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

*** There are carats around SPI.h!!! New at this...

#include SPI.h

int value1 = 0x8026;

int value2 = 0x0801;

int value3 = 0x8027;

int value4 = 0x0000;

void setup (void)

{

Serial.begin (9600);

Serial.println ("Starting");

digitalWrite(SS, HIGH); // ensure SS stays high for now

// Put SCK, MOSI, SS pins into output mode

// also put SCK, MOSI into LOW state, and SS into HIGH state.

// Then put SPI hardware into Master mode and turn SPI on SPI.begin ();

// Slow down the master a bit SPI.setClockDivider(SPI_CLOCK_DIV4);

} // end of setup

void loop (void) { // enable Slave Select

digitalWrite(SS, LOW);

SPI.transfer (1); // initiate transmission

#include <SPI.h>

int value1 = 0x8026;

int value2 = 0x0801;


int value3 = 0x8027;

int value4 = 0x0000;

void setup (void)

{

  Serial.begin (9600);

  Serial.println ("Starting");


  digitalWrite(SS, HIGH);  // ensure SS stays high for now


  // Put SCK, MOSI, SS pins into output mode

  // also put SCK, MOSI into LOW state, and SS into HIGH state.

  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();


  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV4);

}  // end of setup

void loop (void)
{
  // enable Slave Select

  digitalWrite(SS, LOW); 
   
  SPI.transfer (1);   // initiate transmission


    SPI.transfer (value1);
    SPI.transfer (value2);
    SPI.transfer (value3);
    SPI.transfer (value4);

  // disable Slave Select

  digitalWrite(SS, HIGH);


Delay (1000); 
}

// disable Slave Select

digitalWrite(SS, HIGH);

Delay (1000); }

I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

*** There are carats around SPI.h!!! New at this...

#include SPI.h

int value1 = 0x8026;

int value2 = 0x0801;

int value3 = 0x8027;

int value4 = 0x0000;

void setup (void)

{

Serial.begin (9600);

Serial.println ("Starting");

digitalWrite(SS, HIGH); // ensure SS stays high for now

// Put SCK, MOSI, SS pins into output mode

// also put SCK, MOSI into LOW state, and SS into HIGH state.

// Then put SPI hardware into Master mode and turn SPI on SPI.begin ();

// Slow down the master a bit SPI.setClockDivider(SPI_CLOCK_DIV4);

} // end of setup

void loop (void) { // enable Slave Select

digitalWrite(SS, LOW);

SPI.transfer (1); // initiate transmission

SPI.transfer (value1);
SPI.transfer (value2);
SPI.transfer (value3);
SPI.transfer (value4);

// disable Slave Select

digitalWrite(SS, HIGH);

Delay (1000); }

I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

#include <SPI.h>

int value1 = 0x8026;

int value2 = 0x0801;


int value3 = 0x8027;

int value4 = 0x0000;

void setup (void)

{

  Serial.begin (9600);

  Serial.println ("Starting");


  digitalWrite(SS, HIGH);  // ensure SS stays high for now


  // Put SCK, MOSI, SS pins into output mode

  // also put SCK, MOSI into LOW state, and SS into HIGH state.

  // Then put SPI hardware into Master mode and turn SPI on
  SPI.begin ();


  // Slow down the master a bit
  SPI.setClockDivider(SPI_CLOCK_DIV4);

}  // end of setup

void loop (void)
{
  // enable Slave Select

  digitalWrite(SS, LOW); 
   
  SPI.transfer (1);   // initiate transmission


    SPI.transfer (value1);
    SPI.transfer (value2);
    SPI.transfer (value3);
    SPI.transfer (value4);

  // disable Slave Select

  digitalWrite(SS, HIGH);


Delay (1000); 
}
Source Link

Sending command through SPI on Arduino UNO

I am assuming the default pin configuration is pin 10(SS), 11(MOSI), 12(MISO), 13(CLK) from a default setup, SPI.begin(). The code compiles OK. Not sure about the int valuex and using the SPI.transfer() function.

*** There are carats around SPI.h!!! New at this...

#include SPI.h

int value1 = 0x8026;

int value2 = 0x0801;

int value3 = 0x8027;

int value4 = 0x0000;

void setup (void)

{

Serial.begin (9600);

Serial.println ("Starting");

digitalWrite(SS, HIGH); // ensure SS stays high for now

// Put SCK, MOSI, SS pins into output mode

// also put SCK, MOSI into LOW state, and SS into HIGH state.

// Then put SPI hardware into Master mode and turn SPI on SPI.begin ();

// Slow down the master a bit SPI.setClockDivider(SPI_CLOCK_DIV4);

} // end of setup

void loop (void) { // enable Slave Select

digitalWrite(SS, LOW);

SPI.transfer (1); // initiate transmission

SPI.transfer (value1);
SPI.transfer (value2);
SPI.transfer (value3);
SPI.transfer (value4);

// disable Slave Select

digitalWrite(SS, HIGH);

Delay (1000); }