spi connection arduino mega,lpc1768

arduino code

#include <SPI.h>

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

  SPI.setClockDivider(SPI_CLOCK_DIV32);
  
}  


void loop (void)
{
  
    int sensorDegeri = analogRead(A0);
    Serial.println(sensorDegeri);
    digitalWrite(SS, LOW);
    SPI.transfer (sensorDegeri);
     
  digitalWrite(SS, HIGH);

  delay (1000);  // 1 second delay between the next 255 bytes

}  


lpc code;



#include "mbed.h"

Serial pc(USBTX, USBRX);
SPISlave spi(p11, p12, p13, p14); //mosi, miso, sclk,ss

int main() {
pc.baud(115200);
int x;
    while(1) {
    if(spi.receive()){
        x = spi.read();
        pc.printf("\r\n%d \n", x);
            }
    
    }
}

Changes

RevisionDateWhoCommit message