[vc_row][vc_column width=”1/1″][vc_column_text]Last time we have achieved “Interact AT command between pcDuino and Spyder” via USB port of pcDuino, today we are going to use the UART(GPIO 0, GPIO 1) on pcDuino to achieve powerline communication for pcDuino.[/vc_column_text][vc_tour][vc_tab title=”Wire Diagram” tab_id=”1388375452-1-19″][vc_column_text]
1. Connect Spyder’s pin 2 to GPIO 1 on pcDuino, spyder’s pin 3 to GPIO 0 on pcDuino, pin 10 to GND of pcDuino.
2.Connect the powerline interfaces of these two spyder and power them up( DC5-12V).
3.Power up pcDuino.[/vc_column_text][/vc_tab][vc_tab title=”Parts List” tab_id=”1388375452-2-80″][vc_column_text]pcduino V2 x 1
pcduino lite Wifi x 1
(Two pcDuino V2 would also be acceptable.)
spyder x 2
jumper wires[/vc_column_text][/vc_tab][vc_tab title=”Sample Code” tab_id=”1388381098966-2-8″][vc_column_text]/*************
….
**************/
The code in above structure can achieve interacting AT command between pcDuino and Spyder, but this time we use UART of pcDuino instead of USB port. You can cancel the comments to see how it goes if you want, but do not forget to add these comments to the original code without comments.
Code for pcDuino Lite wifi:
#include <core.h>
/*********************
static unsigned char i = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
if(i == 0){
Serial.print(“+++”);
printf(“+++ have send!\n”);
}
else if (i == 1){
Serial.print(“ATSN”);
Serial.print(‘\n’);
printf(“ATSN have send!\n”);
}
else if (i == 2){
Serial.println(“ATEX”);
printf(“ATEX have send!\n”);
}
while(Serial.available() > 0){
printf(“%c”,Serial.read());
}
i++;
delay(3000);
}
************************/
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.println(“Lite Wifi:520linksprite!”);
delay(1000);
while(Serial.available() > 0){
char c = Serial.read();
printf(“%c”,c);
}
}
Code for pcDuino V2:
#include <core.h>
/*********************
static unsigned char i = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
if(i == 0){
Serial.print(“+++”);
printf(“+++ have send!\n”);
}
else if (i == 1){
Serial.print(“ATSN”);
Serial.print(‘\n’);
printf(“ATSN have send!\n”);
}
else if (i == 2){
Serial.println(“ATEX”);
printf(“ATEX have send!\n”);
}
while(Serial.available() > 0){
printf(“%c”,Serial.read());
}
i++;
delay(3000);
}
************************/
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.println(“Pcduino V2:520linksprite!”);
delay(1000);
while(Serial.available() > 0){
char c = Serial.read();
printf(“%c”,c);
}
}[/vc_column_text][/vc_tab][vc_tab title=”Compile” tab_id=”1388381466899-3-5″][vc_column_text]You may search useful information online about how to get Arduino-ish API and compile it on pcDuino.[/vc_column_text][/vc_tab][vc_tab title=”Results” tab_id=”1388381502667-4-10″][vc_column_text]
pcDuino Lite wifi sends “Lite Wifi: 520linksprite” to spyder via UART from the code, the message shows up on pcDuino V2.
Similarly, pcDuino V2 sends “pcDuinov2: 520linsprite” to Spyder via UART, the message shows up on pcDuino Lite wifi.
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.