This is a nice board but a little mysterious to get working. Or at least like I want it to. But I’m getting there. The Xbee is just so much easier for what I want to do in terms of a high speed real time network without all the overhead of access points, tcp/ip and all that jazz. BUT, I’m hoping this chip will allow direct control of my widget (and all it’s connected servos and other devices) direct from a smartphone or tablet. It should also provide a gateway from the Xbee network to the 802.11 network without the raspberry Pi. We shall see. Nevertheless, I really enjoy playing with new gadgets like this so I’m having a blast.
I’ve come up with a very basic uart library for the widget called obviously enough, wiFlyUartLibrary. You can find it on the control widgets files page.
Here is a listing of the Ardunio code that turns the widget (with the help of the serial port on the USB programmer) into a local terminal for the WiFly Module:
data = wifi.getByte1();
if (data != 0xff)
data = wifi.getByte0();
if (data != 0xff)
All the schematics and source code for this are on my controlwidgets.com page.
I also have been exploring a way to make apps for my Android Tablet. I’ve tried all sorts of development things like Eclipse and Android Studio and Xamarin and PhoneGap and all that and I really like, I prefer just because its simple and easy, is Python and PyGame for Android. Here are several links:
Here is the initial download for Pygame, I use Python 2.7 32 bit for this.
PyGame for Python
This is an add-on to allow you to develop android apps using Python and PyGame.
PyGame for Android Subset
There is also a library of widgets (sliders, dropdowns, buttons, etc) for PyGame called PGU that will also work on Android, IF you make a few changes to it:
Phils Game Utilities
And this link has the changes you will need to make to PGU so it works on Android:
PGU Modifications for Android
This is the python code to display one slider and send it via a socket to the Wifly module:
from pgu import gui
from pygame.locals import *
# Import the android module. If we can't import it, set it to None - this
# lets us test it, and check to see if we want android-specific behavior.
android = None
TIMEREVENT = pygame.USEREVENT
FPS = 30
screen = pygame.display.set_mode((800,480),SWSURFACE)
# Map the back button to the escape key.
# set the timeout to 1 second, just in case it's not there
# open a connection to the AP in the locomotive
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "connected to 10.20.10.1"
fg = (255,255,255)
e = gui.HSlider(100, 0, 500, size=20,width=700,height=80,name='speed')
e.connect(gui.CHANGE, self.adjustSliderA, (0,e))
self.sv = 0
def adjustSliderA( self, value):
(num, slider) = value
self.sv = slider.value
def SliderValueA( self ):
app = gui.App()
sc = screenContainer()
c = gui.Container(width=200,height=180)
pygame.time.set_timer(TIMEREVENT, 1000 / FPS)
done = False
while not done:
for ev in pygame.event.get():
if ev.type == TIMEREVENT:
elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_ESCAPE:
done = True
v = str(sc.SliderValueA()) + "rn"