Hey,
My project that i'm working on is to do with sending data from board A to board B. Right now i'm only sending numbers. Also I've been using the ASCII chart to tell board B how it should interpret what board A sends it. The way I have set it up is so that board A will go HIGH when when it needs to send a 1 and will go LOW when it needs to send a 0. The problem is I feel the way I have set the whole thing up is really inefficient. for example the code for board B to recognise that the number being sent to it is a "0" (00110000 in ASCII) is
if (bitEight == false and bitSeven == false and bitSix == true and bitFive == true and bitFour == false and bitThree == false and bitTwo == false and bitOne == false)
{
number = 0;
}
and for board A to send a "0", it looks like
if (Bit == 1)
{
digitalWrite(dataLineOut, LOW);
}
if (Bit == 2)
{
digitalWrite(dataLineOut, LOW);
}
if (Bit == 3)
{
digitalWrite(dataLineOut, LOW);
}
if (Bit == 4)
{
digitalWrite(dataLineOut, LOW);
}
if (Bit == 5)
{
digitalWrite(dataLineOut, HIGH);
}
if (Bit == 6)
{
digitalWrite(dataLineOut, HIGH);
}
if (Bit == 7)
{
digitalWrite(dataLineOut, LOW);
}
if (Bit == 8)
{
digitalWrite(dataLineOut, LOW);
}
This does work, but does anyone have a better idea of how to do it, store and send data that is? Both of those codes are for ONE number, so if I was to add more numbers I would also have to add more of these long pieces of code.
Thanks!