Hey guys, was wondering if i could get some help understanding how communicating between 2 Wifly gsx Breakouts work.
Both of them are connected to a mbed LPC1768 and conected to my pc via serial. The mbed has this program in them:
#include “mbed.h”
#include “Wifly.h”
Serial pc(USBTX, USBRX);
Serial wifi(p28,p27);
int main() {
pc.printf(“Wifly connected!\r\n”);
while (1) {
if (pc.readable()) {
wifi.putc(pc.getc());//a send receive from pc to mbed/wifly
}
if (wifi.readable()) {
pc.putc(wifi.getc());//a send receive from mbed/wifly to pc
if (wifi.readable()) {
wifi.putc(wifi.getc());
}
}
}
}
I’m trying out a project where it involves me sending ‘commands’ from one wifly to another to control a set of motors (done by my project partner). I’ve been able to connect the 2 Wiflys together with one acting as a adhoc network and the other connecting to it.
Here are the steps I took to set them up:
For the adhoc host
set wlan join 4
set lan phrase 12345678
set waln ssid testtest
set ip address 192.168.2.2
set ip dhcp 0
set ip proto 1
set ip netmask 255.255.255.0
set ip gateway 192.168.2.1
For the one connecting to the host
set wlan join 1
set wlan ssid testtest
set wlan phrase 12345678
set ip address 192.168.2.3
set ip netmask 255.255.255.0
set ip gateway 192.168.2.1
set ip host 192.168.2.2
set ip remote 2000
I’m not very familiar with how they’re supposed to send commands from one to the other and when I exit command mode and try to type something, nothing happens. Tried out the beginner steps on the wifly cookbook on the mbed website but that has not helped much(or maybe don’t realise it?)
I know this may seem like a very elementary question but I’m someone who hasn’t done such networking/programming before. I’ve heard from one of my lecturers that I will have to send the commands over uart and have tried out the uart settings but to no avail.
Wondering if anyone could help me understand how and what is required of these two devices communicate? Would appreciate it very much.