Commit d2916728 authored by Drew Griggs's avatar Drew Griggs
Browse files

networking group work

parent 0db5738a
Pipeline #228386 passed with stage
in 45 seconds
......@@ -6,6 +6,4 @@ This week for group work we needed to probe an analog and digital input device u
For the digital input we tested it with a button. We wired the probe to one side and then grounded it on the other. When the button was pressed we could see the signal passing through. It would become a straight line when low and then would show some waves when the button was high. We finally found a way to adjust the axis so that we got distinct waves.
<iframe width="900" height="650" src="https://www.youtube.com/embed/Ya4m2pfaF3w" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="900" height="650" src="https://www.youtube.com/embed/Ya4m2pfaF3w" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
\ No newline at end of file
# Networking & Communication
This week our group experimented with networking & communication through communicating between two projects, and sending and recieving a message.
\ No newline at end of file
This week our group experimented with networking & communication through communicating between two projects, and sending and recieving a message.
We communicated between the final project boards of studnets [Drew Griggs](http://fabacademy.org/2021/labs/charlotte/students/drew-griggs/) and [Teddy Warner](http://fabacademy.org/2021/labs/charlotte/students/theodore-warner/).
## Hardware
We started by hooking up our boards. Drew's final project included the use of both software and hardware serial, so we used that board as a "slave" board. We had it recieve messages through the software serial port, and send them out to a monitor through the hardware serial ports.
IMAGE OF DREWS BOARD
Teddy's board included many more pin headers for an LCD display, as well as a power regulator to drop power down from 12V, tx/rx pins, and other features. These extra features make it optimal if we wanted to hook up multiple different boards to it, so we used it as a master board.
IMAGE OF TEDDYS BOARD
We connected the programming pins to their respective locations, and programmed our boards. Drew's board uses FTDI protocol, so we hooked up an FTDI chip to program it. Teddy's board uses ISP protocol, so we connected an arduino uno programmed with "Arduino as ISP" to program it.
## Software
Master Code:
```
int tx = 0;
void setup()
{
Serial.begin(9600);
}
void loop() {
Serial.println(tx);
tx++;
delay(500);
}
```
Slave Code:
```
#include <SoftwareSerial.h>
#define sensdx 3
SoftwareSerial port2(sensdx, 9);
String rx;
void setup() {
Serial.begin(9600);
while(!Serial)
{
;
}
port2.begin(9600);
}
void loop() {
port2.listen();
rx = port2.parseInt();
Serial.println(rx);
}
```
The slave code was the most complicated, as it involved 2 serial ports. Most of the code is setup, including the SoftwareSerial library, setting up the pins, and starting the port. All the code does is listen to the software serial port, set a string to any incoming data, and print it to hardware serial.
The master code simply prints an incrementing integer every 1/2 second.
## Testing
We uploaded our code using our different protocols and starting testing. We connected the tx pin of Teddy's board to the software serial rx pin on Drew's, opened the serial port, and found ourselves reading an incrementing integer:
VIDEO
Our files for this group assignment can be found in this [zip file](../files/NetworkingFiles.zip)
\ No newline at end of file
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