This is my make-through for the week's assignment. Grab a cup of coffee!
Make a circuit as per the given diagram.
Connect both the RX and TX pins of Arduino vice versa (first Arduino’s TX pin to another’s RX pin and first Arduino’s RX pin to another’s TX pin)
common the ground pin of both Arduino.
There are two codes for two Arduino boards. One for the master and one for the slave
For this assignment, I used 2 boards the Atmega board as master and the Arduino as a slave.
The Master Code
include the library SPI.h
define the slave select pin and the switch
the void loop is switching between two characters sent to the slave with a 1000-millisecond delay in between.
The slave code:
include the library SPI.h
define the slave select pin and the led
define s_recieve which saved received data
the void loop check if the condition is done to change the LED state according to the sent character
[ 4 connections (MOSI, MISO, SCK and CS). and grounds must be common.]
What I learned this week is...
the types of communications between electronic boards [serial, parallel ].
types of serial communication
the UART communication protocol
the I2C communication protocol
the SPI communication protocol
communicate between boards using UART and ISP