arduino:gammon-spi-controller
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
arduino:gammon-spi-controller [2023/07/24 17:45] – mithat | arduino:gammon-spi-controller [2023/07/24 18:43] (current) – mithat | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | From [[http:// | + | From [[http:// |
<file cpp gammon-spi-controller.ino> | <file cpp gammon-spi-controller.ino> | ||
Line 10: | Line 10: | ||
void setup (void) | void setup (void) | ||
{ | { | ||
+ | |||
digitalWrite(SS, | digitalWrite(SS, | ||
Line 18: | Line 19: | ||
// Slow down the master a bit | // Slow down the master a bit | ||
- | | + | // SPI.setClockDivider(SPI_CLOCK_DIV8); |
| | ||
} // end of setup | } // end of setup | ||
Line 25: | Line 26: | ||
void loop (void) | void loop (void) | ||
{ | { | ||
+ | |||
char c; | char c; | ||
+ | |||
+ | SPI.beginTransaction(SPISettings(400000, | ||
// enable Slave Select | // enable Slave Select | ||
Line 31: | Line 35: | ||
// send test string | // send test string | ||
- | for (const char * p = " | + | for (const char * p = " |
{ | { | ||
SPI.transfer (c); | SPI.transfer (c); | ||
- | delayMicroseconds(5); | + | delayMicroseconds(5); |
} | } | ||
// disable Slave Select | // disable Slave Select | ||
digitalWrite(SS, | digitalWrite(SS, | ||
+ | SPI.endTransaction(); | ||
delay (1000); | delay (1000); | ||
} // end of loop | } // end of loop | ||
</ | </ |
arduino/gammon-spi-controller.1690220729.txt.gz · Last modified: 2023/07/24 17:45 by mithat