Hardware Reference
In-Depth Information
1.
The Raspberry Pi tries to idenify the Arduino by sending a character A . The Arduino
responds with an acknowledgement character A :
if(serial_read=='A'){
Serial.print("A");
}
2. This is a foolproof mechanism to idenify and establish a communicaion with the
weather clock controller from the Raspberry Pi.
Temperature data
1.
The Raspberry Pi temperature data is sent to the Arduino with the leter / character S .
The received data is converted to a signed integer and passed as an argument to the
7-Segment display libraries:
if(serial_read=='S') {
while(Serial.available()){
sb = Serial.read();
sevenseg_string[serInIndx] = sb;
serInIndx++;
temp=0;
}
temp=atoi(sevenseg_string);
memset(sevenseg_string,0,9);
}
2.
When the character S is received, we read all the characters into the buffer
sevenseg_string . The string is converted to an integer using the atoi
funcion and stored in the temp variable. The buffer is cleared at the end
of the cycle. This method takes sub-zero temperatures into consideraion.
Control of the RGB LED strip
1.
The individual colors of the RGB LED are controlled individually using the ASCII
characters R , G , and, B respecively. Each color indicates a unique weather condiion,
namely, blue indicates cold weather, green indicates fair weather condiions, and red
color indicates impeding danger in weather condiions:
if(serial_read=='R' || serial_read=='G' ||
serial_read=='B') {
color_bit=serial_read;
}
if(color_bit=='R'){
lightsequence_red();
}
else if(color_bit=='G'){
lightsequence_green();
 
Search WWH ::




Custom Search