to transfer data out to 2 different devices, with SCK and MOSI going to both in parallel, and pin8 and pin10 being the control of whether device does something with the data or not.
What I am saying is connect D13 to the shift register SRCLK pin
D11 (MOSI) to the Serial Data In pin
Connect D8 to the RCLK (latch) pin
D10 is then used as CS/latch to the radio, and
D8 is the latch for the shift register
(although if it is 74HC595 type, it is really the output register clock)
SRCLR connects to +5, OE/ connects to GND, or to a control pin if you need to use it as output enable.
Connect a 0.1uF cap from shift register's VCC pin to Gnd.
Then only 1 more pin is used, and not 3 more to use shiftOut( )
I am desperate to conserve pins in this project so this helps a lot. Plus, I gather the hardware solution will be faster pushing out the bits (assuming little in the way of radio traffic).
Now I have two new ways to try!
I really appreciate the assistance. Thanks.
I grew up in Mass, so its nice to get help from my peeps XD
And where are you now?
Despite having lived here for most of my adult life, I still do not consider myself a Massachusettian, and I still cheer for the Giants first when they play the Patriots. New Yorker thru & thru!
I was able to get this all going very well with your assistance. I have attached where I am for the moment, but I have another question.
This sketch is for a weather station and this will be a slave Nano controlling the output to the weather and message portion of the project. While I was able (with the assistance of those present) to move a short message via serial from the master to the slave, I need help getting 'chunks' of data.
I would like to get the Weather, OutsideTemp, InsideTemp,Units, and MessageFlag in a format with which I can decode it and make it work for my sketch. Something like:
$A,-3,72,F,1#
$ = start of transmit
A = char
-3 = int
72 = int
F = boolean
1 = boolean
= end of transmit
I'm using this for the weather, but I can only retrieve a single char, experimenting with variable types has gotten me nowhere.
void loop()
{
//
//GO get Temp and Weather
//
if (Serial.read() == '
....
ClockSlaveWeatherSkitsFinal.ino (14 KB))
{
for (int i=0;i<3; i++)
{
delay(1);
MessageLength = i;
Message[i] = Serial.read();
delay(10);
Serial.print("read a: ");Serial.println(Message[i]);
if(Message[i] =='#');
{
break;
}
}
delay(10);
Serial.print("the message was:");
for(int i=0;i<MessageLength;i++)
delay(10);
{
Serial.print(Message[MessageLength]);
delay(10);
}
Serial.println("/");
}
switch (Message[MessageLength])
{
case 65://an "A" was sent
Serial.println("Sunny");
can't believe after the shift register and 3D array I'm struggling with this part.
This doesn't work:
char masterMessage[18];///
int msgLength = 0;
boolean IsMessage=false;
void setup()
{
Serial.begin(19200);
}
void loop()
{
if (Serial.available() >8){ // enough data arrived?
if (Serial.read() == '
Can you see what I'm doing wrong?
I should have gone to a better school){ // correct start byte?
while (Serial.read() != '#')
{
masterMessage[msgLength] = Serial.read();
msgLength=msgLength++;
}
} // end start byte test
IsMessage=true;
} // end data available check
if (IsMessage){
for (int i=0;i=msgLength;i=i++){
Serial.println(masterMessage[i]);
}
Serial.println(" ");
IsMessage = false;
}
msgLength = 0;
}
Can you see what I'm doing wrong?
I should have gone to a better school
This is gonna read half the data on you
while (Serial.read() != '#')
so this part will only see like every other byte
masterMessage[msgLength] = Serial.read();
Instead, try something like
while (done !=true){
do the 2nd part, masterMessage[msgLength] = Serial.read();
and then test
if (masterMessage[msgLength] == "#"){done = true;}
else {msgLength=msgLength++;}
){ // correct start byte?
while (done != true) {
masterMessage[msgLength] = Serial.read();
delay(10);
if (masterMessage[msgLength] == '#'){done=true;}
msgLength=msgLength++;
}
}
IsMessage=true;
} // end data available check
if (IsMessage){
for (int i=0;i<msgLength;i=i++){
Serial.println(masterMessage[i],DEC);
}
Serial.println(" ");
IsMessage = false;
}
msgLength = 0;
}
Output attached for this string
$A,-3,72,F,1#
entered into the serial terminal.
Can you tell me why it seems a bit fussy, and I had to add the delay to make it work?
It was printing back some odd characters...


Make this qty larger
if (Serial.available() >8){ // enough data arrived?
My count of the data being sent was not large enough, try >=13 vs >8
Otherwise can get a lot of empty incoming buffer reads.