Skip to content

Instantly share code, notes, and snippets.

@michaelsarduino
Created July 10, 2015 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelsarduino/477f9d2d8707c22de9db to your computer and use it in GitHub Desktop.
Save michaelsarduino/477f9d2d8707c22de9db to your computer and use it in GitHub Desktop.
Arduino Sketch, um Text über eine SPI Verbindung zu senden, für SPI Master
#include <SPI.h>
void setup (void)
{
digitalWrite(SS, HIGH); //SS Pin auf HIGH setzten
SPI.begin (); //Verbindung starten
SPI.setClockDivider(SPI_CLOCK_DIV8); //Geschwindigkeit verlangsamen
}
void loop (void)
{
char c;
digitalWrite(SS, LOW); //starten der Kommunikation mit Slave
for (const char * p = "Hallo, Welt!\n" ; c = *p; p++)
{
SPI.transfer (c); //senden von Text
}
digitalWrite(SS, HIGH); //beenden der Kommunikation
delay (1000); //kurze pause
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment