void main() { setup_spi(SPI_SLAVE | SPI_MODE_1); //set up SPI hardware as a slave in mode 1 int val; while(true) { val = spi_read(0); //spi_read must be passed an argument. The argument va lue is sent //back to the master whenever the master sends us a me ssage again. //This allows two-way communication, but here the mast er ignores //whatever the slave sends back, so just send a 0. //display the value read: printf("Pot at: %u ", val); } }