Last change
on this file since 175 was 175, checked in by ertl-honda, 8 years ago |
ライブラリを Arduino IDE 1.7.9 にupdate
|
File size:
490 bytes
|
Rev | Line | |
---|
[175] | 1 | /* Connection
|
---|
| 2 | MASTER SLAVE
|
---|
| 3 | MISO -> MOSI
|
---|
| 4 | MOSI -> MISO
|
---|
| 5 | SCK -> SCK
|
---|
| 6 | D10 -> D10
|
---|
| 7 | GND -> GND
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #include <SPI.h>
|
---|
| 11 |
|
---|
| 12 | #define SS 10
|
---|
| 13 | #define DIM 11
|
---|
| 14 |
|
---|
| 15 | void setup() {
|
---|
| 16 |
|
---|
| 17 | pinMode (SS, OUTPUT);
|
---|
| 18 | digitalWrite(SS, HIGH);
|
---|
| 19 | Serial.begin(9600);
|
---|
| 20 | //
|
---|
| 21 | SPI.begin();
|
---|
| 22 |
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | void loop() {
|
---|
| 26 | String x ="hello world";
|
---|
| 27 | digitalWrite(SS, LOW);
|
---|
| 28 | for (int i=0;i<DIM;i++){
|
---|
| 29 | SPI.transfer(x[i]);
|
---|
| 30 | delay(1);
|
---|
| 31 | }
|
---|
| 32 | digitalWrite(SS,HIGH);
|
---|
| 33 | delay(1000);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.