****************************************************************************************************************


ASSIGNMENT: DESIGN AND BUILD A WIRED OR WIRELESS NETWORK CONNECTING AT LEAST TWO PROCESSORS

PROJECT: SATSHAKIT CHAT // CHAT PROGRAM BETWEEN 2 MICRO CONTROLLERS


COMUNICATION: SERIAL COMUNICATION

SOFT: IDE ARDUINO 1.6.3

BOARD: SATSHAKIT BY --> DANIELE INGRASSIA // GIT HUB REPOSITORY OF THE PROJECT

LIBRARIES: SoftwareSerial

DOWNLOAD:


****************************************************************************************************************


In this simple exercise of "networking ad communication" I worked with my classmate GIANLUCA PUGLIESE


Thanks to this easy exercise. I understood how to create communication between 2 microcontrollers using the "softwareSerial" Libraries. This libraries already include a class called " CHAT "


--> We used TX (Tranfer) pin 10 and RX (Reciver) pin 11 to connect the 2 microcontrollers

--> We used the serial monitor integrate to the IDE Arduino to visualize the Chat

--> We saw that for the communication to work, a connection between the 2 GND of the micro controller is obligatory.






            
            /*
Fab Academy 2015
Networking Communication
Gianluca Pugliese
Pierluigi De Palo

Chat Program between 2 Satshakit Micro Controller or Arduino
 

The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)
 

based on SoftwareSerial 
*/


#include 
 
SoftwareSerial chat(10, 11); // RX, TX
 
int text;
 
void setup()
{
     // open hardware serial, TX = 1, RX = 0
     Serial.begin(9600);
     Serial.println("start...");// set the baudrate
     chat.begin(9600);
     delay(1000); // delay 1s to stabilize serial ports
     chat.println("inizia");
}
 
void loop()
{
     if (chat.available())
          Serial.write(chat.read());
 
     if (Serial.available())
     {
          Serial.print("Pierluigi: ");
           chat.write("Pierluigi: ");
          while (Serial.available())
          {
               text = Serial.read();
               
              
               
               chat.write(text);
               
               Serial.write(text);
          }
          chat.println();
          Serial.println();
     }
}