Respected Sir
When I use ; it goes in infinite loop and does not give any output and without ; it gives output as
Output:
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Read value
0
Sir ,
Is this code correct, please suggest if something is wrong:
#include <SPI.h>// include the SPI library:
const int spidata = 10;//Pin 11 is data(MOSI) and pin 13 SCK ,set pin 10(SS) as the slave select for the digital pot:
void setup() {
pinMode (spidata, INPUT);// set the spi_data_pin as an output:
SPI.setDataMode(SPI_MODE3);
SPI.setClockDivider(SPI_CLOCK_DIV8);
SPI.begin();// initialize SPI:
Serial.begin(9600);}
byte ReadByte(void) {
while(!(SPSR & (1<<SPIF)));
return SPDR;
}
void loop() {
int rxData;
digitalWrite(spidata,LOW);
rxData = ReadByte();
Serial.println("Read value ");
Serial.println(rxData, DEC);
digitalWrite(spidata,HIGH);
delay(1500);
}