Commit 467083cc authored by Philip Hozier's avatar Philip Hozier
Browse files

wk13 5/5 update #4

parent 343d3df9
Pipeline #228888 passed with stages
in 19 seconds
......@@ -416,22 +416,34 @@ A different program on the controller would broadcast a 'message' and the nodes
The main part of the programming would be to find out how to send and receive signals - and then how the receiver board deals with it.
- Include the correct library e.g. Wire (I2C for Arduino)
e.g. #include <Wire.h></Wire.h>
- Start Serial communication
Serial.begin(baudrate)
Serial.begin(baudrate);
- Join I2C bus
Wire.begin(optional address); // Controller doesn't necessarily need an address
Wire.begin(optional address); // Controller doesn't necessarily need an address
- Transmit
Wire.beginTransmission(node_address); // transmit to a specific node
Wire.write(myMessage); // send bytes
Wire.endTransmission(); // stop transmission
Wire.beginTransmission(node_address); // transmit to a specific node
Wire.write(myMessage); // send bytes
Wire.endTransmission(); // stop transmission
- Receive
Wire.onReceive(receiveEvent); // register event
/// in a function
void receiveEvent(int howMany) {
int x = Wire.read(); // receive byte as an integer
// do something
}
Wire.onReceive(receiveEvent); // register event
/// in a function
void receiveEvent(int howMany) {
int x = Wire.read(); // receive byte as an integer
// do something
}
These functions would be used on the different boards depending on their proposed functionality.
---
## What I should’ve done
---
......@@ -444,6 +456,8 @@ I probably should've found out that SDA and SCL need pullup resistors for commun
**Big design**
![Individual Assignment](../week13/peripheral-design-1.jpg "peripheral design 1")
My first 'baby' board i designed was a little big i thought and would take too long to mill based on how many people needed to use the milling machine. It was based on the 'master' board with a ATtiny1614 with both SPI and I2C connections. I decided to use the ATtiny412 and only have I2C connections, so i would use something different from the controller board and minimise the amount of space used.
**Rx + Tx around the wrong way again**
......@@ -484,7 +498,7 @@ I then had trouble uploading the programs, with the error 'UPDI failed to initia
## CONCLUSION
---
I have one foot firmly inside the door that is Networking and Communications. From which I can expand my knowledge of using different protocols and deepen what I now know.
I have one foot firmly inside the door that is Networking and Communications. From which I can expand my knowledge of using different protocols and deepen what I now know. My confidence in Electronics is growing.
---
## FILES
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment