Robin2:
OK. so now it seems that the problem really is in the code in the myShiftIn() function. Have you tried my suggestion from Reply #23 to comment out all the other code in the myShiftIn() function.Actually, I think I got confused in my Reply #27. I should have referred to my Reply #19 rather than Reply #23. But at this stage the difference is not important.
...R
Oh alright, well if I comment out everything else except for:
byte myDataIn = 123;
return myDataIn;
It starts sending the data to the other module. All the data gets sent so that works.
byte myShiftIn(int dataPin, int clockPin, int bitOrder) {
/* --------- Commented out ---------
int i;
int temp = 0;
byte myDataIn = 0;
pinMode(clockPin, OUTPUT);
pinMode(dataPin, INPUT);
for (i=7; i>=0; i--)
{
digitalWrite(clockPin, 0);
delayMicroseconds(2);
temp = digitalRead(dataPin);
if (temp && bitOrder == LSBFIRST) {
myDataIn = myDataIn | (1 << i);
}
digitalWrite(clockPin, 1);
}
--------- Commented out --------- */
byte myDataIn = 123;
return myDataIn;
}