Design Network

I will be using 2 boards from previous weeks to send data and turn a led in the other one. Board from week 11 (Input) will send either 1 or 0 and the other board will turned on/off depending of the value.

Coding

First I will code the OUTPUT. Attiny45 do not have hardware serial comm, instead software based will be used. SoftwareSerial library allows tiny and arduino boards to create extra serial pins so, we are adding to the code.

Defining some variables and creating the SoftwareSerial object which will be called "softserial". This object need the values for virtual Rx and Tx.

In "setup" function, "softserial" starts with the begin method and some ports are defined as input/output.

Finally the "loop" code is added. Here a LED is turned on/off for debugging purpose and 0 and 1 bytes are sent through Tx pin.

Coding the input

Including librar, variables and opening the serial comm it's similar.

In "loop" thing changes because now it is reading data.

Testing

Using an arduino board for power feeding, I connect it to the output board and from it, serial connect the other board. Video show data send from one and the other recieving.

Files

Coding files can be found at here.