|
Post by jamesbowman on Mar 4, 2014 19:03:41 GMT -8
If anyone has the Arduino Ethernet board and a few minutes to spare, perhaps they could run this sketch. It needs an outside internet connection excamera.com/files/tcpdev.inoit should display a ticking clock... the interesting part is that the display commands are being generated on the server; the Arduino continuously fetches commands and feeds them into the GD2. J.
|
|
yobi
New Member
Posts: 3
|
Post by yobi on Mar 4, 2014 21:59:32 GMT -8
Hi James,
Works perfect. Shows a clock, day, day and time.
Jos
|
|
hla
Junior Member

Posts: 29
|
Post by hla on Mar 5, 2014 2:12:49 GMT -8
I guess this can be used to speed up development time significantly ? Not having to download a new sketch each time you have a small graphical adjustment to do ?
Or did I miss something ?
/Helge
|
|
hla
Junior Member

Posts: 29
|
Post by hla on Mar 14, 2014 13:39:37 GMT -8
Any links to the server side software ?
|
|
ray
New Member
Posts: 1
|
Post by ray on Mar 25, 2014 20:40:57 GMT -8
Didn't work at first. Turns out I have an early Ethernet Shield without the SPI bus fix on it - it leaves the Wiznet W5100 MISO line enabled all the time, preventing the GD2 from communicating properly. Added an inverter to drive the SEN line from the select pin (like the newer designs), uploaded the sketch, and it came right up.
Disconnecting the net connection for a while and reconnecting causes the clock to "fast forward" to the current time - very cool! Where's that being done, on the server?
|
|
|
Post by jamesbowman on Mar 26, 2014 7:50:37 GMT -8
Yes, the server (in California) is sending out the drawing commands once per second. All the Arduino is doing is passing the drawing commands to the GPU. So the server could actually send out anything - pictures, animations, etc.
Here is the server code:
from twisted.internet import reactor, protocol from twisted.internet.task import LoopingCall
from gameduino2.base import GD2 import gameduino2.registers as reg import time from datetime import datetime
class remoteGD2(GD2): def __init__(self): self.buf = [] self.cmd_dlstart()
def c(self, s): self.buf.append(s)
def swap(self): self.Display() self.cmd_swap() self.cmd_dlstart()
def flush(self): r = "".join(self.buf) self.buf = [] return r
class Clock(protocol.Protocol): def connectionMade(self): self.g = remoteGD2() lc = LoopingCall(self.tick) lc.start(1.0)
def tick(self):
tm = datetime.now()
g = self.g g.cmd_gradient(0, 0, 0x101010, 480, 272, 0x202060)
g.cmd_clock(240, 120, 135, reg.OPT_NOBACK, tm.hour, tm.minute, tm.second, 0) g.cmd_text(240, 260, 26, reg.OPT_CENTER, tm.strftime("%a, %d %b %Y %T %z"))
g.swap()
self.transport.write(g.flush())
def main(): """This runs the protocol on port 8000""" factory = protocol.ServerFactory() factory.protocol = Clock reactor.listenTCP(8000, factory) reactor.run()
if __name__ == '__main__': main()
|
|
|
Post by Gendor on Aug 13, 2014 5:00:35 GMT -8
This is great! The link to the Arduino sketch is broken now. Any chance of making it available again?
|
|
|
Post by jamesbowman on Aug 15, 2014 6:00:33 GMT -8
|
|
|
Post by gendor on Aug 26, 2014 3:03:15 GMT -8
Excellent, it works when I run my own server! Had to wait a couple of days for the stackable headers I ordered to arrive so that I could plug in the Gameduino on top of my Ethernet shield. I can confirm it works without any problems on an Arduino Ethernet Shield R3.
I think this has a lot of potential for rapid prototyping of user interfaces.
|
|
|
Post by jamesbowman on Aug 26, 2014 12:20:47 GMT -8
The only downside of the thing as it stands is the throughput of the Arduino Ethernet card. It can carry about 10K bytes per second. That's about the same speed as dial-up. With decent speed Ethernet it could run more complex widgets/graphics.
|
|